×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Registered User
    Join Date
    Jul 2009
    Posts
    26

    Question Please Help!!! WSERV 10 Error

    Hello, Everyone,
    I was diving into a map navigation system, and you could pan the map using the left Arrow key, right Arrow key, up Arrow key or down Arrow key. you know, when you pan the map,you will get a new view, and you need to draw some poi(point of interest) icons in this new map view(canvas). But the problem is when you draw the poi icons (*.png format) in the canvas, you will get an error, it reads "Application closed: Python WSERV 10". After several days googling, it suggests that this error results from "trying to activate the already activated graphic context". What does this word mean? could anyone help me? Please see the following code:
    Code:
    import e32
      from graphics import  *
      
      RGB_BACKGROUND=(200,200,200)
      def Pan(type):
         if type == 0:
           Map.PanRight()
           cb_redraw()
         elif type == 1:
           Map.PanUp()
           cb_redraw()
         elif type == 2:
           Map.PanLeft()
           cb_redraw()
         elif type == 3:
           Map.PanDown()
           cb_redraw()
      
      def cb_redraw(dummy=(0,0,0,0)):
         canvas.clear(RGB_BACKGROUND)
         Pois = Map.PoiInfos()
         for Poi in Pois:
           #the poi icon position tuble (x,y)
           position = Poi[0]
           #the poi icon full path name
           fileName = Poi[1]
           #please note that the size of the icon png is 32*37
           img = Image.new((32,37))
           img.load(fileName)
           canvas.blit(img,target=position)
      def cb_quit():
        app_lock.signal()
      
      appuifw.app.exit_key_handler = cb_quit
      canvas = appuifw.Canvas(redraw_callback = cb_redraw)
      canvas.bind(EKeyRightArrow, lambda:Pan(0))
      canvas.bind(EKeyUpArrow, lambda:Pan(1))
      canvas.bind(EKeyLeftArrow, lambda:Pan(2))
      canvas.bind(EKeyDownArrow, lambda:Pan(3))
      app_lock=e32.Ao_lock()
      app_lock.wait()
    I think this error comes from calling those "img.new(),img.load(),and canvas.blit()" methods. So Could anyone help me how to fix this problem? Please help! Thanks you guys in advance.

    Regards
    tao

  2. #2
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: Please Help!!! WSERV 10 Error

    I think you need to specify the file name that you want to load at img.load(filenme),,
    Remove file name and specify the path ..

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

    Re: Please Help!!! WSERV 10 Error

    Quote Originally Posted by rahulvala View Post
    I think you need to specify the file name that you want to load at img.load(filenme),,
    Remove file name and specify the path ..
    Hi, rahulvala, thanks for your reply! The fileName varible refers to the full path string,say,"c:\\python\\icon\\park.png", and it is the absolute path. please let me know, if i did not explain clearly.
    By the way, the application did display the icons, but when you panning the map, the application will be closed suddenly, with the error "WSERV 10 Error". you know, the application is very vulnerable, not so robust?
    Regards
    tao

  4. #4
    Registered User
    Join Date
    Jul 2009
    Posts
    26

    Re: Please Help!!! WSERV 10 Error

    Hi,One more thing to note is when i run this script in the script shell in N97, an error appears, but is different from the error i got in emulator(WSERV 10 Error), It reads "AttributeError:'Image' object has no attribute '_errcode'". Could anyone help me to fix this problem? Many thanks.
    Regards
    tao

  5. #5
    Regular Contributor
    Join Date
    Nov 2007
    Posts
    147

    Re: Please Help!!! WSERV 10 Error

    This might not help but I used to get WSERV 10 when blitting images to canvas that were bigger in resolution than canvas itself. Maybe this is also occurring in your situation?

    Raf
    http://www.bdcsoftware.com/development-blog

  6. #6
    Registered User
    Join Date
    Jul 2009
    Posts
    26

    Question Re: Please Help!!! WSERV 10 Error

    Quote Originally Posted by raf1hh View Post
    This might not help but I used to get WSERV 10 when blitting images to canvas that were bigger in resolution than canvas itself. Maybe this is also occurring in your situation?

    Raf
    Hi, raf1hh, Thanks for your reply. The size of Poi Icon is only 32*37, so it is far less than the canvas size. But in my application, bliting such icons is a high frequency job, you know, when you panning the map, you will load the related icons frequently. The WSERV Error means try to activate the already activated graphics context, you know, in pys60, the image object is also a graphics context, I mean when i load the icon, i just activate it, but did not deactivate it. But how to deactivate it? I could not find any method related to it. Anyway, this is just my guess.
    Regards
    tao

  7. #7
    Regular Contributor
    Join Date
    Nov 2007
    Posts
    147

    Re: Please Help!!! WSERV 10 Error

    Try this:

    Code:
    #please note that the size of the icon png is 32*37
    img = Image.new((32,37))
    img.load(fileName)
    canvas.blit(img,target=position)
    img = None
    del img
    or how about if you keep reusing the same image object?

    Code:
    #please note that the size of the icon png is 32*37
    img = Image.new((32,37))
    for filename in something:
      img.load(fileName)
      canvas.blit(img,target=position)
    img = None
    del img
    http://www.bdcsoftware.com/development-blog

  8. #8
    Registered User
    Join Date
    Jul 2009
    Posts
    26

    Re: Please Help!!! WSERV 10 Error

    Quote Originally Posted by raf1hh View Post
    Try this:

    Code:
    #please note that the size of the icon png is 32*37
    img = Image.new((32,37))
    img.load(fileName)
    canvas.blit(img,target=position)
    img = None
    del img
    or how about if you keep reusing the same image object?

    Code:
    #please note that the size of the icon png is 32*37
    img = Image.new((32,37))
    for filename in something:
      img.load(fileName)
      canvas.blit(img,target=position)
    img = None
    del img
    Hi, raf, thanks for this hint, I will try those codes.
    Regards
    tao

  9. #9
    Registered User
    Join Date
    Jul 2009
    Posts
    26

    Re: Please Help!!! WSERV 10 Error

    Quote Originally Posted by taojia View Post
    Hi, raf, thanks for this hint, I will try those codes.
    Regards
    tao
    Hi, raf, it does not work, still has the same error, "Python error WSERV 10". Anyway, thanks, any other ideals? I still could not fix it, even this error was caused by "try to activate an already activated graphics context".
    Regards
    tao

  10. #10
    Regular Contributor
    Join Date
    Nov 2007
    Posts
    147

    Re: Please Help!!! WSERV 10 Error

    I do remember one more instance of WSERV10 issue:

    In this case, I was getting WSERV10 when using set_list on the listbox object. What was weird was that this part of code worked flawlessly for a few months until I merged some other code into my application that was located in an unrelated part of the app. Removing that code stopped producing WSERV10 error on the listbox.

    The point of this story is that something completely unrelated might be causing this. What I would do if I were you is to move the code that is currently not working to a separate test script (make it as basic as possible) and test that way. If it works, then you know the bug must be caused by something else and the real fun will start ;-).

    Raf
    http://www.bdcsoftware.com/development-blog

  11. #11
    Registered User
    Join Date
    Jul 2009
    Posts
    26

    Smile Re: Please Help!!! WSERV 10 Error

    Quote Originally Posted by raf1hh View Post
    I do remember one more instance of WSERV10 issue:

    In this case, I was getting WSERV10 when using set_list on the listbox object. What was weird was that this part of code worked flawlessly for a few months until I merged some other code into my application that was located in an unrelated part of the app. Removing that code stopped producing WSERV10 error on the listbox.

    The point of this story is that something completely unrelated might be causing this. What I would do if I were you is to move the code that is currently not working to a separate test script (make it as basic as possible) and test that way. If it works, then you know the bug must be caused by something else and the real fun will start ;-).

    Raf
    Hi, raf, your suggestion is a good point for locating the error code. I will try it soon, Thanks for your reply.
    Regards
    tao

  12. #12
    Registered User
    Join Date
    Jul 2009
    Posts
    26

    Re: Please Help!!! WSERV 10 Error

    Sorry we are still stuck by the problem. This problem is occurred while we pan the map, and while new POI has to be added on the screen. However, there is no such a problem if we replace the POI (images) by the corresponding texts. Does it imply an image costs too much resource? What is the real difference between a tiny image and text? What if we treat the image as a text? Your comments are highly anticipated. thanks.

  13. #13
    Registered User
    Join Date
    Jul 2009
    Posts
    26

    Re: Please Help!!! WSERV 10 Error

    Quote Originally Posted by taojia View Post
    Sorry we are still stuck by the problem. This problem is occurred while we pan the map, and while new POI has to be added on the screen. However, there is no such a problem if we replace the POI (images) by the corresponding texts. Does it imply an image costs too much resource? What is the real difference between a tiny image and text? What if we treat the image as a text? Your comments are highly anticipated. thanks.
    Hi, one more experiment is that I replace the poi (*.png) image with the svg vector image, in other words, I do not use the canvas.blit() method to draw the png image, but use other methods (for example, canvas.line(), etc..) to draw the svg image. But unfortunately, the application still failed in this problem!!! Anyone could help? Thanks.

    Regards
    ta0

  14. #14
    Registered User
    Join Date
    Dec 2008
    Posts
    35

    Re: Please Help!!! WSERV 10 Error

    I suggest you try using standard "double-buffering" procedure for drawing on canvas, i. e.:



    1. in function cb_redraw you should draw all your icons on a separate (global) Image object, not on canvas;
    2. you should have a separate handle_redraw function which does only one thing - blits the above mentioned Image object on canvas;
    3. you should set your redraw_callback to be handle_redraw, not cb_redraw.


    Hope this helps.

  15. #15
    Registered User
    Join Date
    Jul 2009
    Posts
    26

    Re: Please Help!!! WSERV 10 Error

    Quote Originally Posted by uhm57 View Post
    I suggest you try using standard "double-buffering" procedure for drawing on canvas, i. e.:



    1. in function cb_redraw you should draw all your icons on a separate (global) Image object, not on canvas;
    2. you should have a separate handle_redraw function which does only one thing - blits the above mentioned Image object on canvas;
    3. you should set your redraw_callback to be handle_redraw, not cb_redraw.


    Hope this helps.
    Hi, uhm57,
    Your suggestion works perfectly!!! I adopt this "double-buffering" technique, and then my problem finally resolved! Thank you very much!!!
    Regards
    tao

Similar Threads

  1. Browser monitoring
    By NevePankaj in forum Symbian
    Replies: 19
    Last Post: 2008-08-12, 10:06
  2. HELP: Interpreter dies with WSERV 10 error
    By raf1hh in forum Symbian
    Replies: 3
    Last Post: 2008-01-14, 08:20
  3. code warrior problems
    By mayankkedia in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 2
    Last Post: 2004-10-25, 06:59
  4. CEikDialog Question
    By AdamBeck in forum Symbian
    Replies: 2
    Last Post: 2004-09-30, 19:40

Posting Permissions

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