Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Python Datetime Timezone Issue #13

Closed
sibblegp opened this issue Jul 22, 2016 · 7 comments
Closed

Python Datetime Timezone Issue #13

sibblegp opened this issue Jul 22, 2016 · 7 comments

Comments

@sibblegp
Copy link

python app.py
Traceback (most recent call last):
File "app.py", line 5, in
import api
File "/apps/tinder-detective/api.py", line 7, in
from datetime import timezone
ImportError: cannot import name timezone

I don't think Python 2.7 has timezone but 3.X won't run Flask. What am I missing here?

@sibblegp
Copy link
Author

When I try to run under 3.X:

Traceback (most recent call last):
File "app.py", line 7, in
app = Flask('tinder-detective')
File "/apps/tinder-detective/env_tinder_detective/lib/python3.4/site-packages/flask/app.py", line 346, in init
root_path=root_path)
File "/apps/tinder-detective/env_tinder_detective/lib/python3.4/site-packages/flask/helpers.py", line 807, in init
root_path = get_root_path(self.import_name)
File "/apps/tinder-detective/env_tinder_detective/lib/python3.4/site-packages/flask/helpers.py", line 657, in get_root_path
loader = pkgutil.get_loader(import_name)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/pkgutil.py", line 469, in get_loader
return find_loader(fullname)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/pkgutil.py", line 490, in find_loader
return spec.loader
AttributeError: 'NoneType' object has no attribute 'loader'

@matarrese
Copy link

Having some error: Mac OSX

@raed667
Copy link

raed667 commented Jul 22, 2016

Same error Windows 8.1

@Beertie
Copy link

Beertie commented Jul 22, 2016

Set
from datetime import timezone
TO
from datetime import datetime

@rafael-azevedo
Copy link

on OSX run pip3 install datetime

@gregorylivschitz
Copy link

Concerning the NoneType loader issue. This is happening because you are running python3.40, there seems to be a bug with that version and flask. I ran into this problem.

If you change the python version to 3.43+ it should work.
Here is the github thread for reference:
pallets/flask#1011

@sibblegp
Copy link
Author

Set
from datetime import timezone
TO
from datetime import datetime

This worked. Thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants