ros-infrastructure / catkin_pkg

Standalone Python library for the catkin build system.
https://github.com/ros/catkin
Other
47 stars 91 forks source link

Fix permission denied issue on Windows #231

Closed seanyen closed 6 years ago

seanyen commented 6 years ago

The file created (and opened) by NamedTemporaryFile will be used in update_changelog_sections later and the second-time open() on the temp file will result in a permission denied on Windows because of Python implementation. The issue has been discussed here: https://bugs.python.org/issue14243

And one workaround talked about in the discussion is to pass "delete=False".

Here is the error messages for the test failure:

====================================================================== ERROR: test_update_changelog_unicode (test.test_package_version.PackageVersionTest) Test that updating the changelog does not throw an exception on unicode characters.

Traceback (most recent call last): File "c:\workspace\catkin_pkg\test\test_package_version.py", line 87, in test_update_changelog_unicode update_changelog_sections(missing_changelogs_but_forthcoming, '1.0.0') File "c:\workspace\catkin_pkg\src\catkin_pkg\package_version.py", line 160, in update_changelog_sections with open(changelog_path, 'wb') as f: IOError: [Errno 13] Permission denied: 'c:\users\admin\appdata\local\temp\tmpvchrip'

dirk-thomas commented 6 years ago

Please also run the unit tests locally and address the linter warnings so that CI passes.

dirk-thomas commented 6 years ago

Thank you for the patch and for iterating on it.