473,396 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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
Feb 1 '06 #1
1 3750
> 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....
Feb 1 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: sdhyok | last post by:
Here is my situation. To add more functionalities to a standard library(datetime) in python, I am implementing my own code called vp.datetime (directory structure, vp/datetime.py). To make it...
0
by: F. GEIGER | last post by:
py2exe and datetime -> No module named datetime I've begun to use the stdlib module datetime instead of my home brewn classes. Since then a py2exe app doesn't run anymore: Traceback (most...
5
by: cody | last post by:
Iam using Beta2 of VS2005 and getting the error "Error 4 'format-dateTime()' is an unknown XSLT function" at the following line: <xsl:value-of select="format-dateTime($pubDate,' : ')" /> ...
4
by: Saso Zagoranski | last post by:
Hi! I have created an SqlCommand object and I have set some parameters to it... One of the parameters is of the DateTime type; here is the code: sqlCommand.Parameters.Value =...
8
by: craigkenisston | last post by:
I have a generic function that receives a couple of datetime values to work with. They can or cannot have a value, therefore I wanted to use null. This function will call a database stored...
2
by: va | last post by:
Why does this property "DateTime?" compile? public DateTime? test { get { return DateTime.Now; } }
3
by: Sugandh Jain | last post by:
Hi, I am using property like this.. private DateTime? _propName; public DateTime? PropName { get { return _propName; }
1
by: Mike Rooney | last post by:
Hi everyone, this is my first post to this list. I am trying to create a subclass of datetime.date and pickle it, but I get errors on loading it back. I have created a VERY simple demo of this: ...
1
by: Colin J. Williams | last post by:
I wish to sub-class (if that's the right word) datetime and to use a different signature for the constructor. The second part has gone smoothly, but it is difficult to access the type's methods...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.