maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N9 / N950 (https://talk.maemo.org/forumdisplay.php?f=51)
-   -   Nokia N9-How to use python to run py file (https://talk.maemo.org/showthread.php?t=89680)

md07 2013-04-02 01:10

Nokia N9-How to use python to run py file
 
i use Nokia N9. I read some topic that N9 can install python. I installed python for N9 by Terminal (apt-get install python) but after i cant play *.py or i dont know how to run.
i used Symbian, this OS run py file very easy. just install python pack, and click py.

Can you guide me how to use full python, espicial run py file from Nokia N9?

TKS!

thedead1440 2013-04-02 01:25

Re: Nokia N9-How to use python to run py file
 
in terminal type:
Code:

python /path/to/file.py
Just like any linux pc ;)

marxian 2013-04-02 01:25

Re: Nokia N9-How to use python to run py file
 
Usually, it is enough to simply enter the path to the file. So, if the path to the file is /home/user/my_script.py, just type that in the terminal and press enter. Sometimes, you may need to tell the shell to use the python environment, in which case you would type

Code:

python /home/user/my_script.py
In most cases, you won't need to do this, as the script will handle this for you.

md07 2013-04-02 02:27

Re: Nokia N9-How to use python to run py file
 
Quote:

Originally Posted by marxian (Post 1333619)
Usually, it is enough to simply enter the path to the file. So, if the path to the file is /home/user/my_script.py, just type that in the terminal and press enter. Sometimes, you may need to tell the shell to use the python environment, in which case you would type

Code:

python /home/user/my_script.py
In most cases, you won't need to do this, as the script will handle this for you.

tks! i wll try later.

My py file (used good in Symbian S60) is a application which can call someone automatic, when they answer the application automatic hangup and call again.....:p. maybe this app is bomb call:cool:

md07 2013-04-02 04:06

Re: Nokia N9-How to use python to run py file
 
i tried. in Terminal say error line 1: no modules name appuifw.

BTW, in my code of py application have one more module name "telephone".

So , how can i install module for this python app?


sr 4 my bad English :)

PS: my Py code i used in Python Symbian:

import appuifw
import telephone
import e32

soDTbomb = appuifw.query(u"Victim number?","text")
nm = appuifw.query(u"how much bomb:","number")

def handleCall((callState, number)):
if callState == telephone.EStatusConnected:
e32.ao_sleep(0.2)
telephone.hang_up()
e32.ao_sleep(0.7)
telephone.dial(soDTbomb)
e32.ao_sleep(0.2)
telephone.call_state(handleCall)

for PS in range(nm):
print "(^_^)Bombed %d"%(PS+1)
telephone.dial(soDTbomb)
try:
e32.ao_sleep(0.7)
telephone.dial(soDTbomb)
except:
telephone.call_state(handleCall)
e32.ao_sleep(40)
telephone.hang_up()
e32.ao_sleep(0.7)
print "Done %d call."%(PS+1)

juiceme 2013-04-02 05:23

Re: Nokia N9-How to use python to run py file
 
In python language the "import" statement loads a code module for use, so you need to get the modules from somewhere.

I kind of guess that this "telephone" module is something that needs to be ported to the platform you are using, it propably does not exist for Harmattan yet.

md07 2013-04-02 05:27

Re: Nokia N9-How to use python to run py file
 
Quote:

Originally Posted by juiceme (Post 1333645)
In python language the "import" statement loads a code module for use, so you need to get the modules from somewhere.

I kind of guess that this "telephone" module is something that needs to be ported to the platform you are using, it propably does not exist for Harmattan yet.

did u know module same as "appuifw" and "telephone" for Harmattan?


All times are GMT. The time now is 07:13.

vBulletin® Version 3.8.8