Skip to content

importing dash causes running of any test.py in same folder as app.py #1339

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

Closed
fohrloop opened this issue Jul 19, 2020 · 2 comments
Closed

Comments

@fohrloop
Copy link

I bumped up to a little bit unexpected behaviour: If you import dash, any file called test.py in the same folder will be imported, causing sometimes unexpected behaviour.

MWE

  • Create empty folder with app.py and test.py
# test.py
print('In test.py')
# app.py
print('1 in app.py')
import dash
print('2 in app.py')

Output

PS C:\tmp\test_dash> python .\app.py
1 in app.py
In test.py
2 in app.py

What would be expected?

One could expect that import dash would not run any files called test.py.

Versions

dash                         1.13.4    
dash-core-components         1.10.1
dash-html-components         1.0.3
dash-renderer                1.5.1
@elfjes
Copy link

elfjes commented Jul 20, 2020

This is an issue with the future package that's used for py2/py3 compatibility, not with dash, you may want to pick it up with them. It tries to load a number of modules when importing future.moves defined here:

Question is, with py2 no longer being maintained, does dash still need to use this package, eg here?

@alexcjohnson
Copy link
Collaborator

Duplicate of #1143
I'm afraid we're not quite ready to drop py2 support yet, but #1143 points to some ways we can at least make things work better, though we probably can't prevent future from importing test and org.

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

No branches or pull requests

3 participants