| Reply | « Previous Thread | Next Thread » |
|
I've been messing around and reading on the forum, but I'm not 100% sure how to create my own modules.
Can somebody make it clear how I would make a few classes and be able to import them from many other scripts? It seems like the e:\python\lib... um... used to work? but doesn't anymore... etc. Sorry if this has been answered many times, I searched but couldn't find anything. Thanks! -kevin |
|
Hi kevin and welcome to the forum
Fist of all which phone are you using? Writing your libraries is very simple, you just create a new python file like my_lib.py where you write you classes there, like HelloLib classes. After depending on your phone you push your script to the phone. For second edition phones it's easy, push your script via bluetooth for example and install install it like library module or something like that. For 3rd edition it a bit more complicated. You have to create an installation package (.sis) and then self-sign it (becomes .sisx) The library directory is c:\resource or e:\resource depending on where you installed python (phone of memory card) You can check few steps in here. Just skip the compiling parts, download the .pkg, modify it as it should, package and sign your package. Good luck ![]() LFD Devices: Nokia E61 3rd Edition - pys60 1.4.0 Tips and modules: http://www.lfdm.net/thesis |
|
And then I forgot
![]() To use your own module like described previously, you can do like Code:
import my_lib # create new object newObj = my_lib.HelloLib() ... some intersting stuff Code:
from my_lib import HelloLib # create new object newObj = HelloLib() ... some intersting stuff Code:
from my_lib import * # this import all classes from you library file # create new object newObj = HelloLib() ... some intersting stuff ![]() LFD Devices: Nokia E61 3rd Edition - pys60 1.4.0 Tips and modules: http://www.lfdm.net/thesis |
|
Thanks very much for the reply! I'm working on an N93, which is 3rd edition.
I'm doing super-rapid-development in a team of three people. We just got the phones a few days ago, and we're trying to glue together / produce a large-scale game. (and we only have two phones, some of us on macs, windows, linux, etc etc... really fun, y'know!?) I was playing around last night, and discovered that sys.path is improperly set up on (the latest version of pys60/3rd ed? | the N93?). e:\Python\lib has been added to sys.path, but as a unicode string, which python doesn't like in this case. So, in my main class, I'm just doing something like Code:
import sys
sys.path.append('e:\Python\MyModules')
|
|
Have you tried e:\python\lib instead of e:\Python\lib? I've seen that already
![]() But now I see you have a N93, it's a 3rd edition phone. So libraries are located in c:\resource or e:\resource depending where you installed PyS60. If you add new C++ modules they are located in c:\sys\bin or e:\sys\bin LFD Devices: Nokia E61 3rd Edition - pys60 1.4.0 Tips and modules: http://www.lfdm.net/thesis |
|
jibberia, what version of PyS60 are you using? The \python\lib unicode problem was fixed several versions ago.
|
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| How to build GCCE target | dsiorpaes | Symbian Tools & SDKs | 5 | 2008-09-18 07:54 |
| [Pys60, 3rd Ed.] build problems | MHOOO | Python | 3 | 2007-04-09 20:00 |
| Compilation series 60 3rd edition | asmobease | Symbian Tools & SDKs | 32 | 2006-09-13 10:46 |
| Compilation series 60 3rd edition | asmobease | General Symbian C++ | 3 | 2006-09-10 15:08 |
| abld make files missing | dalore | General Symbian C++ | 0 | 2003-06-13 13:40 |