[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] [BUG] pygame-ctypes -- various from Phil



Alex,

Thanks for all the fixes.  Here's another round of bugs for ya :)
(btw got svn fixed for pyweek2 game)

As a summary:
- i think tga loading is still not working (about 3 games)
- pygame.transform.rotozoom doesn't work all the time (ld484, some other game)
- i'm missing /usr/lib/python2.4/site-packages/pygame/freesansbold.ttf (tronbot)
- something is causing a "Illegal instruction" crash (see pyweek2)

On the plus site:
- your RW ops for sound work!  very impressive!  (py64 music generator works)
- pgu.gui appears to work now, great!

Details follow:

svn co svn://www.imitationpickles.org/anathema/trunk
-- on falling into a pit --

  File "anathema.py", line 924, in state_death_pit
    img = pygame.transform.rotozoom(s,15,0.92)
  File "/usr/lib/python2.4/site-packages/pygame/transform.py", line 339, in rotozoom
    image = _to_PIL(surf, data)
  File "/usr/lib/python2.4/site-packages/pygame/transform.py", line 113, in _to_PIL
    raise ValueError, 'Unsupported pixel format' # TODO convert
ValueError: Unsupported pixel format

svn co svn://www.imitationpickles.org/chestival/trunk
-- on start of game --
(looks like it might be the tga issue)

Traceback (most recent call last):
  File "chestival.py", line 80, in ?
    game.run(intro.Main(game))
  File "/home/phil/code/chestival/pgu/engine.py", line 40, in run
    self.loop()
  File "/home/phil/code/chestival/pgu/engine.py", line 48, in loop
    if self.fnc('loop'): return
  File "/home/phil/code/chestival/pgu/engine.py", line 25, in fnc
    else: r = f()
  File "/home/phil/code/chestival/level.py", line 150, in loop
    c = self.hairs.diffs[0]*100/self.hairs.total[0]
ZeroDivisionError: integer division or modulo by zero

svn co svn://www.imitationpickles.org/dynamite/trunk
-- on beating training level 2 --

Illegal instruction

svn co svn://www.imitationpickles.org/pgu/trunk
-- on running examples/tilevid5.py --
Traceback (most recent call last):
  File "tilevid5.py", line 255, in ?
    run(init())
  File "tilevid5.py", line 230, in run
    g.loop()
  File "../pgu/vid.py", line 413, in loop
    self.loop_tilehits() #sprites move
  File "../pgu/vid.py", line 432, in loop_tilehits
    self._tilehits(s)
  File "../pgu/vid.py", line 467, in _tilehits
    t = tiles[layer[yy][xx]]
IndexError: list index out of range

svn co svn://www.imitationpickles.org/py64/trunk
-- on running the game --

  File "main.py", line 139, in init
    screen.blit(pygame.transform.scale(tmp.subsurface(n*SW/2/m,n*SH/2/m,SW-n*SW/m,SH-n*SH/m),(SW,SH)),(0,0))
  File "/usr/lib/python2.4/site-packages/pygame/transform.py", line 189, in scale
    image = _to_PIL(surf)
  File "/usr/lib/python2.4/site-packages/pygame/transform.py", line 113, in _to_PIL
    raise ValueError, 'Unsupported pixel format' # TODO convert
ValueError: Unsupported pixel format

svn co svn://www.imitationpickles.org/pyweek2/trunk
-- on playing a level --

crashes, or levels look wrong.  i think you said this is due to lack of tga support.

svn co svn://www.imitationpickles.org/rustic/trunk
-- on playing a game --

crashes.  i think this is due to lack of tga support.

the tronbot program
svn://www.imitationpickles.org/tronbot/trunk

still fails due to lack of a default font.  i just ran python setup.py install on pygame-ctypes, do i need to do anything else to ensure that this doesn't happen:

  File "/usr/lib/python2.4/site-packages/pygame/font.py", line 125, in __init__
    file = pygame.pkgdata.getResource(_font_defaultname)
  File "/usr/lib/python2.4/site-packages/pygame/pkgdata.py", line 66, in getResource
    return file(os.path.normpath(path), 'rb')
IOError: [Errno 2] No such file or directory: '/usr/lib/python2.4/site-packages/pygame/freesansbold.ttf'

Alex Holkner <aholkner@xxxxxxxxxxxxxx> wrote:
Anyone else here in favour of an issue tracker? ;-)



Phil Hassey wrote:

> Looks like rect needs w support:
>
> File "/usr/lib/python2.4/site-packages/pygame/rect.py", line 145, in
> __getattr__
> raise AttributeError, name
> AttributeError: w

Fixed, thanks.

> pygame.mixer.init(MIX_FREQ, -16, False, 1024)
> causes this error:
>
> File "main.py", line 74, in init
> pygame.mixer.init(MIX_FREQ, -16, False, 1024)
> File "/usr/lib/python2.4/site-packages/pygame/mixer.py", line 174,
> in init
> __PYGAMEinit__(frequency, size, stereo, buffer)
> File "/usr/lib/python2.4/site-packages/pygame/mixer.py", line 95, in
> __PYGAMEinit__
> Mix_OpenAudio(frequency, size, stereo, buffer)
> File "/usr/lib/python2.4/site-packages/SDL/dll.py", line 195, in _f
> raise SDL.error.SDL_Exception, SDL.error.SDL_GetError()
> SDL.error.SDL_Exception: 1 (mono) and 2 (stereo) channels supported

Fixed, thanks.

> svn co svn://www.imitationpickles.org/pyweek2/trunk zanthor

Your SVN repo has no anonymous access. Using
http://www.imitationpickles.org/pyweek2/zanthor.tgz instead.

There is a race condition intro.py:86 causing the intro to crash
intermittently on my machine; workaround by adding "cur = data[0]"
before the loop.

> 1. Some alpha blitting issues in the pre-menu intro, it seems alpha=0
> is getting switched with alpha=255

Fixed, thanks.

> 2. On the main menu, the dancing zanthor's transform.rotated surfaces
> aren't getting alpha for the background, they are getting black.

Fixed, thanks.

After the menu screens, the game doesn't work properly at all with
Pygame-ctypes: crashes for cities 1, 3 and 4 (left to right along the
bottom), and city 2 is "conquered" almost immediately after starting,
and the sprites look quite wrong. I'll look into this later this week,
unless you can track down a more specific problem sooner.

> Looks like no default font got installed...
>
> File "/home/phil/code/tronbot/view.py", line 107, in stats_paint
> fnt = pygame.font.Font(None,h)
> File "/usr/lib/python2.4/site-packages/pygame/font.py", line 125, in
> __init__
> file = pygame.pkgdata.getResource(_font_defaultname)
> File "/usr/lib/python2.4/site-packages/pygame/pkgdata.py", line 66,
> in getResource
> return file(os.path.normpath(path), 'rb')
> IOError: [Errno 2] No such file or directory:
> '/usr/lib/python2.4/site-packages/pygame/freesansbold.ttf'

I can't replicate this.

> It appears that setting the palette makes pygame-ctypes mad:
>
> File "wireworld.py", line 25, in init
>
> pygame.display.set_palette([(0x00,0x00,0x00),(0x00,0x00,0xaa),(0x55,0xff,0xff),(0x55,0x55,0xff)])
> File "/usr/lib/python2.4/site-packages/pygame/display.py", line 700,
> in set_palette
> colors = [SDL_Color(r, g, b) for r, g, b in palette[:length]]
> NameError: global name 'length' is not defined

Not mad, just unhappy :-). Fixed.

> svn co svn://www.imitationpickles.org/chestiva/trunk chestival

Using svn://www.imitationpickles.org/chestival/trunk instead...

> 1. When watching the intro at the end a voice says "Welcome to the
> Hairy Chestival" -- but with pygame-ctypes the voice sample is jittery
> sounding -- the voice says half a syllable and then stops then starts,
> etc..

Can't replicate; probably just performance related.

> 2. On the main menu, there is a line below Quit that is a black box.
> I don't think that was there with normal pygame. Looks like a space
> is getting rendered by the font code or something...

Fixed, thanks.

> It appears that the flags going into convert() are None instead of 0...
>
> File "flames.py", line 12, in __init__
> self.tmp1 = pygame.Surface((w,h+16)).convert(8)
> File "/usr/lib/python2.4/site-packages/pygame/surface.py", line 253,
> in convert
> if flags & SDL_SRCALPHA:
> TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'

Fixed, thanks.

>
> pygame-ctypes just sort of hangs. I'm not sure what is going on, but
> my guess is that it isn't working because I'm passing some
> pygame.Surface's to some custom C code that I made. I use some of the
> macros in pygame.h to decode the structures into SDL_Surfaces in my
> code ...
>
> I suspect this is one area where pygame-ctypes won't be compatible
> with pygame. What changes would I have to make to my code to get it
> to work with pygame-ctypes?

If you call your C code with ctypes, set its argtypes to
[POINTER(SDL_Surface)] and give it mysurface._surf (where mysurface is a
pygame surface).

If you don't want to use ctypes to call your function, and just want a
raw address, use something like pointer(mysurface._surf).value, which
will give you the address of the SDL_Surface. (import * from ctypes and
SDL for these names).

> svn co svn://www.imitationpickles.org/rustic/trunk rustic

> 1. You'll notice that it takes forever to start and moving between
> menu items takes a while. I think this is because of my font code
> which uses get_at and set_at

It's mostly the blit in tilefont:TileFont.render, which is RGBA to
RGBA. If you have Numeric or similar it will use that, otherwise it's a
painful Python loop. The Numeric code is not yet optimised, it should
use in-place operations. For a quick fix, prerender these text strings
in startup.

> (The actual games crash pygame-ctypes, but I think those issues are
> related to some of my other bug reports...)

nibbles: needs TGA support, not yet implemented.
The others are segfaulting in SDL_mixer, this will take some time to
track down.

Thanks for the comprehensive testing so far. These fixes are in r941.

Alex.



How low will we go? Check out Yahoo! Messenger?s low PC-to-Phone call rates.