带有传感器和 xprofile 模块的诺基亚 N95 和 PyS60
我制作了一个 python 脚本,它应该根据手机位置修改手机的配置文件。 在 ScriptShell 下运行它效果很好。
问题是它挂起,无论是在“启动”时运行“sis”脚本还是没有运行“sis”脚本。
所以我的问题是代码有什么问题,以及我是否需要传递特殊参数给 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()
该脚本在启动时启动,使用 ensymble 和我的开发人员证书。
提前致谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我经常在脚本顶部使用类似的内容:
I often use something like that at the top of my scripts:
xprofile 不是标准库,请确保添加它的路径。 我的猜测是,当作为 SIS 运行时,它找不到 xprofile 并挂起。 发布 SIS 时,请指示用户单独安装或包含在 SIS 中。
您将在哪里安装它,请使用该路径。 这是 python 默认目录作为示例:
顺便说一句,make clean exit,执行以下操作:
xprofile is not a standard library, make sure you add path to it. My guess is that when run as SIS, it doesn't find xprofile and hangs up. When releasing your SIS, either instruct that users install that separately or include inside your SIS.
Where would you have it installed, use that path. Here's python default directory as sample:
Btw make clean exit, do this: