×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    39

    Image path problem

    I created a SIS of my application in order to distribuite it.

    When I install it on a E61 phone in the Phone Memory (same as Python Runtime) the application works fine.

    But when I install it on a E65 in the Memory Card (same as Python Runtime) I cannot able to display the image.
    I got this error:
    Code:
    File "ext\amaretto\graphics\src\graphics.py", line 85, in open ... KErrPathNotFound
    I used PyS60 Application Packager with following settings:

    - Script directory: mydir
    - Additional options: --extrasdir=extras

    Where mydir has following subdirectories tree (including mydir):
    mydir\extras\data\python

    In "python" folder I put the scripts to import

    In "mydir" folder I put "default.py" and the image "logo.gif".

    In "default.py" I have following code:

    Code:
    sys.path.append("e:\\data\\python") 
    sys.path.append("e:\\sys\\bin")
    import graphics
    ...
    self.logo_img = graphics.Image.open("logo.gif")
    Can anybody help me?

    Thank you
    Giovanni

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: Image path problem

    Quote Originally Posted by launch View Post
    When I install it on a E61 phone in the Phone Memory (same as Python Runtime) the application works fine.
    Usually SIS releases work ok, when installed on same disk as python runtime. While they are on different drives, mysterious problems appears. It's a known defect (with PyS60 users), reason is unknown, undebugged and not reported against 1.9.x branch == not going to be fixed, until someone reports it with good enough data to allow reproduction by PyS60 dev team.

    Quote Originally Posted by launch View Post
    KErrPathNotFound
    ...
    In "mydir" folder I put "default.py" and the image "logo.gif".
    Code:
    sys.path.append("e:\\data\\python") 
    sys.path.append("e:\\sys\\bin")
    import graphics
    ...
    self.logo_img = graphics.Image.open("logo.gif")
    Your sys.path doesn't seem to include "mydir", therefore the logo.gif would not be found. Try putting all files in same directory and use this code:

    Code:
    # Find "current directory"
    FILE_PATH = None
    import sys, os
    try:
        raise Exception
    except Exception:
        FILE_PATH = os.path.dirname(sys.exc_info()[2].tb_frame.f_code.co_filename)
    if not FILE_PATH:
        FILE_PATH = os.getcwd()
    FILE_PATH = FILE_PATH + "\\"
    
    my_logo = graphics.Image.open(FILE_PATH + u"logo.gif")
    Cheers,

    --jouni

Similar Threads

  1. File Connection path problem
    By javadev2 in forum Mobile Java Networking & Messaging & Security
    Replies: 5
    Last Post: 2007-10-30, 17:52
  2. Opening a JPEG Image
    By ummarbhutta in forum Mobile Java Media (Graphics & Sounds)
    Replies: 8
    Last Post: 2007-02-15, 06:34
  3. Image Problem
    By Spider_Eg in forum Mobile Java General
    Replies: 2
    Last Post: 2007-01-30, 13:52
  4. how to cut some part of Image
    By mshouab in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2006-08-04, 09:05
  5. Nokia Image Converter
    By davidpurdie in forum General Development Questions
    Replies: 0
    Last Post: 2004-02-18, 15:31

Posting Permissions

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