473,387 Members | 1,549 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,387 software developers and data experts.

import datetime

Hi Guys,

I have just installed Python2.4.2 on our HP-UX system. But when I try
to import datetime modlue I get the following error

~~~~~~~~~~~~~~~~~~~~~~~~~~~
from datetime import datetime

Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named datetime
~~~~~~~~~~~~~~~~~~~~~~~~~~

Am I missing any path? because I tried to import 'textwrap module and
that import worked fine.

Any help will be appreciated.

Jan 31 '06 #1
4 6209
> I have just installed Python2.4.2 on our HP-UX system. But when I try
to import datetime modlue I get the following error

~~~~~~~~~~~~~~~~~~~~~~~~~~~
from datetime import datetime Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named datetime
~~~~~~~~~~~~~~~~~~~~~~~~~~

Am I missing any path? because I tried to import 'textwrap module and
that import worked fine.

You may have more than one version of Python. What does it
say when you first start it from a command line? Mine says:

$ python
Python 2.3.5 (#2, Sep 4 2005, 22:01:42)
[GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

If it is not python 2.4 like you expected, you could try
running it as python2.4 and see if the modules are there.

If it is already 2.4, try this:

import sys
sys.path

and see which paths are being searched. Look around in
there and see if the datetime module is where it is
supposed to be.

Beyond that, you should probably ask on an HP-UX list.
Feb 1 '06 #2
It does say Python 2.4.2
~~~~~~~~~~~~~~~~~~~~~~~~
Python 2.4.2 (#2, Jan 30 2006, 20:02:09) [C] on hp-ux11
Type "help", "copyright", "credits" or "license" for more information.

~~~~~~~~~~~~~~~~~~~~~~~~

I did look at the sys.path but the issue is that I dont see a module
name datetime anywhere. Only datetime thing that is there is in include
directory and it is datetime.h, which I think is for C interface. I
have a python installed on my Windows desktop and it is working fine
there. Where is the datetime module stored? Does any body know?

Feb 1 '06 #3
"shaboo" wrote:
It does say Python 2.4.2
~~~~~~~~~~~~~~~~~~~~~~~~
Python 2.4.2 (#2, Jan 30 2006, 20:02:09) [C] on hp-ux11
Type "help", "copyright", "credits" or "license" for more information.
~~~~~~~~~~~~~~~~~~~~~~~~

I did look at the sys.path but the issue is that I dont see a module
name datetime anywhere. Only datetime thing that is there is in include
directory and it is datetime.h, which I think is for C interface. I
have a python installed on my Windows desktop and it is working fine
there. Where is the datetime module stored? Does any body know?


on windows, it's linked to the interpreter.
import datetime
datetime <module 'datetime' (built-in)>
import sys
"datetime" in sys.builtin_module_names True

on other platforms, it may be linked to the interpreter or placed in
a shared library:
import datetime
datetime

<module 'datetime' from '/usr/local/lib/python2.4/lib-dynload/datetime.so'>

</F>

Feb 1 '06 #4
>> I did look at the sys.path but the issue is that I dont see a module
name datetime anywhere. Only datetime thing that is there is in include
directory and it is datetime.h, which I think is for C interface. I
have a python installed on my Windows desktop and it is working fine
there. Where is the datetime module stored? Does any body know?


on windows, it's linked to the interpreter.
import datetime
datetime<module 'datetime' (built-in)>
import sys
"datetime" in sys.builtin_module_names True

on other platforms, it may be linked to the interpreter or placed in
a shared library:
import datetime
datetime

<module 'datetime' from '/usr/local/lib/python2.4/lib-dynload/datetime.so'>

So maybe there is just a problem with the way Python was
built. Is that from an "official" HP-UX package? You could
ask on an HP-UX list.

Alternatively, you could try compiling Python yourself.
Feb 1 '06 #5

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...
2
by: DilbertFan | last post by:
Hi, I really thought that I had this importing business down. I recently downloaded and installed mx module for the DateTime class. In IDLE, I go: import mx mx.DateTime.DateTime(2004)
2
by: bncarper | last post by:
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) on linux2 Type "help", "copyright", "credits" or "license" for more...
4
by: Max M | last post by:
# -*- coding: latin-1 -*- """ I am currently using the datetime package, but I find that the design is oddly asymmetric. I would like to know why. Or perhaps I have misunderstood how it...
1
by: Adam Monsen | last post by:
Say I have the following datetime object: >>> from datetime import datetime >>> d = datetime(2005, 8, 10, 15, 43) I happen to know this is a local time from the Netherlands, so I assume the...
1
by: James | last post by:
I need to import a bunch of data into our database for which there's a single entry each day which occurs at the same time every day in local time - so I need to convert this to UTC taking into...
2
by: skip | last post by:
Running from Subversion, I see confusing (to me) behavior related to division of datetime.timedelta objects by integers: % python Python 2.6a0 (trunk:57277:57280M, Aug 28 2007, 17:44:49) on...
0
by: PhongPham | last post by:
I used environment on Fedora core 6 and tried with python 2.5.2 package on board chip mips and platform 2.6 is ok (although when "make" still have error: "/bin/sh: line 2: ./python: cannot...
1
by: Christian Heimes | last post by:
Rick King schrieb: datetime.date is a C extension class. Subclassing of extension classes may not always work as you'd expect it. Christian
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.