Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

singleheader.py fixes for Windows and newer Python #74

Merged
merged 1 commit into from
Nov 1, 2023

Conversation

sgraham
Copy link
Contributor

@sgraham sgraham commented Oct 29, 2023

Windows assumes cp1252 resulting in:

  ...
  File "...\STC\src\singleheader.py", line 47, in process_file
    process_file(
  File "...\STC\src\singleheader.py", line 28, in process_file
    for line in f:
  File "C:\Program Files\Python312\Lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
	   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 426: character maps to <undefined>

Additionally, \* seems to have changed in recent Py3 versions (?), so they need an extra backslash:

...\STC\src\singleheader.py:30: SyntaxWarning: invalid escape sequence '\*'
  if re.search('/\*.*?\*/', line):

Windows assumes cp1252 resulting in:
	  ...
	  File "c:\src\dyibicc\scratch\STC\src\singleheader.py", line 47, in process_file
	    process_file(
	  File "c:\src\dyibicc\scratch\STC\src\singleheader.py", line 28, in process_file
	    for line in f:
	  File "C:\Program Files\Python312\Lib\encodings\cp1252.py", line 23, in decode
	    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
		   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 426: character maps to <undefined>

Additionally, \* seems to have changed in recent Py3 versions (?), so
they need an extra backslash:

	...\STC\src\singleheader.py:30: SyntaxWarning: invalid escape sequence '\*'
	  if re.search('/\*.*?\*/', line):
@tylov
Copy link
Collaborator

tylov commented Nov 1, 2023

Thanks. I have enabled "Beta:Use Unicode UTF-8 for worldwide language support" in the system locale settings in windows, so I don't notice this kind of issues.

@tylov tylov merged commit e359b9d into stclib:master Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants