Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User etteru's Avatar
    Join Date
    Mar 2009
    Posts
    5
    Hi,

    I have the following program:

    Code:
    a.py:
    -----
    import b
    print "a"
    
    b.py:
    -----
    print "b"
    When I run a.py with the PyS60 Script Shell for the first time, the output is

    Code:
    b
    a
    When I run a.py for the second time, the output is

    Code:
    a
    i.e. module b doesn't get reloaded. Does that mean that whenever I change something in module b during development, I have to restart the Script Shell to see the changes? That's awfully painfull, and I can't imagine that everybody is developing like that...

    By the way, is there any possibility to start a script "my_module.py" that lies in "E:\Python" with the Bluetooth Console? I can start a script that lies in "E:\Python\lib" with "import my_script", but I would like to do that with scripts in "E:\Python" as well!

    Thanks for any advice!

  2. #2
    Nokia Developer Champion gaba88's Avatar
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,692
    hello etteru

    welcome to forum nokia PyS60 dibo.

    have you tried telling python to search for the script and then execute that i guess that will solve your problem is guess:

    Code:
    import sys
    sys.path.append('Path')
    try this before importing your script and place the script in the path mentioned by you.

  3. #3
    Regular Contributor hurenkam's Avatar
    Join Date
    Jul 2007
    Location
    Eindhoven, the Netherlands
    Posts
    187
    Quote Originally Posted by etteru View Post
    Hi,
    i.e. module b doesn't get reloaded. Does that mean that whenever I change something in module b during development, I have to restart the Script Shell to see the changes? That's awfully painfull, and I can't imagine that everybody is developing like that...
    Although this may seem strange to you, as long as the scripshell does not exit, it keeps the module b loaded, and thus does not see any need to load it again.
    (there are ways to force unload/reload the module, but I never felt the need to do this, and thus can not point you in the right direction)

    As for general developing techniques, I do most of my development on OSX, then try if things still work in the emulator, and only then I move to the real target.

    For quickly trying things out on target, I generally run an interactive bluetooth console, so that I can type from my PC.

    Regards, and good luck!
    Mark.

  4. #4
    Nokia Developer Expert mahesh.sayibabu's Avatar
    Join Date
    Apr 2007
    Posts
    131
    Quote Originally Posted by etteru View Post
    i.e. module b doesn't get reloaded. Does that mean that whenever I change something in module b during development, I have to restart the Script Shell to see the changes? That's awfully painfull, and I can't imagine that everybody is developing like that...
    As replied above, a module isn't loaded if its already loaded in the interpreter. You can force reloading of a module using reload().

    Quote Originally Posted by etteru View Post
    By the way, is there any possibility to start a script "my_module.py" that lies in "E:\Python" with the Bluetooth Console? I can start a script that lies in "E:\Python\lib" with "import my_script", but I would like to do that with scripts in "E:\Python" as well!
    Yes. From the Bluetooth console say

    Code:
    execfile('e:\\Python\\lib\\my_script.py')
    You can also import these modules by appending sys.path with this directory.

Similar Threads

  1. PyS60 Wiki Pages
    By croozeus in forum Python
    Replies: 0
    Last Post: 2008-10-18, 05:10
  2. Replies: 2
    Last Post: 2008-10-17, 19:23
  3. Replies: 12
    Last Post: 2008-09-23, 06:08
  4. PyS60 Talks #2 : PyS60 Extensions
    By croozeus in forum Python
    Replies: 14
    Last Post: 2008-09-15, 14:23
  5. Guide on developing PyS60 apps under Linux
    By pure_x01 in forum Python
    Replies: 9
    Last Post: 2008-07-10, 16:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved