-
Notifications
You must be signed in to change notification settings - Fork 94
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
gf logic temporary file permission issue on windows #340
Comments
I ran into this issue too. As per Python documentation for NamedTemporaryFile (https://docs.python.org/3/library/tempfile.html#tempfile.NamedTemporaryFile):
Not sure if there is a benefit to using NamedTemporaryFile this way, but I've modified the code as such:
Then instead of doing a bin_file.flush(), I've modified it as such:
Finally cleanup after emitting the sigrok file by adding:
|
There seems to be a problem with the temporary file created with tempfile.NamedTemporaryFile in greatfet_logic.py as during the zip processing there will be a permission error like below
File "c:\users\mozor\appdata\local\programs\python\python38\lib\zipfile.py", line 1775, in write
with open(filename, "rb") as src, self.open(zinfo, 'w') as dest:
PermissionError: [Errno 13] Permission denied: 'D:\Work\tmpuxen_7_e'
The command prompt used is ran as administrator, there is no read only or write permissions issues on the Work folder. There are many users on the web that have issues with the handling of temporary file through that library with different proposed solutions.
A quick patch that worked for me was to replace the temporary file creation with
#bin_file = tempfile.NamedTemporaryFile(mode='w+b', suffix=".zip", dir=holding_dir)
bin_file = open(holding_dir + "\temp.zip", 'w+b')
of course the file is not temporary anymore but manually creating the file like this won't issue any permission errors.
The text was updated successfully, but these errors were encountered: