Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    27

    Unhappy Using miso package

    Hi Guys!

    Some stuff that you should know firstly:-

    1. Using a N95 that has a 1gb memory card (i.e. not 8gb model)
    2. I have python installed on the phone memory(not memory card)
    3. I have the graphics package for images also installed on the phone memory.
    4. The script I have written is on the memory card ("e:\python" is the directory.
    5. Scripts that have been converted to apps (by someone else) work on the phone memory and can use the miso package.

    All I am trying to do is to get the image of a map to display on the screen. When I run the script I get an error saying that "graphics" cannot be found!


    Is there a security reason or something which means that my script on the memory card cannot use the miso package installed on the phone memory?? How would I go about getting my script to work?

    Thanks in Advance.
    Last edited by Davie1; 2008-10-24 at 13:02.

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Using miso package

    Quote Originally Posted by Davie1 View Post
    All I am trying to do is to get the image of a map to display on the screen. When I run the script I get an error saying that "graphics" cannot be found!


    Is there a security reason or something which means that my script on the memory card cannot use the miso package installed on the phone memory?? How would I go about getting my script to work?
    Hi,

    There shouldn't be any problem if your script is on the memory card. It would help if you told us the exact error you're getting. Exactly as it is displayed.

    Have you imported the graphics module?

  3. #3
    Super Contributor
    Join Date
    Feb 2008
    Location
    Belo Horizonte, Brazil
    Posts
    744

    Re: Using miso package

    I think you shall use misty module instead of miso on 3rd Edition. I have used it several times and it works perfectly. Here are the links for downloading misty from Cyke64's page:

    Misty self signed infinite

    Misty unsigned

    Enjoy,

    Rafael.

  4. #4
    Registered User
    Join Date
    Oct 2008
    Posts
    27

    Re: Using miso package

    This is the script =
    Code:
    import appuifw, e32, graphics
    
    canvas=appuifw.Canvas()
    appuifw.app.body=canvas
    
    #Open the image of the map
    im = graphics.Image.open("e:\python\maps\glasgow.gif")
    
    #Display the image of the map
    canvas.blit(im)
    
    app_lock=e32.Ao_lock()
    app_lock.wait()
    The error that is being displayed is
    img = IMage(_graphics.ImageOpen(unicode(filename),finish_load))
    SymbianError: [Errno -1]
    KErrNotFound

    I am in the process of testing the misty package. Thank you for your help!

  5. #5
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Using miso package

    Are you sure you have "glasgow.gif" in the folder "e:\python\maps"? KErrNotFound occurs when a file cannot be found.

  6. #6
    Super Contributor
    Join Date
    Feb 2008
    Location
    Belo Horizonte, Brazil
    Posts
    744

    Re: Using miso package

    Yes, the error says that Python couldn't find the file. Please check if this file really exists in the path E:\Python\maps. The script seems to be ok, though.


    BR,

    Rafael.

  7. #7
    Registered User
    Join Date
    Oct 2008
    Posts
    27

    Re: Using miso package

    Yes I have checked that the file path to the image is correct, which it is.

    Is it possible that the image may be too big? It's current size is 250 x 155

  8. #8
    Super Contributor
    Join Date
    Feb 2008
    Location
    Belo Horizonte, Brazil
    Posts
    744

    Re: Using miso package

    Quote Originally Posted by Davie1 View Post
    Yes I have checked that the file path to the image is correct, which it is.

    Is it possible that the image may be too big? It's current size is 250 x 155
    Yes, the image is really too big, since N95 has a 240 x 320 diplay. Try to reduce image's size and test it again.


    BR,

    Rafael.
    Last edited by Rafael T.; 2008-10-26 at 17:17.

  9. #9
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Using miso package

    Actually it shouldn't matter. If the image is too big it will be displayed partially (meaning as much of it as fits on the screen).

    Oh and Rafael:

    Quote Originally Posted by Davie1 View Post
    1. Using a N95 that has a 1gb memory card (i.e. not 8gb model)

  10. #10
    Super Contributor
    Join Date
    Feb 2008
    Location
    Belo Horizonte, Brazil
    Posts
    744

    Re: Using miso package

    Thanks for correcting, Bogdan. Fortunately, the screen resolution is the same in the two phones

    The image size really shouldn't matter. By the way, I did a test with this some days ago and it worked. But he should try to resize it anyway Probably the error will persist, but I would try it ...

    Have you also tried putting the file in any other folder?


    BR,

    Rafael.

  11. #11
    Registered User
    Join Date
    Oct 2008
    Posts
    27

    Re: Using miso package

    I have tried putting it in another folder and the error persists.

    I actually need an image that is too big for the screen as I am researching ways of showing the user that a location they are interested in is off screen.

  12. #12
    Super Contributor
    Join Date
    Feb 2008
    Location
    Belo Horizonte, Brazil
    Posts
    744

    Re: Using miso package

    Yes, this is not a problem. Just open the image and set the coordenate it will start at using canvas:

    Code:
    import graphics, key_codes
    
    x = -200.0
    y = -80.0
    img = 'E:\\Images\\test.jpg'
    
    def refresh():
    
        canvas.blit(img, target=(x,y))
    Then, for moving the image you have to create functions:

    Code:
    def move_up():
        global x
        global y
        y-=3
        refresh()
    
    def move_down():
        global x
        global y
        y+=3
        refresh()
        
    def move_left():
        global x
        global y
        x-=3
        refresh()
    
    def move_right():
        global x
        global y
        x+=3
        refresh()
    And finally set the keys for moving:

    Code:
    canvas.bind(key_codes.EKeyUpArrow, move_up)
    canvas.bind(key_codes.EKeyDownArrow, move_down)
    canvas.bind(key_codes.EKeyLeftArrow,  move_left)
    canvas.bind(key_codes.EKeyRightArrow, move_right)
    But I guess you have to find a way to open this image first, since you're getting KErrNotFound for some reason. Although, this might support you after opening the file.


    Hope it helps,

    Rafael.

  13. #13
    Registered User
    Join Date
    Oct 2008
    Posts
    27

    Re: Using miso package

    Thanks for your help guys. Fixed the problem and the image is displaying fine.

Similar Threads

  1. Problems about maemo 4.0.1 SDK installation.
    By fgg_maemo in forum General Development Questions
    Replies: 3
    Last Post: 2008-10-07, 14:26
  2. Replies: 0
    Last Post: 2008-02-14, 11:27
  3. WMA package
    By k_salil in forum Mobile Java General
    Replies: 1
    Last Post: 2004-06-07, 09:50
  4. Creting Application package fileNotFound error
    By pid0101 in forum Mobile Java General
    Replies: 0
    Last Post: 2004-01-19, 20:55
  5. Magical Nokia package creation
    By SpaceCowboy in forum Mobile Java General
    Replies: 1
    Last Post: 2003-08-11, 21:32

Posting Permissions

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