← 输入框|github.com|刷新
Skip to content

break on Windows( #80

Closed
Closed

Description

@darvin

My fork is brocken on windows

Process TurtleProcess-1:
Traceback (most recent call last):
  File "C:\Python27\lib\multiprocessing\process.py", line 232, in _bootstrap
    self.run()
  File "C:\Documents and Settings\Admin\╠юш фюъєьхэЄ√\PythonTurtle\src\turtleprocess.py", line 64, in run
    self.turtle = Turtle()
  File "C:\Documents and Settings\Admin\╠юш фюъєьхэЄ√PythonTurtle\src\animals.py", line 99, in __init__
    self.position = Vector(self._get_random_position())
  File "C:\Documents and Settings\Admin\╠юш фюъєьхэЄ√PythonTurtle\src\animals.py", line 129, in _get_random_position
    if not cls.is_interliaced(pos):
  File "C:\Documents and Settings\Admin\╠юш фюъєьхэЄ√\PythonTurtle\src\animals.py", line 135, in is_interliaced
    size = Vector(cls._get_image().GetSize())/2
  File "C:\Documents and Settings\Admin\╠юш фюъєьхэЄ√\PythonTurtle\src\animals.py", line 160, in _get_image
    wx.Bitmap(from_resource_folder(Animal.image+".png"))
  File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_gdi.py", line 561, in __init__
    _gdi_.Bitmap_swiginit(self,_gdi_.new_Bitmap(*args, **kwargs))
PyNoAppError: The wx.App object must be created first!

Activity

  1. darvin commented on Oct 1, 2010

    @darvin
    Author

    it becouse use of wx function before wx.App... strange behavoir

  2. cool-RR commented on Oct 1, 2010

    @cool-RR
    Member

    (When pasting multiline code such as this, please indent the whole thing. (Add 4 spaces before each line.) This makes it get rendered properly. This time I did it for you.)

    Are you familiar with the differences in the way multiprocessing operates on Windows in contrast to Linux/Mac? In Linux/Mac it uses fork, but in Windows it launches a new process with its own memory space. So all the objects you created in the original process are unaccessible.

    Why does this matter here?

    In wxPython, before you can do anything you gotta create a wx.App. This includes creating bitmap. I get the impression that you're trying to create a bitmap in the turtle process, and because our wx.App exists only in the original process, it fails.

    How can this be solved?

    I think the best solution would be to avoid creating bitmaps in the turtle process. It doesn't draw them anyway. It should tell the main process which bitmaps to draw, but it shouldn't be creating any of these bitmaps itself.

  3. darvin commented on Oct 1, 2010

    @darvin
    Author

    i hate windows. i will fix it thanks for explanation.
    i hate windows

  4. darvin commented on Oct 1, 2010

    @darvin
    Author

    done

  5. darvin commented on Oct 1, 2010

    @darvin
    Author

    done close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions