-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Fix] Fix the permission denied error on windows. #1077
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1077 +/- ##
==========================================
+ Coverage 65.72% 67.64% +1.92%
==========================================
Files 157 159 +2
Lines 10092 10281 +189
Branches 1828 1856 +28
==========================================
+ Hits 6633 6955 +322
+ Misses 3113 2961 -152
- Partials 346 365 +19
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
As a suggestion, a cleaner way is : with tempfile.NamedTemporaryFile('w', delete=False, suffix=file_format) as temp_file:
temp_file.write(cfg_str)
cfg = Config.fromfile(temp_file.name)
# see PR #1077 for more detail
os.unlink(temp_file.name) This should work for both windows and linux. So as a potentially more stable solution, just create the file on disk, run |
Thanks for the suggestion. I add [#4966(mmdet)] to comment and modify code as your suggest. |
use os.unlink instead of unlink
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
A comment may be left to note windows compatibility. |
Hi @fjfzlzj !First of all, we want to express our gratitude for your significant PR in this project. Your contribution is highly appreciated, and we are grateful for your efforts in helping improve this open-source project during your personal time. We believe that many developers will benefit from your PR. We would also like to invite you to join our Special Interest Group (SIG) private channel on Discord, where you can share your experiences, ideas, and build connections with like-minded peers. To join the SIG channel, simply message moderator— OpenMMLab on Discord or briefly share your open-source contributions in the #introductions channel and we will assist you. Look forward to seeing you there! Join us :https://discord.gg/UjgXkPWNqA If you have WeChat account,welcome to join our community on WeChat. You can add our assistant :openmmlabwx. Please add "mmsig + Github ID" as a remark when adding friends:) |
Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.
Motivation
To fix the permission denied error when using '--resuming-from' on Windows. [#1063] [#4966(mmdet)]
I'm not sure whether that modification will cause any problems on other platforms or not, so I add an 'if' to ensure Windows only.
Modification
Modify the behavior of loading config on Windows:
os.unlink
.Checklist