isolver / OpenHandWrite

Python tools for the recording and analysis of handwriting captured via pen tablet type devices.
GNU General Public License v3.0
14 stars 4 forks source link

UnicodeDecodeError #233

Open roehrigjan opened 3 years ago

roehrigjan commented 3 years ago

Hi,

everytime I run MarkWrite.bat in a folder path with non-ascii characters like ö, ä, ü (i.e. in the home directory of a windows user with ä, ö, ü in his name like me) MarkWrite won't start and I get the following error message:

Traceback (most recent call last): File "runapp.py", line 35, in <module> wmwin = MarkWriteMainWindow(markwrite.app) File "C:\Users\Jan R÷hrig\Downloads\OpenHandWrite\OpenHandWrite\WinPython\python-2.7.10.amd64\lib\site-packages\markwrite-0.4.9-py2.7.egg\markwrite\gui\mainwin.py", line 116, in __init__ self._predefinedtags = loadPredefinedSegmentTagList(u'default.tag') File "C:\Users\Jan R÷hrig\Downloads\OpenHandWrite\OpenHandWrite\WinPython\python-2.7.10.amd64\lib\site-packages\markwrite-0.4.9-py2.7.egg\markwrite\file_io.py", line 531, in loadPredefinedSegmentTagList tag_file_path = getSegmentTagsFilePath(file_name) File "C:\Users\Jan R÷hrig\Downloads\OpenHandWrite\OpenHandWrite\WinPython\python-2.7.10.amd64\lib\site-packages\markwrite-0.4.9-py2.7.egg\markwrite\util.py", line 59, in getSegmentTagsFilePath return os.path.join(get_resource_folder_path(),'tags',tags_file_name) File "C:\Users\Jan R÷hrig\Downloads\OpenHandWrite\OpenHandWrite\WinPython\python-2.7.10.amd64\lib\site-packages\markwrite-0.4.9-py2.7.egg\markwrite\util.py", line 47, in get_resource_folder_path datadir = os.path.join(module_directory(getTime),u'resources') File "C:\Users\Jan R÷hrig\Downloads\OpenHandWrite\OpenHandWrite\WinPython\python-2.7.10.amd64\lib\ntpath.py", line 85, in join result_path = result_path + p_path UnicodeDecodeError: 'ascii' codec can't decode byte 0xf6 in position 12: ordinal not in range(128)

As workaround you can run the program in a directory without any non-ascii characters (i.e. C:\Smartpen\OpenHandWrite).

Mark-Torrance commented 3 years ago

The permanent fix for this, as I understand it, would be to port MarkWrite to Python 3. I don't think it's worth making changes to the current version to accommodate non-ascii paths. As you say, the easiest fix for this is to avoid using non-ascii characters in directory and filenames.