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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <fabiofz@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; 'read.': 0.03; 'interpreter': 0.05; 'widely': 0.05; 'debug': 0.07; 'debugging': 0.07; 'python3': 0.07; 'skip:" 60': 0.07; 'subject:Error': 0.07; 'string': 0.09; 'false,': 0.09; 'type,': 0.09; 'types:': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '00:00:00': 0.16; '24,': 0.16; 'apology': 0.16; 'cc:name:python list': 0.16; 'differs': 0.16; 'fabio': 0.16; 'googling': 0.16; 'hint?': 0.16; 'object).': 0.16; 'other,': 0.16; 'there...': 0.16; 'typeerror:': 0.16; 'url:py': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'module': 0.19; '&lt;': 0.19; 'seems': 0.21; 'feb': 0.22; '>>>': 0.22; 'import': 0.22; 'email addr:gmail.com&gt;': 0.22; 'shell': 0.22; 'cc:addr:python.org': 0.22; '&gt;&gt;&gt;': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'compare': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'topic': 0.29; 'url:code': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'code': 0.31; '"",': 0.31; 'file:': 0.31; 'skip:& 70': 0.31; 'file': 0.32; 'probably': 0.32; 'thanks!': 0.32; 'run': 0.32; 'linux': 0.33; 'url:python': 0.33; '(most': 0.33; 'url:source': 0.33; 'subject:the': 0.34; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'instances': 0.36; 'url:listinfo': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'two': 0.37; 'step': 0.37; 'skip:& 10': 0.38; 'recent': 0.39; 'skip:& 20': 0.39; 'sure': 0.39; 'url:mail': 0.40; 'forum': 0.61; 'skip:n 10': 0.64; 'url:p': 0.64; 'more': 0.64; 'different': 0.65; 'to:addr:gmail.com': 0.65; 'integrated': 0.69; "'appears'": 0.84; '2014,': 0.84; 'skip:/ 30': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=+HB7+0Jb5pBGPtuQqr892chNv5FpwYTfrsxQYIGm5J4=; b=Ystqy22CpCcQBjrbcrzrrf0OLybkF7hlfXVqhGUT0Ffih0TqRXhjkhnK+XdheGjgAC NpTj3gNXYVhbVn1smn0rGDgHSoB0I2YDFY/b4BYvCsdCfSd5zuKdzvXU9jdTM1sFvcy/ 1/G9a7hBYgmi3X199UiG8bVbb23C5MDVYaAREJhaYjD5V2ZHhA5chhUqU1vhw9yDHZD1 DFgmpzfv6IG5hPTsSd3ciCyGgUBtpEt1cJ9oahVjqyRopf+wMRX/zUyKAgyiqJ26mAN/ PrC5f3U9D3N26M0j+/71Sd1J+4WHrHEeJrq+sOgt49mDdz7x3l3+ToXYO9BYZ1XczbZA TL9w==
X-Received by 10.220.160.67 with SMTP id m3mr527347vcx.56.1403617632037; Tue, 24 Jun 2014 06:47:12 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <lobued$r48$1@speranza.aioe.org>
References <lobued$r48$1@speranza.aioe.org>
From Fabio Zadrozny <fabiofz@gmail.com>
Date Tue, 24 Jun 2014 10:46:51 -0300
Subject Re: Error in PyDev but not in the standard python interpreter
To Fabien <fabien.maussion@gmail.com>
Content-Type multipart/alternative; boundary=001a11c2a89e5bb25c04fc953276
Cc python list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.11220.1403619503.18130.python-list@python.org> (permalink)
Lines 173
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1403619503 news.xs4all.nl 2876 [2001:888:2000:d::a6]:44940
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:73549

Show key headers only | 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