×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    10

    help compiling a Python C module

    I have a small problem compiling a C source to a Python dynamic module, that I need for an open source project.

    I put the source, complete with the files generated by make_dll_stup.py script, here: http://imdbpy.sf.net/foo.zip

    As you can see the code is quite simple.
    The module compiles and the _foo.pyd file is produced, running - by the DOS prompt - these commands:
    bldmake bldfiles
    abld build armi urel

    Once I install it to the phone (n70), I can import it with the python interpreter and even see its exported methods with dir(_foo); unfortunately, as I call a method (like _foo.soundex('abc')), the interpreter bloody crashes.

    I still have some problems using the emulator and the carbide environment, so if anyone can try it and help me spotting the problem, will be rewarded in the CREDITS of IMDbPY.

  2. #2
    Registered User
    Join Date
    May 2007
    Posts
    10

    Re: help compiling a Python C module

    A funny fact: I've imported the project in Carbide: compiling and running it on the emulator, it works fine.
    When I compile (armi/urel) and transfer it to the phone (nokia n70), it crashes the interpreter.

  3. #3
    Regular Contributor
    Join Date
    Jan 2004
    Location
    Helsinki
    Posts
    376

    Re: help compiling a Python C module

    Quote Originally Posted by mad77 View Post
    A funny fact: I've imported the project in Carbide: compiling and running it on the emulator, it works fine.
    When I compile (armi/urel) and transfer it to the phone (nokia n70), it crashes the interpreter.
    Sounds like there is some calling convention problem with DLL functions (e.g the target DLL uses different compiler/parameters than python.exe). Could you probably have a wrong SDK (not sure if this matters, but it used to matter) or this kind of problem?
    Mikko Ohtamaa

    http://mfabrik.com
    http://blog.mfabrik.com

  4. #4
    Registered User
    Join Date
    May 2007
    Posts
    10

    Re: help compiling a Python C module

    Quote Originally Posted by miohtama View Post
    Sounds like there is some calling convention problem with DLL functions (e.g the target DLL uses different compiler/parameters than python.exe). Could you probably have a wrong SDK (not sure if this matters, but it used to matter) or this kind of problem?
    I'm almost sure I've installed the right tools (PythonForS60_1_4_2_SDK_2ndEdFP3.zip and PythonScriptShell_1_4_1_2ndEdFP3.SIS on the phone, s60_2nd_sdk_fp3.zip and PythonForS60_SDK_2ndEdFP3 on the PC).

    Anyway, I'll try googling more, since the problem persists.

    Moreover, I've released the software I'm developing; maybe it works, on some platform. :
    http://imdbpy.sf.net/?page=mobile

    Thanks!

  5. #5
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: help compiling a Python C module

    hi mad
    infact i believe that miohtama is correct. if ur code is working in emulator and not working in phone. then the reason must be that the installed script shell and pys60 file are not correct better u check that out.

  6. #6
    Registered User
    Join Date
    May 2007
    Posts
    10

    Re: help compiling a Python C module

    Quote Originally Posted by gaba88 View Post
    infact i believe that miohtama is correct. if ur code is working in emulator and not working in phone. then the reason must be that the installed script shell and pys60 file are not correct better u check that out.
    Yup - that would make sense and I'm convinced the problem is something similar; unfortunately, I really can't spot what's wrong: everything I've installed seems correct.

    I'll try compiling someone's else code, to see it it works on my phone.

    Meanwhile, my code is here:
    http://imdbpy.sf.net/?page=mobile

    If someone can test it (my pyd in the imdbpysy.zip file) to see if it works on another S60 2nd edition FP3 (a simple print cutils.soundex('abcde') is enough)...
    Another option: if someone can compile cutils.zip in an environment known to work - again, for 2nd edition, FP3) and send it to me at da(at)erlug.linux.it, I'll be really grateful.

    Many thanks!

  7. #7
    Registered User
    Join Date
    Mar 2008
    Posts
    2

    Re: help compiling a Python C module

    Hi,

    Which flavor of Python_script_shell are you using?
    I mean what is capability set for python script shell.

    This could be the problem in device?

  8. #8
    Registered User
    Join Date
    May 2007
    Posts
    10

    Re: help compiling a Python C module

    Quote Originally Posted by ajeetks View Post
    Which flavor of Python_script_shell are you using?
    I mean what is capability set for python script shell.

    This could be the problem in device?
    I'm using PythonScriptShell_1_4_1_2ndEdFP3, downloaded from sourceforge,
    sdk 2nd edition FP3 (152 Mb) from the nokia page.

    On the phone I can import the module and see its functions with dir(module), but any call crashes the interpreter.

    Many thanks for the hints; I'll investigate a bit more.

Similar Threads

  1. Camera Python Module
    By vp in forum Python
    Replies: 4
    Last Post: 2008-09-22, 09:56
  2. Replies: 4
    Last Post: 2008-04-14, 03:23
  3. Replies: 3
    Last Post: 2008-02-09, 13:05
  4. Replies: 2
    Last Post: 2007-10-18, 00:02
  5. Carbide.j 1.5 and Netbeans 5.5 beta 2
    By ovjo12 in forum Mobile Java Tools & SDKs
    Replies: 5
    Last Post: 2007-06-11, 05: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
  •