×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    3

    ImportError when adding modules

    I'm experiencing two problems that I think are related.

    I have an E61, which is a 3rd ed. phone.

    I've installed both pythonfors60_1_3_8_3rded_selfsigned.sis and pythonscriptshell_1_3_8_3rded_selfsigned.sis. I'm trying to add some additional modules but they just aren't being recognized/installed.

    I started by sending the modules via BT. Upon opening the message, it failed, indicating it didn't recognize the file type. I then copied them to the external card (again using BT) and opened the file (named "testimport.py") from the File Manager app. The screen went blank for a few seconds and then returned to the File Manager. It didn't ask if I wanted to install it as a script or module, like the docs say.

    Then I created E:\python\lib and copied the files there. I opened python and verified that the directory had been appended to sys.path. (It showed up as 'u"E:\\python\\lib"'.) Then I listed the contents of that dir using os.listdir:

    >>> os.listdir(sys.path[-1])
    ['rijndael.py', 'testimport.py', 'testimport.pyc']

    But "import testimport" or "import rijndael" both throw an ImportError:

    >>> import testimport
    Traceback (most recent call last):
    File "<console>", line 1, in ?
    ImportError: No module named testimport

    I know people have been successful at installing 3rd party modules. Any idea what I'm doing wrong?

    Thanks!

    -Ben

  2. #2
    Regular Contributor
    Join Date
    Sep 2003
    Location
    Finland
    Posts
    209

    Re: ImportError when adding modules

    Quote Originally Posted by insyte
    I have an E61, which is a 3rd ed. phone.

    I started by sending the modules via BT. Upon opening the message, it failed, indicating it didn't recognize the file type. I then copied them to the external card (again using BT) and opened the file (named "testimport.py") from the File Manager app. The screen went blank for a few seconds and then returned to the File Manager. It didn't ask if I wanted to install it as a script or module, like the docs say.
    The current 3rdEd distribution does not yet support the recognizer-appmgr -functionality available in earlier PyS60 versions.

    Quote Originally Posted by insyte
    Then I created E:\python\lib and copied the files there. I opened python and verified that the directory had been appended to sys.path. (It showed up as 'u"E:\\python\\lib"'.) Then I listed the contents of that dir using os.listdir:
    Have a look at http://puzzle.dl.sourceforge.net/sou...dEd_README.txt

    The ".py" library files (that you want to make available globally for the Python applications) should go to "c:\resource", use e.g. ".pkg" (search your S60 SDK with keyword "pkg") files to transfer the files there - this has the added benefit that you can easily uninstall those packages via SWInstall and your handset won't get "polluted".

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    3

    Re: ImportError when adding modules

    The ".py" library files (that you want to make available globally for the Python applications) should go to "c:\resource", use e.g. ".pkg" (search your S60 SDK with keyword "pkg") files to transfer the files there
    OK, although Python clearly thinks it should be checking E:\python\lib for modules:

    Code:
    >>> import sys, os
    >>> sys.path
    ['c:\\private\\f0201515', 'c:\\resource', u'e:\\python\\lib']
    >>> os.listdir(sys.path[-1])
    ['rijndael.py', 'testimport.py', 'testimport.pyc']
    >>> import testimport
    Traceback (most recent call last):
      File "<console>", line 1, in ?
    ImportError: No module named testimport
    >>> import rijndael
    Traceback (most recent call last):
      File "<console>", line 1, in ?
    ImportError: No module named rijndael
    >>>
    Has core Python functionality been changed so much that sys.path is no longer honored?

    -Ben

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    3

    Re: ImportError when adding modules

    Quote Originally Posted by insyte
    OK, although Python clearly thinks it should be checking E:\python\lib for modules:
    D'oh... Just learned on #pys60 that the e:\python\lib functionality is temporarily broken.

    -Ben

Similar Threads

  1. Tip: Loading modules in a background thread
    By bercobeute in forum Python
    Replies: 1
    Last Post: 2006-02-27, 05:19
  2. Conditional compilation: managing set of modules
    By doctordwarf in forum Symbian C++
    Replies: 3
    Last Post: 2004-08-31, 14:01
  3. Modules
    By stenlik in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2004-06-09, 09:30
  4. Problem adding contact
    By jsstewart in forum Symbian C++
    Replies: 1
    Last Post: 2004-02-17, 13:22
  5. Adding assembly (.s) source files
    By aehrath in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2003-06-27, 23:05

Posting Permissions

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