| Reply | « Previous Thread | Next Thread » |
|
Hello together,
I've started developing with pyS60 (Version 1.4.5 final) on my Nokia 6120 classic and everything works fine so far - except that I'm not able to load any external modules. I need the csv module (http://docs.python.org/library/csv.html) and put the csv.py from my local Python installation (Ubuntu 8.10) into my Python Script folder on my mobile (E:\\Python) on the external memory card. Then I start the interactive console on my phone and I get >>> import csv >>> Import Error: No module named csv Same happens when I put a simple python file with "import csv" in the script folder (E:\\Python) and start the script from within Python. Could anybody help me? Thanks a lot! |
|
Join Date: Feb 2008
Posts: 743
Location: Belo Horizonte, Brazil
Rafael T.
Offline
Forum Nokia Champion
|
|
|
Quote:
Code:
import sys
sys.path.append('E:\\Python')
import csv
Rafael. |
|
Join Date: Nov 2007
Posts: 314
Location: Sertaozinho/Brazil
marcelobarrosalmeida
Offline
Forum Nokia Champion
|
|
Python is prepared to look for scripts in e:\python\lib, besides other directories in C: (private\<id>, resource).
If you want to put it in e:\python, follow Rafael instructions. My strategy is to put my scripts wherever I want and add an entry point in e:\python. e:\python\myprogentry.py: Code:
import sys
sys.path.append('e:\\mydir\\')
import mymodule
mymodule.run() # put your initialization code here
Marcelo Barros Nokia E71, N800, N95 and XM 5800 http://www.croozeus.com http://wordmobi.wordpress.com http://jedizone.wordpress.com |
|
Quote:
Not very nice... Then you also have to remember to force SIS installation only on e-drive!On the other hand you could try to find out what is "current" directory or drive and just add that. Or an easier way might be to add both c and e drives on sys.path: Code:
import sys
sys.path.append('c:\\mydir\\')
sys.path.append('e:\\mydir\\')
import mymodule
mymodule.run() # put your initialization code here
--jouni who wants to have TOTAL CONTROL over HIS OWN phone ![]() |
|
Hi Rafael,
thanks a lot, you took me one step further. But now I get the error: Code:
no module named _csv Code:
from _csv import Error, ..... Any hints for me? Thanks! |
|
Join Date: Nov 2007
Posts: 314
Location: Sertaozinho/Brazil
marcelobarrosalmeida
Offline
Forum Nokia Champion
|
|
[quote=JOM;533648]You force user to install your script/app on e-drive
Not very nice... Then you also have to remember to force SIS installation only on e-drive![/code] No, that is not my point ! In fact, my code is free of any sys.path.append(). This is nice way for generating and testing .sis, without even testing if you are in emulator or not. That stub code is just for starting my application and it is not included in the application itself. When installed, the sys.path.append() is not necessary since all .py files will be together. However, if I am running scripts from memory card (not a sis), the stub code do the dirt job and add a call to append(). Marcelo Barros Nokia E71, N800, N95 and XM 5800 http://www.croozeus.com http://wordmobi.wordpress.com http://jedizone.wordpress.com |
|
Hi,
No problem, I use something similar: have just-in-case code in default.py regardless whether I need it or not Glad to hear you prefer sw which can be installed anywhere! Hopefully PyS60 2.x will also support that.. 1.4.x has some mysterious bugs which require occasionally installation on exactly same drive as python runtime and maybe even on c-drive. Not clear why, but that's the way things are.Cheers, --jouni |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Nokia 6120c (S60 v3 v3.70) - J2ME app running from memory card works first then fails | mmcnamee | Mobile Java General | 6 | 2008-08-07 11:31 |
| Grid app is crashing... need urgent help... | shankha | General Symbian C++ | 4 | 2007-11-20 12:52 |
| S60 2nd to 3rd/ PlatformSecurity / Capabilities | jarkoos | Installation, Certification and Security | 4 | 2007-04-14 15:08 |
| Conditional compilation: managing set of modules | doctordwarf | General Symbian C++ | 3 | 2004-08-31 15:01 |
| Modules | stenlik | Symbian Networking & Messaging | 1 | 2004-06-09 10:30 |