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

Python3 mode #4

Closed
rixx opened this issue Oct 20, 2016 · 4 comments
Closed

Python3 mode #4

rixx opened this issue Oct 20, 2016 · 4 comments

Comments

@rixx
Copy link

rixx commented Oct 20, 2016

I haven't gotten the script to work with Python3 yet. Things I did so far:

  • print-statements (obviously)
  • octal literals with 0o666 instead of 0666
  • cmd = 'exec(open(\\"{}\\", "r").read())'.format(name) because Python3 doesn't have execfile
  • tmp.write(script.encode()) due to bytes/string conversion

I'm guessing that I'm either screwing up with bytes/strings/file reads or the Python3 interface differs in a way that doesn't raise an exception explaining the problem. Anybody with an insight here?

rixx added a commit to rixx/lptrace that referenced this issue Oct 20, 2016
@rakhmad
Copy link

rakhmad commented Oct 21, 2016

Running on Python 3.5.1 and found the same error message:
os.chmod(tmp.name, 0666)

@rixx
Copy link
Author

rixx commented Oct 21, 2016

@rakhmad, that issue is solved when you check out my branch over at https://github.com/rixx/lptrace/tree/python3.

@nimble0
Copy link

nimble0 commented Mar 30, 2017

@rixx You were really close to getting this working. You just only missing the escape characters around the "r" parameter, like so: cmd = 'exec(open(\\"{}\\", \\"r\\").read())'.format(name).

@seppo0010
Copy link

I created a version that runs on both python2 and python3 based on @nimble0's changes #15

@rixx rixx closed this as completed Mar 6, 2022
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

No branches or pull requests

4 participants