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

Conversation

reutenauer
Copy link
Contributor

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

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

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

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

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

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

@reutenauer
Copy link
Contributor Author

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

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
Development

Successfully merging this pull request may close these issues.

None yet

3 participants