Nokia N95 and PyS60 with the sensor and xprofile modules
Question: I've made a python script which should modify the profile of the phone based
on the phone position. Runned under ScriptShell it works great.

The problem is that it hangs, both with the "sis" script runned upon "boot
up", as well as without it.

So my question is what is wrong with the code, and also whether I need to pass
special parameters to ensymble?

    
    
    import appuifw, e32, sensor, xprofile
    from appuifw import *
    
    old_profil = xprofile.get_ap()
    
    def get_sensor_data(status):
        #decide profile
    
    def exit_key_handler():
        # Disconnect from the sensor and exit
        acc_sensor.disconnect()
        app_lock.signal()
    
    app_lock = e32.Ao_lock()
    
    appuifw.app.exit_key_handler = exit_key_handler
    appuifw.app.title = u"Acc Silent"
    appuifw.app.menu = [(u'Close', app_lock.signal)]
    appuifw.app.body = Canvas()
    # Retrieve the acceleration sensor
    sensor_type= sensor.sensors()['AccSensor']
    # Create an acceleration sensor object
    acc_sensor= sensor.Sensor(sensor_type['id'],sensor_type['category'])
    # Connect to the sensor
    acc_sensor.connect(get_sensor_data)
    
    # Wait for sensor data and the exit event
    app_lock.wait()
    

The script starts at boot, using ensymble and my developer certificate.

Thanks in advance


Answer: I often use something like that at the top of my scripts:

    
    
    import os.path, sys
    PY_PATH = None
    for p in ['c:\\Data\\Python', 'e:\\Data\\Python','c:\\Python','e:\\Python']:
        if os.path.exists(p): 
            PY_PATH = p
            break
    if PY_PATH and PY_PATH not in sys.path: sys.path.append(PY_PATH)
    

