Relatively new to python. I can get the following to work from the
command line:
Python 2.3.4 (#2, Aug 18 2004, 21:49:15)
[GCC 3.2] on linux2
Type "help", "copyright" , "credits" or "license" for more information. import datetime d = datetime.dateti me.today() d
datetime.dateti me(2004, 12, 10, 6, 13, 28, 154472)
But when I try to run the following small program I get the following
results:
import datetime
d = datetime.dateti me.today()
print d
Traceback (most recent call last):
File "datetime.p y", line 1, in ?
import datetime
File "/home/bob/pyshow/datetime.py", line 3, in ?
d = datetime.dateti me.today()
AttributeError: 'module' object has no attribute 'today'
Do I need to change a path?
Running python 2.3.4 on linux redhat 7.3.
Bob 2 3979
On Fri, Dec 10, 2004 at 04:19:56AM -0800, bn******@cs.com wrote: Relatively new to python. I can get the following to work from the command line: Python 2.3.4 (#2, Aug 18 2004, 21:49:15) [GCC 3.2] on linux2 Type "help", "copyright" , "credits" or "license" for more information. import datetime d = datetime.dateti me.today() d datetime.dateti me(2004, 12, 10, 6, 13, 28, 154472) But when I try to run the following small program I get the following results: import datetime d = datetime.dateti me.today() print d Traceback (most recent call last): File "datetime.p y", line 1, in ? import datetime File "/home/bob/pyshow/datetime.py", line 3, in ?
^^^^^^^^^^^
d = datetime.dateti me.today() AttributeError: 'module' object has no attribute 'today' Do I need to change a path? Running python 2.3.4 on linux redhat 7.3.
Change your script's name from datetime.py to something else. Otherwise the
script will import itself, and not the datetime module from the standard
library.
-- Gerhard
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBuZXddIO 4ozGCH14RApIoAJ 9viDHd8FYHAYv+c d0rvdeaQjL/RACfVZm6
3t42eLZdhQ3jVlU wPtjjEHM=
=0c2v
-----END PGP SIGNATURE-----
Thanks. That did it. And I know better than to use the module name.
Bob This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Keith |
last post by:
I am having a problem creating a many-to-many-to-many type relationship. It
works fine, but when I create a view to query it and test it, it does not
generate the results I expected.
Below if the DDL for the tables and the SQL for the view.
|
by: AnkitAsDeveloper [Ankit] |
last post by:
Hi i am serializing a 'ref struct' object as follows :
private: void Seri( String ^path, Object^ obj )
{
FileStream^ fileStrm ;
try
{
//Serialize entire object into Binary stream
|
by: I am Sam |
last post by:
I have created this DateTime object and instanced it I think correctly
DateTime myClubNow1=new
DateTime(DateTime.Now.Year,DateTime.Now.Month,DateTime.Now.Day,DateTime.Now.Hour,DateTime.Now.Minute,DateTime.Now.Second);
I keep getting the below error:
Object reference not set to an instance of an object.
I don't know what the problem could be. Can someone help me with this? It
|
by: Cesar Ronchese |
last post by:
Hi,
I built the sample code showing the problem with dates when viewed at
different machines, different Time Zones and transported via Remoting.
The zip can be downloaded here:
www.carsoftnet.com.br/temp/sample_error_date.zip
|
by: Jason Huang |
last post by:
Hi,
In our C# Windows Form application, we are using the SQL Server 2000 as the
database server.
The Database table MyTable has a field RegistrationDate which represents the
Date a client comes to our company to deliver his product. We have some
Working days for processing his product, like 20, 30, 40 days.
My question is how do I handle the working days problem, e.g., a client
comes at the Days February 15 where we have 40 Working...
| |
by: Mike Collins |
last post by:
I cannot get the correct drop down list value from a drop down I have on my
web form. I get the initial value that was loaded in the list.
It was asked by someone else what the autopostback was set to...it is set to
false.
Can someone show me what I am doing wrong and tell me the correct way? Thank
you.
In the page load event, I am doing the following:
|
by: pranesh.nayak |
last post by:
I'm facing an error:"String was not recognized as a valid DateTime"
whille accessing DateTime from webservice.
And when I try to set DateTime to the same webservice it fails with
error:"Date value is of wrong type"
it looks like xs:DateTime is not compatible with .Net DateType. Any
suggestions on how to fix this without touching the webservice (3rd
party webservice)?
|
by: JFieseler |
last post by:
Hi all,
in a huge project i have the following problem.
I create an object which contains many private members (i know that this is
not correct, but it is a single use migration program). The members will be
filled from database tables. In the fill method i see in debug mode the
correct values. At the source where i create the object the DateTime members
of the object are not present (error: cannot obtain value). An statement like
this...
|
by: iulian.ilea |
last post by:
Is correct to have a varchar field and insert dates of type dd/mm/yyyy
into it? I choose this method because I have an application that runs
on more than one server. So, if I used a datetime field (MSSQL Server)
it worked on my test machine. If I run the same application on another
machine with different regional settings is not working. I tried with
date_default_timezone_set to change timezone but is not changing. After...
|
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= |
last post by:
Hi
I am having a problem formatting a string when the time is in format
hh.mm.ss - used in Europe
Parse seems ok when the date uses "/" or "." as seperator
but I get an exception when time uses "." as seperator as used in Europe
I have US regional setting and I have tried switching my regional setting to
Europe
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |