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

Lee Harr lee at example.com
Wed Feb 1 16:48:36 EST 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....



More information about the Python-list mailing list