×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Library problems in converting date string to epoch time

Library problems in converting date string to epoch time

Library problems in converting date string to epoch time

(OP)
I'm a little new to Python and am stuck in a deeply awkward situation. I'm working at a client site where I have no control over what is installed on their server and no ability to do any sort of upgrade. They're running what appears to be a very stripped down version of Python 2.1, which is causing some library issues. All I need to do is take a date string and convert it to an epoch time, which most documentation says will require the time.strptime function. Unfortunately, the following piece of code:

        try:
            strptime = time.strptime
        except AttributeError:
            print "nope you don't have it"
            from strptime import c

Results in the following error:

    ImportError: No module named strptime

Is there another way around this? Is there any way I can get the library I need from another install and just call it locally? I'm really stuck here.

Thanks,
Alex

RE: Library problems in converting date string to epoch time


raindogs,

Did you import the time module? e.g.:

CODE

import time

RE: Library problems in converting date string to epoch time

its true you have to write Import time at the top of your code then i think the codes will work

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close