Active Topics

 


Reply
Thread Tools
Posts: 6 | Thanked: 0 times | Joined on Feb 2010
#1
Hey everyone,
I'm assigned to create a sever/client program on the schools Nokia N800.
I'm having trouble running a python script on it. I installed python and works fine, (when i type python on xterminal, on the phone xterminal) it starts python interpreter.
When i try to run a script in a file (python server.py), it wont. however, when i ssh into the phone and then run python server.py it works fine. any thought?

Also, how do i create a gui interface for my script? where do i start i mean.

-thank you
 
Posts: 540 | Thanked: 288 times | Joined on Sep 2009
#2
Originally Posted by armen_shlang View Post
When i try to run a script in a file (python server.py), it wont.
Any details on this ? error messages, exit code even (echo $?) ?

Originally Posted by armen_shlang View Post
Also, how do i create a gui interface for my script? where do i start i mean.
Read up on PyGTK and Hildon, AFAIRecall there is a fairly usable python-hildon tutorial for diablo (aka OS2008, this is what N8x0 runs) should be findable via google.
 
Posts: 6 | Thanked: 0 times | Joined on Feb 2010
#3
no details noting. as if it ignores the command i wrote, it goes to input ready mode. ~$:

1. I didn't install the maemo SDK on my linux if that is a problem
2. I basically type this line directly on my phone xterminal
~$: python server.py localhost 8081

BTW, I found this for the python gui:
http://wiki.maemo.org/PyMaemo/UI_tut...etting_started
but all of them require me to install maemo SDK. I remember I had trouble installing the scratchbox when i tried to install it.
 
Ralph's Avatar
Posts: 14 | Thanked: 10 times | Joined on Jan 2010 @ Italy
#4
Maybe when you use ssh you log in as root, so your script runs fine. When you try from xterm you are user, not root.
Try to type:

Code:
id
in xterm via ssh and locally and see if there is any difference.

Last edited by Ralph; 2010-02-14 at 18:18.
 

The Following User Says Thank You to Ralph For This Useful Post:
Posts: 540 | Thanked: 288 times | Joined on Sep 2009
#5
Originally Posted by armen_shlang View Post
no details noting. as if it ignores the command i wrote, it goes to input ready mode. ~$:
Which is why I asked for the exit code ("echo $?" shows the last exit code).

Originally Posted by armen_shlang View Post
1. I didn't install the maemo SDK on my linux if that is a problem
2. I basically type this line directly on my phone xterminal
~$: python server.py localhost 8081

BTW, I found this for the python gui:
http://wiki.maemo.org/PyMaemo/UI_tut...etting_started
but all of them require me to install maemo SDK. I remember I had trouble installing the scratchbox when i tried to install it.
No need for the SDK, you can do Python development just fine in-device, I do it all the time (sshfs so I can use more decently sized keyboard and display plus my favourite editor [pygtkeditor I use sometimes directly on the device]).

Port 8081 should not require root privileges but it doesn't hurt to check (type "root" [install rootsh if you haven't] to get root shell without SSH).
 
Posts: 6 | Thanked: 0 times | Joined on Feb 2010
#6
Yes, I was running as a user. I fixed it thank you!
you guys have been very helpful I appreciate it. specially the rootsh that was awesome.
hey rambo, The PyMaemo tutorial says I need Maemo SDK to use the GUI library. how do you develop GUI interface for python on the machine itself?
 
Posts: 540 | Thanked: 288 times | Joined on Sep 2009
#7
Originally Posted by armen_shlang View Post
The PyMaemo tutorial says I need Maemo SDK to use the GUI library. how do you develop GUI interface for python on the machine itself?
On root terminal type "apt-get install python-hildon" (or maybe python2.5-hildon can't remember the exact package name for diablo), that will install the Hildon GUI toolkit (Basically extended GTK) and a bunch of dependencies if it's not installed already.

Then you should be able to follow the tutorial (make sure it's for diablo though, Maemo5 aka Fremantle does some things slightly differently)
 

The Following User Says Thank You to rambo For This Useful Post:
Posts: 6 | Thanked: 0 times | Joined on Feb 2010
#8
thank you rambo.
I managed to get a gui started on the machine, but i'm stuck on hello world example. and i dont expect to be spoon feed, but I 'm new to this. when I try to run the hello world example I get an error saying for this line:
program = hildon.Program.get_instance()
that no such function exists.

I tried other examples, I seem to be getting errors saying no such function exist in the hildon library.
 
Posts: 540 | Thanked: 288 times | Joined on Sep 2009
#9
Originally Posted by armen_shlang View Post
program = hildon.Program.get_instance()
that no such function exists.

I tried other examples, I seem to be getting errors saying no such function exist in the hildon library.
If you're using the tutorial linked above, it's for fremantle and has slightly newer version of hildon...

Here's some bastardized bits of my old diablo code (which is Glade so all the interesting UI stuff is in the XML file, it's faster to use "hardcoded" widgets and for small programs also simpler, but I wanted to learn Glade...

Code:
import hildon, osso, gtk
osso_c = osso.Context("myprog", "0.0.1", False)
app = hildon.Program()
window = hildon.Window()
#window.connect('destroy', mycleanuproutine)
app.add_window(window)

# add your Hildon/GTK widgets to the window

window.show_all()
For older examples see for example (the first one especially)

https://wiki.maemo.org/PyMaemo/Using_Python_in_Maemo
http://wiki.maemo.org/PyMaemo/Python-osso_examples
 

The Following User Says Thank You to rambo For This Useful Post:
Posts: 6 | Thanked: 0 times | Joined on Feb 2010
#10
Thank you again rambo:
I noticed there weren't many tutorials online or a good API for the Hildon module so I'm using GTK for now and it's work ok so far.
-Thanks again
 
Reply


 
Forum Jump


All times are GMT. The time now is 14:06.