[Zope] How can I import DateTime into a script??

Robert Rottermann robert@redcor.ch
Sat, 11 Aug 2001 12:20:52 +0200


This is a multi-part message in MIME format.

------=_NextPart_000_0394_01C12260.0FDE3470
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi there,
I am trying to create an Id based on the time of its creation.
since I can not use the Pythons thime module I would like to use a =
DateTime class.

However I stumbled trying to do so.

the following code:
import DateTime
t =3D DateTime.Time()

produces an error
Error Type: AttributeError
Error Value: Time

whereas:
from DateTime import Time
t =3D DateTime.Time()

produces
Error Type: ImportError
Error Value: import of "Time" from "DateTime" is unauthorized

can anybody tell me how to do it correctly?
thanks
Robert

------=_NextPart_000_0394_01C12260.0FDE3470
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2920.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi there,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I am trying to create an Id based on =
the time of=20
its creation.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>since I can not use the Pythons thime =
module I=20
would like to use a DateTime class.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>However I stumbled trying to do =
so.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>the following code:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>import DateTime</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>t =3D DateTime.Time()</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>produces an error</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>Error Type:=20
AttributeError</STRONG><BR><STRONG>Error Value: =
Time</STRONG><BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>whereas:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>from DateTime import Time<BR>t&nbsp;=3D =

DateTime.Time()<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>produces</DIV></FONT>
<DIV><FONT face=3DArial size=3D2><STRONG>Error Type:=20
ImportError</STRONG><BR><STRONG>Error Value: import of "Time" from =
"DateTime" is=20
unauthorized</STRONG><BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>can anybody tell me how to do it=20
correctly?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Robert</DIV></FONT></BODY></HTML>

------=_NextPart_000_0394_01C12260.0FDE3470--