Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > load module named "datetime" and change the directory of output file?

Reply
Thread Tools

load module named "datetime" and change the directory of output file?

 
 
ye juan
Guest
Posts: n/a
 
      02-01-2006
Hi, all

I have some questions to ask:

1. How can I add a standard module named "datetime" in
Jython when the error happens :"Traceback (innermost
last):
File "C:\python\test.py", line 3, in ?
ImportError: no module named datetime "
The line 3 is writen: "from datetime import datetime,
tzinfor"

2. I hope test.py outputs a file like test.txt, but I
want to change the directory of the result file named
test.txt. for example, the result is in
c:\python\test.txt, but I want to put it in
c:\python\result\test.txt. How can I change the
directory in java?

Thanks for your answer!

Sincerely,

Erica







__________________________________________________ _________
Żᣬ*ͼȴأٶȣϿע
http://cn.photos.yahoo.com
 
Reply With Quote
 
 
 
 
Lee Harr
Guest
Posts: n/a
 
      02-01-2006
> 1. How can I add a standard module named "datetime" in
> Jython when the error happens :"Traceback (innermost
> last):
> File "C:\python\test.py", line 3, in ?
> ImportError: no module named datetime "
> The line 3 is writen: "from datetime import datetime,
> tzinfor"
>


The datetime module was added with Python 2.3. I think
that Jython is still at the 2.1 or 2.2 level of Python.

I believe that the Jython team is pretty far along the
path to Python 2.4, but that is probably a question best
asked on one of their lists.



> 2. I hope test.py outputs a file like test.txt, but I
> want to change the directory of the result file named
> test.txt. for example, the result is in
> c:\python\test.txt, but I want to put it in
> c:\python\result\test.txt. How can I change the
> directory in java?
>



Sort of depends on how you are writing the output.
You could do something like ...

fh = open(r"c:\python\result\test.txt", "w")
fh.write("something")

right?

What does your code look like now? It is easier to
help you fix it than to start fresh....
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to install module, No module named scipy_distutils.core (but ihave scipy) process Python 1 10-17-2008 06:19 PM
System.IO.Directory.GetDirectories() and System.IO.Directory.GetFiles() are not returning the specified directory Nathan Sokalski ASP .Net 2 09-06-2007 03:58 PM
python,win32com,scipy and vb 6 : no module named scipy vml Python 3 05-03-2007 07:57 AM
Using JYTHON inside ANT : access os module -> "ImportError: no module named javaos" eric_bellard Python 1 10-07-2004 05:41 AM
[py2exe] py2exe and datetime -> No module named datetime F. GEIGER Python 0 08-16-2004 01:13 PM



Advertisments