×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    5

    PyS60 Developing Techniques

    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
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: PyS60 Developing Techniques

    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
    Join Date
    Jul 2007
    Location
    Eindhoven, the Netherlands
    Posts
    187

    Re: PyS60 Developing Techniques

    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
    Join Date
    Apr 2007
    Posts
    131

    Re: PyS60 Developing Techniques

    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 Symbian
    Replies: 0
    Last Post: 2008-10-18, 05:10
  2. New to Python for S60 (PyS60)? Read this first!
    By croozeus in forum Nokia N9
    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 Symbian
    Replies: 14
    Last Post: 2008-09-15, 14:23
  5. Guide on developing PyS60 apps under Linux
    By pure_x01 in forum Symbian
    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
  •  
×