hello, I wanted to use the datetime python libraries but while doing this simple program: from datetime import datetime now=datetime.now() print now I run it from console and I get this: Traceback (most recent call last): File "test.py", line 1, in <module> from datetime import datetime File "/home/udooer/datetime.py", line 2, in <module> now=datetime.now() NameError: name 'datetime' is not defined any help?
Does it work when you start a terminal window and do: python (Python starts in the terminal) >>>from datetime import datetime >>>now=datetime.now() >>> print now On my Neo it works. How did you create the test.py file? If you created it on Windows it be bad. Try creating the file from Linux with leafpad. I use Geany (preinstalled) fo r Editting Python files.
I created the file on leafpad originally but now I'll start using Geany, thanks for that tip! Used the commands you said and got this:
It looks like you have a datetime.py file in your home folder. Please rename or delete that and try again. Python loads from the first library file that is available.