×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Regular Contributor
    Join Date
    Aug 2004
    Posts
    66

    Commercial application/games with Python

    Dear all,

    It's possible to create with Python commercial application/games ?
    When i create a myApplication.sis inside there are three files:

    1) "default.py"
    2) "myApplication.app"
    3) "myApplication.rsc"

    Inside default.py there is my source code.
    There is a way to create an myApplication.sis without my source code ?

    Thank you.

  2. #2
    Super Contributor
    Join Date
    Dec 2004
    Posts
    643
    Try precompiling your app into a .pyc file (or for a slight performance and size gain, .pyo file). .pyc and .pyo files are platform-independent Python bytecode files, so you can compile your scripts to .pyc or .pyo files on a PC and then package them to a .sis. They should work on the phone too, as long as you use Python 2.2.2 for compilation on the PC side.

  3. #3
    Regular Contributor
    Join Date
    Aug 2004
    Posts
    66
    Sorry, please Admin delete my post.

    "default.py" doesn't contains my source code , it's a simple launch script.

  4. #4
    Regular Contributor
    Join Date
    Dec 2004
    Location
    Czech Republic
    Posts
    50
    no, when you create standalone app, default.py really contains the source

  5. #5
    Regular Contributor
    Join Date
    Aug 2004
    Posts
    66
    Yes, it's right but sometime py2sis.exe doesn't works very good. It insert into sis this default.py. For this reason sometime
    i see my source code other that code.
    -----------------------------
    import sys
    import os
    import appuifw
    import series60_console

    def query_and_exec():
    def is_py(x):
    return os.path.splitext(x)[1] == '.py'

    my_script_dir = os.path.join(this_dir,'my')
    script_list = []

    if os.path.exists(my_script_dir):
    script_list = map(lambda x: os.path.join('my',x),\
    filter(is_py, os.listdir(my_script_dir)))

    script_list += filter(is_py, os.listdir(this_dir))
    index = appuifw.selection_list(map(unicode, script_list))
    if index >= 0:
    execfile(os.path.join(this_dir, script_list[index]), globals())

    def exec_interactive():
    import interactive_console
    interactive_console.Py_console(my_console).interactive_loop()

    def exec_btconsole():
    import btconsole
    btconsole.main()

    def menu_action(f):
    appuifw.app.menu = []
    saved_exit_key_handler = appuifw.app.exit_key_handler

    try:
    f()
    finally:
    appuifw.app.exit_key_handler = saved_exit_key_handler
    appuifw.app.title = u'Python'
    init_options_menu()
    appuifw.app.body = my_console.text
    appuifw.app.screen='normal'
    sys.stderr = sys.stdout = my_console

    def init_options_menu():
    appuifw.app.menu = [(u"Run script",\
    lambda: menu_action(query_and_exec)),
    (u"Interactive console",\
    lambda: menu_action(exec_interactive)),\
    # (u"Bluetooth console",\
    # lambda: menu_action(exec_btconsole)),\
    (u"About Python",\
    lambda: appuifw.note(u"See www.python.org for more information.", "info"))]

    this_dir = os.path.split(appuifw.app.full_name())[0]
    my_console = series60_console.Console()
    appuifw.app.body = my_console.text
    sys.stderr = sys.stdout = my_console
    #from e32 import _stdo
    #_stdo(u'c:\\python_error.log') # low-level error output
    init_options_menu()
    print copyright
    ----------------------

  6. #6
    Regular Contributor
    Join Date
    Sep 2003
    Location
    Finland
    Posts
    209
    Originally posted by spaceman76
    Yes, it's right but sometime py2sis.exe doesn't works very good. It insert into sis this default.py. For this reason sometime
    i see my source code other that code.
    See this thread:

    http://discussion.forum.nokia.com/fo...threadid=63099

    I suspect this is your problem:

    "
    There is also one defect in "py2sis":

    If you have a file named "default.py" in the same folder were you are invoking "py2sis" with some other script as argument (e.g. "foobar.py) it will always place script "default.py" to the created SIS file and not the one given as command line parameter (e.g. "foobar.py").
    "

  7. #7
    Regular Contributor
    Join Date
    Dec 2004
    Location
    Czech Republic
    Posts
    50
    Originally posted by spaceman76
    Yes, it's right but sometime py2sis.exe doesn't works very good. It insert into sis this default.py. For this reason sometime
    i see my source code other that code.

    ----------------------
    sorry then, I don't use py2sis to make standalones

  8. #8
    Regular Contributor
    Join Date
    Aug 2004
    Posts
    66
    Thank you, now works correctly.

    So to create a commercial application i must
    follow these steps:
    1) create myApplication and precompiling into a myApplication.pyc file.
    2) create startMyApplication.py that execute myApplication.pyc.
    3) py2sis startMyApplication.py to create startMyApplication.sis.
    4) Unzip startMyApplication.sis to insert into myApplication.pyc in /system/libs/.
    5) Create myApplication.sis and then install it.

    There are other solutions ?

  9. #9
    Regular Contributor
    Join Date
    Aug 2004
    Posts
    66
    Originally posted by Zen13546
    sorry then, I don't use py2sis to make standalones
    Sorry but what tools do you use to make standalones python applications ?

  10. #10
    Super Contributor
    Join Date
    Dec 2004
    Posts
    643
    Originally posted by spaceman76
    Thank you, now works correctly.

    So to create a commercial application i must
    follow these steps:
    1) create myApplication and precompiling into a myApplication.pyc file.
    2) create startMyApplication.py that execute myApplication.pyc.
    3) py2sis startMyApplication.py to create startMyApplication.sis.
    4) Unzip startMyApplication.sis to insert into myApplication.pyc in /system/libs/.
    5) Create myApplication.sis and then install it.

    There are other solutions ?
    You can also give a directory name to py2sis to package all files in that directory.

  11. #11
    Regular Contributor
    Join Date
    Dec 2004
    Location
    Czech Republic
    Posts
    50
    Originally posted by spaceman76
    Sorry but what tools do you use to make standalones python applications ?
    at first I used just the default.py feature,but this was slow and i needed pc. now i use this http://discussion.forum.nokia.com/fo...threadid=57553 (see my post there)

Posting Permissions

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