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

Temp directory not found when running on Windows. #3

Open
rudivs opened this issue Sep 15, 2018 · 0 comments
Open

Temp directory not found when running on Windows. #3

rudivs opened this issue Sep 15, 2018 · 0 comments

Comments

@rudivs
Copy link

rudivs commented Sep 15, 2018

qgis2to3 failed with a FileNotFound exception when I tried to use it with my plugin. Looking at the code, it was because the path to the temp directory was hard-coded, and assumed a *nix OS. I fixed it for myself using import tempfile and f = open(f"{tempfile.gettempdir()}/missing", "a+") (patch file: 0001-fix-temp-directory-not-found-on-windows.zip).

Traceback (most recent call last):
File "qgis2to3", line 9, in
sys.exit(main('qgis_fixes'))
File "C:\OSGeo4W64\apps\Python36\lib\lib2to3\main.py", line 259, in main
options.processes)
File "C:\OSGeo4W64\apps\Python36\lib\lib2to3\refactor.py", line 703, in refactor
items, write, doctests_only)
File "C:\OSGeo4W64\apps\Python36\lib\lib2to3\refactor.py", line 296, in refactor
self.refactor_dir(dir_or_file, write, doctests_only)
File "C:\OSGeo4W64\apps\Python36\lib\lib2to3\refactor.py", line 316, in refactor_dir
self.refactor_file(fullname, write, doctests_only)
File "C:\OSGeo4W64\apps\Python36\lib\lib2to3\refactor.py", line 744, in refactor_file
*args, **kwargs)
File "C:\OSGeo4W64\apps\Python36\lib\lib2to3\refactor.py", line 351, in refactor_file
tree = self.refactor_string(input, filename)
File "C:\OSGeo4W64\apps\Python36\lib\lib2to3\refactor.py", line 383, in refactor_string
self.refactor_tree(tree, name)
File "C:\OSGeo4W64\apps\Python36\lib\lib2to3\refactor.py", line 457, in refactor_tree
new = fixer.transform(node, results)
File "C:\OSGeo4W64\apps\Python36\lib\site-packages\qgis2to3\codeporting\qgis_fixes\fix_pyqt.py", line 585, in transform
self.transform_member(node, results)
File "C:\OSGeo4W64\apps\Python36\lib\site-packages\qgis2to3\codeporting\qgis_fixes\fix_pyqt.py", line 519, in transform_member
f = open("/tmp/missing", "a+")
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/missing'

NathanW2 added a commit to NathanW2/qgis2to3 that referenced this issue Oct 2, 2018
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

1 participant