×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    5

    time.strptime function missing?

    I tried to use the function strptime from module time with Python for &0 v. 1.4.1 and 1.4.2, but the following error message 2s displayed:

    Code:
    AttributeError: 'module' object has no attribute 'strptime'
    I checked that syntax is correct. Other functions of "time" module work as expected.

    Is it a bug or that function is unimplemented? Where can I find a list of implemented/unimplemented functions in S60 for each standard Python module?

    Thanks a lot

  2. #2
    Regular Contributor
    Join Date
    Jan 2004
    Location
    Helsinki
    Posts
    376

    Re: time.strptime function missing?

    Two possible reasons

    1) Python 2.2 doesn't have function and it was added in the later Python versions

    2) PyS60 is missing datetime API parts which were implemented using native C
    Mikko Ohtamaa

    http://mfabrik.com
    http://blog.mfabrik.com

  3. #3
    Regular Contributor
    Join Date
    Jan 2004
    Location
    Helsinki
    Posts
    376

    Re: time.strptime function missing?

    Quote Originally Posted by florianosc View Post
    Where can I find a list of implemented/unimplemented functions in S60 for each standard Python module?
    Download the source code
    Mikko Ohtamaa

    http://mfabrik.com
    http://blog.mfabrik.com

  4. #4
    Registered User
    Join Date
    Jul 2007
    Posts
    5

    Re: time.strptime function missing?

    Thanks for your reply. I checked what you have suggested.

    strptime is included in Python 2.2.

    In latest PyS60 sources, the function is indeed present in file timemodule.c, but just before it there is this flag:

    Code:
    #if 0
    /* Enable this if it's not declared in <time.h> */
    extern char *strptime(const char *, const char *, struct tm *);
    #endif
    So I suppose the problem is that, when PyS60 was built, time.h did not declare the function and the above flag was disabled, so strptime was not included in time module.

    Do you agree with me? Shall I file a new bug on Sourceforge?

    Thanks in advance.

  5. #5
    Regular Contributor
    Join Date
    Jan 2004
    Location
    Helsinki
    Posts
    376

    Re: time.strptime function missing?

    Quote Originally Posted by florianosc View Post
    Code:
    #if 0
    /* Enable this if it's not declared in <time.h> */
    extern char *strptime(const char *, const char *, struct tm *);
    #endif
    So I suppose the problem is that, when PyS60 was built, time.h did not declare the function and the above flag was disabled, so strptime was not included in time module.

    Do you agree with me? Shall I file a new bug on Sourceforge?
    time.h might be missing on Symbian. It doesn't really have any of the standard C libraries. Please, file a bug, and others will know how to deal with the problem.

    Also there exist a custom datetime port to PyS60.
    Mikko Ohtamaa

    http://mfabrik.com
    http://blog.mfabrik.com

  6. #6
    Registered User
    Join Date
    May 2007
    Posts
    10

    Re: time.strptime function missing?

    Quote Originally Posted by florianosc View Post
    Is it a bug or that function is unimplemented? Where can I find a list of implemented/unimplemented functions in S60 for each standard Python module?
    In Python, strptime depends on the implementation of the underling operating system; looks like Symbian doesn't have it, so it's not in the time module.

    Maybe you can get an implementation from a time.c source file, and use it to reimplement it in Python or build a C module.

    HTH

Similar Threads

  1. S60 2nd to 3rd/ PlatformSecurity / Capabilities
    By jarkoos in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 4
    Last Post: 2007-04-14, 14:08
  2. Missing function "rebuild project" in carbide.c++ 1.1 Express
    By KarstenBln in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 0
    Last Post: 2007-03-22, 15:27
  3. Problem with Cabride.c++ v1.1
    By markovuksanovic in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 3
    Last Post: 2007-01-24, 20:05
  4. Cannot compile SDK's examples for 7650 platform...
    By midletsoft in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2003-08-12, 19:11
  5. Problem with Nokia D211 Linux Drivers
    By fiveam in forum Multimodecards
    Replies: 1
    Last Post: 1970-01-01, 02:00

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×