×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Jul 2009
    Posts
    10

    lightblue for python 1.9.x

    Hey all,
    I downloaded a zip file containing source code for the lightblue module that claims to be compatible with pyx60 1.9.x. The file I downloaded (lightblue-0.4_s60-3rdEd-FP2_freedevcert_PyS60-1.9.x.zip) can be found herehttp://sourceforge.net/projects/lightblue/files/

    However, no .sis file is available. I noticed in the source for previous (non 1.9.x compatible) versions of lightblue that there is the _lightblueutil module (in the source for these versions it is c++ code.) The source code that I downloaded above does NOT have the _lightblueutil source, it *does* include a file called "kf__lightblueutil.pyd". As you can tell I am a newbie, I am trying to get a python script code written in pys60 1.9.6 to use the lightblue module, but the python shell script says it can't find the module _lightblueutil. I put the following files in the E:/Python/Lib/ directory on my phone's (N79) memory card.:
    • _lightblue.py
    • _lightbluecommon.py
    • _obex.py
    • _obexcommon.py
    • kf__lightblueutil.pyd
    • obex.py
    • __init__.py


    Any ideas? What am I doing wrong? How, in general, are .pyd files used/installed? How would I make a .sis file for this version of lightblue?

  2. #2
    Regular Contributor
    Join Date
    Sep 2008
    Location
    London, UK
    Posts
    176

    Re: lightblue for python 1.9.x

    i don't know if anyone else feels the same way, but for those who develop python apps on the mobile device whilst commuting, the new way of distributing extensions is a tedious task if the sis isnt supplied.

    you need to use ensymble "simplesis" command to create the sis file which will chuck the
    .pyd file in e:\sys\bin\
    and .py wrapper to c:\data\python25

    I've not worked out how to do this for separate drives, so have been compiling from source codes with Carbide.
    The86Hitman
    PyS60 1.9.7 on E71
    http://www.drhtailor.com/pys60

  3. #3
    Registered User
    Join Date
    Jun 2009
    Posts
    26

    Re: lightblue for python 1.9.x

    Hi finnsmama,

    A few weeks ago I was struggling with lightblue quite a lot (actually the developer recompiled the module for 1.9.x on my request...).

    The only solution, that worked for me in the end to use the module was to extract the zip file to module-repo folder (C:\Program Files\PythonForS60\module-repo\dev-modules in my case) and in the script that you want to use lightblue with, simply import lightblue. Packaging with ensymble afterwards you also get lightblue module included and installed in the right place.

    Hope this helps.

    AndriusA

  4. #4
    Regular Contributor
    Join Date
    Sep 2005
    Location
    Finland, Helsinki
    Posts
    323

    Re: lightblue for python 1.9.x

    Quote Originally Posted by the86hitman View Post
    i don't know if anyone else feels the same way, but for those who develop python apps on the mobile device whilst commuting, the new way of distributing extensions is a tedious task if the sis isnt supplied.

    you need to use ensymble "simplesis" command to create the sis file which will chuck the
    .pyd file in e:\sys\bin\
    and .py wrapper to c:\data\python25
    Would you mind publishing this ensymble simplesis [...] command, please? :-)

    I want to install all files in the C:.
    --
    Aapo Rista
    http://code.google.com/p/pys60gps/
    http://opennetmap.org/

  5. #5
    Regular Contributor
    Join Date
    Sep 2008
    Location
    London, UK
    Posts
    176

    Re: lightblue for python 1.9.x

    ok, on further investigating python shell, i noticed the E:\Python\Lib folder! so you can manually create this path and .py wrappers will be automatically detected

    to package your extension, create the folder structure as shown:
    Code:
    lightblue
      |
       -- sys
      |    |
      |     -- bin
      |         |
      |          -- kf_lightblueutil.pyd
      | 
       -- python
           |
            -- Lib
                |
                 -- all the .py files
    the ensymble command i use is from the command prompt (assuming lightblue folder above is created in C:\program files\pythonfors60\module-repo\):
    Code:
    C:\PROGRA~1\PYTHON~1\module-repo>c:\python25\python ..\ensymble.py simplesis -u
    0xUID -r 0.0.4 -c "lightblue" lightblue
    replace the parts in bold as required. hope that works for you!
    The86Hitman
    PyS60 1.9.7 on E71
    http://www.drhtailor.com/pys60

  6. #6
    Registered User
    Join Date
    Nov 2009
    Posts
    1

    Re: lightblue for python 1.9.x

    Thanks to the86hitman! I finally figured out how to create lightblue.sis based on his info.
    In the following (long explanation) I show You how to create your own module to be imported
    in your applications, and how to create a working lightblue.sis file to be installed on a
    phone wiht PyS60 1.9.x
    Hope it works for you

    CREATE A MODULE TO USE WITH YOUR .SIS FILES:
    --------------------------------------------

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    mymodule.py:
    ------------
    import appuifw, e32, sys, os, sysinfo # Test various imports

    def test():
    print "MyModule test OK"
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    testMyModule.py:
    ----------------
    import mymodule

    mymodule.test()
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


    Create the following folder structure (This is for PyS60 1.9.x)
    If you don't know how the folder structure is on your phone, you can
    use the following commands in the ScriptShell's interactive console:
    ___________________________________________________________
    import os

    os.listdir("c:") # to see if you have the resource directory
    os.listdir("c:\\resource")
    # If you have the c:\\resource\\python25 folder structure on
    # the phone, then use the following folder structure on you PC.
    ___________________________________________________________

    Code:
    module-repo
      |
      |
      |__ mymodule
            |
            |
            |__ sys
            |    |
            |    |__ bin (.pyd here. If any)
            |
            |
            |__ resource
                 |
                 |__ python25 (place .py files here)
    Put mymodule.py in
    C:\Program Files\PythonForS60\module-repo\mymodule\resource\python25 folder
    and nothing in
    C:\Program Files\PythonForS60\module-repo\mymodule\sys\bin (we have no .pyd file)

    Go to C:\Program Files\PythonForS60\module-repo with a command prompt and write

    ensymble.py simplesis -u 0xa1234567 -r 0.0.7 -c "mymodule" mymod

    This will create mymod_v0_0_7.sis
    Install this file on your phone.

    Now use the "PyS60 application packager" to create testMyModule_v1_0_0.sis or use
    what ever way you normally create .sis files. Install testMyModule on the phone.
    Go to your program folder on the phone and run testMyModule. This will print:

    MyModule test OK

    That's it.

    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    CREATE lightblue.sis TO IMPORT IN YOUR APPLICATIONS:
    ----------------------------------------------------

    Use os.list as described above to determine the folder structure on the mobile phone.
    On my phone the .pyd file are located in c:\\sys\\bin and .py files located in
    c:\\resource\\python25

    You can maby best determine where to install the module files by using a program like SISXplorer.
    I used SISXplorer to open wlantools.sis for PyS60 1.9.x. I know that this version of wlantools runs
    fine with my PyS60 1.9.7 installation. In SISXplorer you can see where the .pyd file and .py files
    are installed. It says something like this:

    EOpInstall( "!:\sys\bin\kf_wlantools.pyd" );
    EOpInstall( "c:\resource\python25\wlantools.py" );

    We can now create the needed folder structure in C:\Program Files\PythonForS60\module-repo (in my case)

    Code:
    module-repo
      |
      |
      |__ lightblue
            |
            |
            |__ sys
            |    |
            |    |__ bin ( kf__lightblueutil.pyd )
            |
            |
            |__ resource
                 |
                 |__ python25 ( __init__.py         )
                              ( lightblue.py        )
                              ( _lightbluecommon.py )
                              ( obex.py             )
                              ( _obex.py            )
                              ( _obexcommon.py      )
    
    IMPORTANT NOTE: When You download lightblue-0.4_s60-3rdEd-FP2_PyS60-1.9.x.zip the archive contain
                    _lightblue.py. RENAME this file to lightblue.py
                    If You don't rename the file, You will get a "no module named lightblue" error when
                    you try to import lightblue in your application.
    Go to C:\Program Files\PythonForS60\module-repo with a command-line tool and write:

    ensymble.py simplesis -u 0xa1234567 -r 0.0.7 -c "lightblue" lightblue

    This will create lightblue_v0_0_7.sis
    Install this file on your phone.

    Using SISXplorer to open lightblue_v0_0_7.sis I can now see the following:

    EOpInstall( "!:\sys\bin\kf__lightblueutil.pyd" );
    EOpInstall( "!:\resource\python25\_lightbluecommon.py" );
    EOpInstall( "!:\resource\python25\_obexcommon.py" );
    EOpInstall( "!:\resource\python25\obex.py" );
    EOpInstall( "!:\resource\python25\_obex.py" );
    EOpInstall( "!:\resource\python25\lightblue.py" );
    EOpInstall( "!:\resource\python25\__init__.py" );

    That's it. I can now import lightblue to an application as follows:

    Code:
    import lightblue
    
    devices = lightblue.finddevices(getnames=True)
    
    for device, name, dev_id in devices:
    	print "----------------"
    	print "Device: " + device
    	print "Name: " + name
    	print "Dev_id: " + str(dev_id)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    To finnsmama - I got the same error as you did at some point (can't find the module _lightblueutil).
    It seems to be the kf__lightblueutil.pyd - If you look at other dev-modules they have a similar
    construct. With the camera module the .pyd file is called kf__camera.pyd and the camera.py uses import _camera. So I think the error is caused because the module .py file can't find the .pyd file.
    Last edited by TueChristophersen; 2009-11-20 at 07:06. Reason: Need to add more info

  7. #7
    Registered User
    Join Date
    Nov 2009
    Posts
    1

    Re: lightblue for python 1.9.x

    Hi TueChristophersen

    Thank you for the recipe!
    I followed your guideline for creating the lightblue.sis but I get the following output:

    ensymble.py: warning: no certificate given, using insecure built-in one
    Input files resource/python25/lightblue.py resource/python25/obex.py resource/python25/_lightbluecommon.py resource/python25/_obex.py resource/python25/_obexcommon.py resource/python25/__init__.py sys/bin/kf__lightblueutil.pyd
    Output SIS file lightblue_dir_v1_0_0.sis
    UID 0xa1234567
    Version 1.0.0
    Language(s) EN
    Package caption(s) lightblue
    Install drive <any>
    Text file(s) <none>
    Certificate <default>
    Private key <default>
    Vendor name(s) Ensymble

    ensymble.py: wrong pass phrase or invalid private key

    Any ideas what goes wrong?
    I've tried both the lightblue-0.4_s60-3rdEd-FP2_PyS60-1.9.x.zip and lightblue-0.4_s60-3rdEd-FP2_freedevcert_PyS60-1.9.x.zip versions.

    Many thanks!
    IstvanZK

Similar Threads

  1. Replies: 3
    Last Post: 2009-07-09, 18:32
  2. Report PyS60 1.9.x defects - PLEASE !!!
    By JOM in forum Symbian
    Replies: 5
    Last Post: 2009-06-18, 06:26
  3. PyS60 ver. 1.4.1 + lightBlue help!
    By MaKsaw in forum Symbian
    Replies: 0
    Last Post: 2009-06-01, 12:28
  4. Receiving Data Error in Lightblue
    By evolvingthought in forum Symbian
    Replies: 1
    Last Post: 2009-04-28, 21:38
  5. Replies: 32
    Last Post: 2007-07-19, 07:43

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×