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

First attempt at a Python 3 version. #8

Merged
merged 3 commits into from Nov 13, 2019
Merged

Conversation

@reutenauer
Copy link
Contributor

@reutenauer reutenauer commented Nov 12, 2019

This slightly modified version of dviasm.py works with Python 3; I haven’t tested it intensively yet.

I’ll make an attempt at a single file that works with both Python versions later.

@khaledhosny
Copy link
Contributor

@khaledhosny khaledhosny commented Nov 12, 2019

I’ll make an attempt at a single file that works with both Python versions later.

A Python 3-only version is fine by me, Python 2 is nearly EOL.

@reutenauer
Copy link
Contributor Author

@reutenauer reutenauer commented Nov 12, 2019

True enough. Let me test a bit more though, there’s no need to rush (I just reacted to Ulrike’s email on the TeX Live list).

@khaledhosny
Copy link
Contributor

@khaledhosny khaledhosny commented Nov 12, 2019

Let me know when you this this ready, and please overwrite the old file so the diff is visible on GitHub interface.

@norbusan
Copy link

@norbusan norbusan commented Nov 13, 2019

Hi @reutenauer
thanks for the changes, they look fine to me, but there are a few problems remaining:

  • shebang should be python3
  • crash 1: normal dvi file
  File "dviasm.py", line 1220, in <module>
    else:              aDVI.DumpToFile(sys.stdout, tabsize=options.tabsize, encoding=options.encoding)
  File "dviasm.py", line 941, in DumpToFile
    fp.write("set: %s\n" % PutStr(cmd[1]))
  File "dviasm.py", line 230, in PutStrUTF8
    else:               s += chr(o).encode('utf8')
TypeError: can only concatenate str (not "bytes") to str
  • crash 2: ptex dvi file
  File "dviasm.py", line 1220, in <module>
    else:              aDVI.DumpToFile(sys.stdout, tabsize=options.tabsize, encoding=options.encoding)
  File "dviasm.py", line 941, in DumpToFile
    fp.write("set: %s\n" % PutStr(cmd[1]))
  File "dviasm.py", line 229, in PutStrUTF8
    s += ''.join(['\x1b$B', chr(o/256), chr(o%256)]).decode('iso2022-jp').encode('utf8')
TypeError: integer argument expected, got float

Best

@reutenauer
Copy link
Contributor Author

@reutenauer reutenauer commented Nov 13, 2019

Thanks @norbusan, I’ll have a look later today (European time).

@reutenauer
Copy link
Contributor Author

@reutenauer reutenauer commented Nov 13, 2019

I think I addressed all the problems reported by @norbusan, and rewrote dviasm.py as @khaledhosny asked.

@khaledhosny khaledhosny merged commit d084349 into aminophen:master Nov 13, 2019
@khaledhosny
Copy link
Contributor

@khaledhosny khaledhosny commented Nov 13, 2019

Thanks!

@khaledhosny khaledhosny mentioned this pull request Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants