Quantcast

ImportError: No module named datetime

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

ImportError: No module named datetime

Lee Hughes-2
Sorry for the noob question. Testing Jython 2.5.2 on OpenJDK 1.7 with PostgreSQL 9.1.2 and PostgreSQL JDBC4 driver, getting ImportError when I select a recordset containing a timestamp field. I did search the archives from the last year and googled but the only matches I found indicate this was fixed long ago.

>>> from com.ziclix.python.sql import zxJDBC                                              
>>> d, u, p, v = "jdbc:postgresql:mydatabase",'myuser', 'mypassword', "org.postgresql.Driver"
>>> db = zxJDBC.connect(d, u, p, v)                                                       
>>> c = db.cursor()                                                                       
>>> c.execute('select mytimestamp from mytable')                                                      
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named datetime
>>> 

Thanks much for any help or ideas.
--
Lee



------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2

_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ImportError: No module named datetime

Chris Clark
On Monday 2012-04-09 14:51 (-0700), Lee Hughes <[hidden email]> wrote:

> Sorry for the noob question. Testing Jython 2.5.2 on OpenJDK 1.7 with
> PostgreSQL 9.1.2 and PostgreSQL JDBC4 driver, getting ImportError when
> I select a recordset containing a timestamp field. I did search the
> archives from the last year and googled but the only matches I found
> indicate this was fixed long ago.
>
> >>> from com.ziclix.python.sql import zxJDBC
> >>> d, u, p, v = "jdbc:postgresql:mydatabase",'myuser', 'mypassword',
> "org.postgresql.Driver"
> >>> db = zxJDBC.connect(d, u, p, v)
> >>> c = db.cursor()
> >>> c.execute('select mytimestamp from mytable')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: No module named datetime
> >>>
>
> Thanks much for any help or ideas.
>

Quick check list:

 1. Are you sure it is 2.5 and not 2.2?
 2. What happens if you import datetime manually/explicitly? Either
    standalone or before the jdbc import.
 3. Have you tried testing the 2.5.3 RC?
 4. Have  you tried http://code.google.com/p/jyjdbc/ instead of zxJDBC?
 5. This is an odd suggestion I'll admit; have you tried the Sun/Oracle
    JDK? It shouldn't make any difference but if you have one floating
    around to test with it is worth trying.


Chris


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ImportError: No module named datetime

Lee Hughes-2
Quick check list:

1. Are you sure it is 2.5 and not 2.2? 

# jython
Jython 2.5.2 (Release_2_5_2:7206, Mar 2 2011, 23:12:06) 
[OpenJDK 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_23
Type "help", "copyright", "credits" or "license" for more information.
>>> 
 
2. What happens if you import datetime manually/explicitly? Either
  standalone or before the jdbc import.

Hmm now it works fine, I'm guessing because I reinstalled Jython with the Standard option instead of the Core option in order to pick up the distutils that jyjdbc setup required.
 

4. Have  you tried http://code.google.com/p/jyjdbc/ instead of zxJDBC?

Wow, nice package, works perfectly. I'll be testing it with Postgres/MySQL/Oracle/SQL Server/DB2 and hopefully Netezza. Thanks very much for your help!

-- 
Lee



------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Loading...