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

Fix the bug of reloader with windows path #1627

Merged
merged 2 commits into from Aug 31, 2019
Merged

Fix the bug of reloader with windows path #1627

merged 2 commits into from Aug 31, 2019

Conversation

frostming
Copy link

@frostming frostming commented Aug 16, 2019

Fix #1614

The root cause is that when running as flask run the value of __main__.__package__ is "". Modify the condition a little to make it fix the first branch.

Tested python app.py, flask run, python -m flask run on both Windows and WSL Ubuntu. All work fine. I have not got a PyDev running for testing, and it would be great if someone can help, but I think it should work with little risk.

@pallets pallets deleted a comment from nchauhan5 Aug 22, 2019
@davidism
Copy link
Member

davidism commented Aug 31, 2019

Unfortunately, this kind of does the wrong thing the other direction. If you do python -m example to run a local module example.py, __package__ is the empty string, but it should be going into the else block since it's run as a module. It still works, but for the wrong reason.

According to sources I found when originally working on the reloader, __main__.__package__ is None indicates that we are running as a module, the empty string has a different meaning. https://stackoverflow.com/q/21233229/400617

@davidism davidism changed the base branch from master to 0.15.x August 31, 2019 19:50
@davidism
Copy link
Member

Thanks for getting this started! I changed the check to be very specific to "looks like a misbehaving Windows entry point" so that it wouldn't interfere with other use cases.

@davidism davidism added this to the 0.15.6 milestone Aug 31, 2019
@davidism davidism merged commit ab1b556 into pallets:0.15.x Aug 31, 2019
@frostming frostming deleted the bugfix/1614 branch September 1, 2019 01:07
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants