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
Update dumpstyle.py #824
Update dumpstyle.py #824
Conversation
Added from __future__ import absolute_import, and adjusted import statement for Py2-3 compatibility. Corrected directory location in __main__ routine to be relative to rst2pdf package (os.path.listdir('styles') wouldn't work if we weren't running from the right directory).
Cannot be tested on Windows with autotest, because that only runs on Linux. To test:
This must run with no errors. Previous errors I got before I fixed the listdir() were
|
*basestring* doesn't exist in Py3. Use *str* instead. Check for presence of basestring to detect py2.7 vs py3+. Similar import changes needed for pygments2style in order for dumpstyle to run.
Sorry to have to amend this pull request. This is my first time pushing from a cloned repo, and I'm still getting used to Guthub Desktop. |
Can you explain how to test this? i.e. what should I type to see a failure before this change is applied and then after applying, I will see it working? |
Rob, for my test procedure please see my comment at #826. For the dumpstyle module in the Master branch, I got these tracebacks:
and for Python 2.7:
So for Python3.8, the import of rson failed, and for Python 2.7, the module couldn't find the styles directory. I had to fix both problems to make the module run for both Python versions. I hate to ask for two unrelated changes in one pull request (the import statement, and locating the styles directory), but they are both needed to run successfully. |
Added from future import absolute_import, and adjusted import statement for Py2-3 compatibility.
Corrected directory location in main routine to be relative to rst2pdf package (os.path.listdir('styles') wouldn't work if we weren't running from the right directory).