Error in PyDev but not in the standard python interpreter

Fabien fabien.maussion at gmail.com
Tue Jun 24 09:28:47 EDT 2014


Hi,

this is probably not the best place for this topic but I know this forum 
is widely read. I take this opportunity and apology at the same time.

If I run this in my python3 interpreter everything works fine:

mowglie at flappi ~ $ python3
Python 3.3.2+ (default, Feb 28 2014, 00:52:16)
[GCC 4.8.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
 >>> from netCDF4 import num2date
 >>> from datetime import datetime
 >>> d1 = num2date(0, 'days since 1000-01-01', 'standard')
 >>> d2 = datetime(2000, 1, 1)
 >>> print(d1 < d2)
True

But if I run the code in PyDev I get:
     print(d1 < d2)
TypeError: unorderable types: datetime() < datetime.datetime()

When debugging in pyDev, everything looks fine:
 >>> sys.version
Out[28]: '3.3.2+ (default, Feb 28 2014, 00:52:16) \n[GCC 4.8.1]'
 >>> ?d1
Type:       datetime
String Form:1000-01-01 00:00:00
File:       /usr/local/lib/python3.3/dist-packages/netcdftime.py
Docstring:
[...]
 >>> ?d2
Type:       datetime
String Form:2000-01-01 00:00:00
File:       /usr/lib/python3.3/datetime.py
Docstring:
[...]
 >>> d1 < d2
Traceback (most recent call last):
   File 
"/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 
2732, in run_code
     exec(code_obj, self.user_global_ns, self.user_ns)
   File "<ipython-input-29-415dec1be9aa>", line 1, in <module>
     d1 < d2
TypeError: unorderable types: datetime() < datetime.datetime()


So they are two instances of the same object but something in pyDev 
doesn't want to compare them. Any Hint?

Thanks!

Fabien






More information about the Python-list mailing list