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

correct import to use asdatetime #882

Merged
merged 1 commit into from
May 24, 2017
Merged

correct import to use asdatetime #882

merged 1 commit into from
May 24, 2017

Conversation

tkimnguyen
Copy link
Sponsor Member

Fixes the import statement needed to run the code snippet

@svx svx merged commit 0ca697a into 5.1 May 24, 2017
@svx svx deleted the tkimnguyen-patch-1 branch May 24, 2017 11:40
@svx
Copy link
Member

svx commented May 24, 2017

Thanks !

@ale-rt
Copy link
Member

ale-rt commented May 24, 2017

This has to be reverted because DataTime module has no asdatetime:

>>> from DateTime import asdatetime
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ImportError: cannot import name asdatetime

@ale-rt
Copy link
Member

ale-rt commented May 24, 2017

Sorry @svx, I should have asked @tkimnguyen to close this before :p

@svx
Copy link
Member

svx commented May 24, 2017

done by #883 Thanks !

@tkimnguyen
Copy link
Sponsor Member Author

Argh, sorry about that. I had run into a problem using asdatetime in some of my own code. I must have gotten confused as to what I ended up doing to get it to work. It might have had something to do with how I tried the sample code... using a normal Python interpreter I get errors, but if I invoke the sample code as a script run like bin/instance run test.py then it works ok. Maybe that is something worth clarifying on this page?

bash-3.2$ bin/python test.py
Traceback (most recent call last):
  File "test.py", line 6, in <module>
    from DateTime import DateTime
ImportError: No module named DateTime
bash-3.2$ 

@ale-rt
Copy link
Member

ale-rt commented May 24, 2017

I think this has something to to with the DateTime module not being in your path.

Probably running:

bash-3.2$ bin/zopepy test.py

will give you different results.

Anyway I think it will fail neverthless, because bin/instance run is going to set up the zope app global and some other stuff.

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

Successfully merging this pull request may close these issues.

3 participants