UnicodeEncodeError from craft

Boylan, Ross Ross.Boylan at ucsf.edu
Fri Jul 9 23:15:50 BST 2021


Boost has some file paths that deliberately employ non-ASCII characters, I think as part of a test.
When craft -i caused boost to get updated, it produced a bunch of errors.  The key is probably
UnicodeEncodeError: 'charmap' codec can't encode character '\x9f' in position 137: character maps to <undefined>

The call stack refers to cp1252.py (Windows-1252 or CP-1252 is a single-byte character encoding of the Latin alphabet says Wikipedia), which seems like the wrong thing to be converting to or from since modern Windows file names are in what MS calls "Unicode", actually UTF16.

The messages suggest there might have been problems deleting the directory, but perhaps the problem is just in formatting a message for the log.
At any rate, craft reports successful completion of the task, and goes on with other builds.

PREVIOUS REPORTS
1. ACCESS DENIED
Perhaps the issue was that snoretoast was currently in use--namely with all the previous notifications.
I cleared all its notifications from the notification area and was able to delete bin\snoretoast.exe from 
the command line of the same powershell session in which craft got ACCESS DENIED.
Craft -i kdiff3 then resumed, building snoretoast and continuing on.
Which led to the error above.

2. PNG2ICO
Since I couldn't build it I didn't.  The build of kdiff3 seemed to work OK.


DETAILS ABOUT ENCODING ERROR
Here's a fuller section of the terminal output associated with the encoding errors:

*** Craft all succeeded: kde/frameworks/tier3/kparts after 5 seconds ***
========================================================================================================================
*** Handling package: libs/boost/boost-headers, action: all ***
*** Action: fetch-binary for libs/boost/boost-headers ***
*** libs/boost/boost-headers not found in cache ***
*** Action: fetch for libs/boost/boost-headers ***
wget https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz
J:/CraftRoot/download/archive 100%[=================================================>] 124.24M  10.4MB/s    in 15s
*** Action: unpack for libs/boost/boost-headers ***
--- Logging error ---
Traceback (most recent call last):
  File "J:\Programs\Python39\lib\logging\__init__.py", line 1086, in emit
    stream.write(msg + self.terminator)
  File "J:\Programs\Python39\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\x9f' in position 137: character maps to <undefined>
Call stack:
  File "J:\CraftRoot\craft\bin\craft.py", line 274, in <module>
    success = main(timer)
  File "J:\CraftRoot\craft\bin\craft.py", line 264, in main
    if not CraftCommands.run(package, action, tempArgs):
  File "J:\CraftRoot\craft\bin\CraftCommands.py", line 421, in run
    if not handlePackage(info, action, directTargets=directTargets):
  File "J:\CraftRoot\craft\bin\CraftCommands.py", line 94, in handlePackage
    success = doExec(package, action)
  File "J:\CraftRoot\craft\bin\CraftCommands.py", line 58, in doExec
    ret = package.instance.runAction(action)
  File "J:\CraftRoot\craft\bin\Package\PackageBase.py", line 247, in runAction
    if not getattr(self, step)():
  File "J:\CraftRoot\craft\bin\Source\MultiSource.py", line 45, in unpack
    return self._sourceClass.unpack(self)
  File "J:\CraftRoot\craft\bin\Source\ArchiveSource.py", line 220, in unpack
    utils.cleanDirectory(self.workDir())
  File "J:\CraftRoot\craft\bin\utils.py", line 326, in cleanDirectory
    if not OsUtils.rmDir(f.path, force=True):
  File "J:\CraftRoot\craft\bin\CraftOS\win\osutils.py", line 58, in rmDir
    if not OsUtils.rmDir(f.path, force):
  File "J:\CraftRoot\craft\bin\CraftOS\win\osutils.py", line 58, in rmDir
    if not OsUtils.rmDir(f.path, force):
  File "J:\CraftRoot\craft\bin\CraftOS\win\osutils.py", line 58, in rmDir
    if not OsUtils.rmDir(f.path, force):
  [Previous line repeated 3 more times]
  File "J:\CraftRoot\craft\bin\CraftOS\win\osutils.py", line 50, in rmDir
    CraftCore.log.debug(f"deleting directory {path}")
Message: 'deleting directory J:\\CraftRoot\\build\\_\\315c4231\\boost_1_76_0\\libs\\wave\\test\\testwave\\testfiles\\utf8-test-Ã\x9fµâ\x84¢â\x88\x83'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "J:\Programs\Python39\lib\logging\__init__.py", line 1086, in emit
    stream.write(msg + self.terminator)
  File "J:\Programs\Python39\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\x9f' in position 132: character maps to <undefined>
Call stack:
  File "J:\CraftRoot\craft\bin\craft.py", line 274, in <module>
    success = main(timer)
  File "J:\CraftRoot\craft\bin\craft.py", line 264, in main
    if not CraftCommands.run(package, action, tempArgs):
  File "J:\CraftRoot\craft\bin\CraftCommands.py", line 421, in run
    if not handlePackage(info, action, directTargets=directTargets):
  File "J:\CraftRoot\craft\bin\CraftCommands.py", line 94, in handlePackage
    success = doExec(package, action)
  File "J:\CraftRoot\craft\bin\CraftCommands.py", line 58, in doExec
    ret = package.instance.runAction(action)
  File "J:\CraftRoot\craft\bin\Package\PackageBase.py", line 247, in runAction
    if not getattr(self, step)():
  File "J:\CraftRoot\craft\bin\Source\MultiSource.py", line 45, in unpack
    return self._sourceClass.unpack(self)
  File "J:\CraftRoot\craft\bin\Source\ArchiveSource.py", line 220, in unpack
    utils.cleanDirectory(self.workDir())
  File "J:\CraftRoot\craft\bin\utils.py", line 326, in cleanDirectory
    if not OsUtils.rmDir(f.path, force=True):
  File "J:\CraftRoot\craft\bin\CraftOS\win\osutils.py", line 58, in rmDir
    if not OsUtils.rmDir(f.path, force):
  File "J:\CraftRoot\craft\bin\CraftOS\win\osutils.py", line 58, in rmDir
    if not OsUtils.rmDir(f.path, force):
  File "J:\CraftRoot\craft\bin\CraftOS\win\osutils.py", line 58, in rmDir
    if not OsUtils.rmDir(f.path, force):
  [Previous line repeated 3 more times]
  File "J:\CraftRoot\craft\bin\CraftOS\win\osutils.py", line 61, in rmDir
    if not OsUtils.rm(f.path, force):
  File "J:\CraftRoot\craft\bin\CraftOS\win\osutils.py", line 23, in rm
    CraftCore.log.debug("deleting file %s" % path)
Message: 'deleting file J:\\CraftRoot\\build\\_\\315c4231\\boost_1_76_0\\libs\\wave\\test\\testwave\\testfiles\\utf8-test-Ã\x9fµâ\x84¢â\x88\x83\\file.hpp'
Arguments: ()
Digests for 1.76.0: (['7bd7ddceec1a1dfdcbdb3e609b60d01739c38390a5f956385a12f3122049f0ca'], CraftHash.HashAlgorithm.SHA256)
executing command: J:\CraftRoot\dev-utils\bin\7za.exe x J:\CraftRoot\download\archives\libs\boost\boost-headers\boost_1_76_0.tar.gz -so -bsp2 | J:\Programs\Python39\python.exe -u J:\CraftRoot\craft\bin\untar.py J:\CraftRoot\build\_\315c4231
*** Action: compile for libs/boost/boost-headers ***
*** Action: cleanimage for libs/boost/boost-headers ***
*** Action: install for libs/boost/boost-headers ***
*** Action: post-install for libs/boost/boost-headers ***
*** Action: qmerge for libs/boost/boost-headers ***
*** Action: post-qmerge for libs/boost/boost-headers ***
*** Craft all succeeded: libs/boost/boost-headers after 12 minutes 27 seconds ***



More information about the Kde-windows mailing list