Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73549

Re: Error in PyDev but not in the standard python interpreter

References <lobued$r48$1@speranza.aioe.org>
From Fabio Zadrozny <fabiofz@gmail.com>
Date 2014-06-24 10:46 -0300
Subject Re: Error in PyDev but not in the standard python interpreter
Newsgroups comp.lang.python
Message-ID <mailman.11220.1403619503.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Well, it 'appears' to be the same type, but given that the File from one is
different from the other, I think they aren't...

Googling a bit, I found the source:
https://code.google.com/p/netcdf4-python/source/browse/trunk/netcdftime.py?r=1117
and it has a 'datetime' which says: "Phony datetime object which mimics the
python datetime object", now, I'm not sure why it works in the Python shell
but not in the IPython shell integrated in PyDev... You may want to create
a module and do a debug run to step into the 'num2date' call to see what
differs there... (i.e.: I think that if you do isinstance(d1, datetime)
it'll return false, as it seems to be a netcdftime.datetime object).

Best Regards,

Fabio


On Tue, Jun 24, 2014 at 10:28 AM, Fabien <fabien.maussion@gmail.com> wrote:

> 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@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
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Error in PyDev but not in the standard python interpreter Fabien <fabien.maussion@gmail.com> - 2014-06-24 15:28 +0200
  Re: Error in PyDev but not in the standard python interpreter Chris Angelico <rosuav@gmail.com> - 2014-06-24 23:47 +1000
    Re: Error in PyDev but not in the standard python interpreter Fabien <fabien.maussion@gmail.com> - 2014-06-24 15:59 +0200
      Re: Error in PyDev but not in the standard python interpreter Chris Angelico <rosuav@gmail.com> - 2014-06-25 00:04 +1000
        Re: Error in PyDev but not in the standard python interpreter Fabien <fabien.maussion@gmail.com> - 2014-06-24 16:27 +0200
          Re: Error in PyDev but not in the standard python interpreter Chris Angelico <rosuav@gmail.com> - 2014-06-25 00:35 +1000
            Re: Error in PyDev but not in the standard python interpreter Fabien <fabien.maussion@gmail.com> - 2014-06-24 17:40 +0200
              Re: Error in PyDev but not in the standard python interpreter Chris Angelico <rosuav@gmail.com> - 2014-06-25 01:58 +1000
              Re: Error in PyDev but not in the standard python interpreter Ethan Furman <ethan@stoneleaf.us> - 2014-06-24 09:02 -0700
      Re: Error in PyDev but not in the standard python interpreter Ethan Furman <ethan@stoneleaf.us> - 2014-06-24 08:08 -0700
  Re: Error in PyDev but not in the standard python interpreter Fabio Zadrozny <fabiofz@gmail.com> - 2014-06-24 10:46 -0300
  Re: Error in PyDev but not in the standard python interpreter Tony the Tiger <tony@tiger.invalid> - 2014-06-28 20:39 +0000

csiph-web