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

Holding of the __init__.py during 'make_package' cause failure on exit (Windows + IronPython) #17

Closed
wenoptics opened this issue Aug 13, 2020 · 0 comments · Fixed by #18

Comments

@wenoptics
Copy link

The creation of the 'init.py' not close the file in time. This cause failure on deleting the temp folder on exit:
prelude.py#L27

Traceback (most recent call last):
  File "D:/project/example.py", line 65, in <module>
  File "C:\Program Files\IronPython 2.7\Lib\contextlib.py", line 35, in __exit__
  File "D:/project/example.py", line 14, in __stickytape_temporary_dir
  File "C:\Program Files\IronPython 2.7\Lib\shutil.py", line 261, in rmtree
  File "C:\Program Files\IronPython 2.7\Lib\shutil.py", line 266, in rmtree
  File "C:\Program Files\IronPython 2.7\Lib\shutil.py", line 240, in onerror
  File "C:\Program Files\IronPython 2.7\Lib\shutil.py", line 264, in rmtree
WindowsError: [Errno 13] The process cannot access the file because it is being used by another process

The following changes (prelude.py) work for me:

                ...
                if not os.path.exists(partial_path):
                    os.mkdir(partial_path)
                    # open(os.path.join(partial_path, "__init__.py"), "w").write("\n")
                    with open(os.path.join(partial_path, "__init__.py"), "w") as f:
                        f.write("\n")
wenoptics pushed a commit to wenoptics/stickytape that referenced this issue Aug 13, 2020
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 a pull request may close this issue.

1 participant