[pygame] Re: pygame.error: Cannot set 0 sized display mode

2012-10-16 Thread Peter Chant
Al Sweigart al@... writes:

 
 
 hey Pete,It might be a change for with a different version of Pygame.
 I never thought that passing (0, 0) for the resolution would work. I
 suppose before it was using a default resolution for you. (Though 
the fullscreen mode stretches the display sometimes, if you give it
 a small resolution. I'm not sure about the specific details though.)
 I'd go ahead and just pass (1280, 1024), since I think it is idea 
to pass an actual resolution.Alternatively, after executing import
 pygame and pygame.init(), you can check the value in
 pygame.display.Info().current_w and 
pygame.display.Info().current_h for the current screen resolution,
 and then pass these values to set_display(). Then 
the program will run at the current resolution no matter what
 computer it is run on.-Al

According to the documentation, and the earlier behavior of the script
passing (0,0) should indeed set the size of the display to the full
screen resolution. If I hard-coded in (1280,1024) I successfully set
the screen size.  However, later in the script I was using an object
created by pygame.display.info - it complained when I tried to use
current_w that that property did not exist.  So I
don't think your plan would work.










[pygame] pygame.error: Cannot set 0 sized display mode

2012-10-14 Thread Peter Chant
Hello,

I have a python application that I have written with pygame that used to work 
fine.  However, on upgrading to slackware 14 I get the following error:

pygame.error: Cannot set 0 sized display mode


Slackware uses SDL 1.2.14 - so I cannot see why I am getting that error.  The 
offending line of code, which used to work fine is:

self.window = pygame.display.set_mode((0,0),pygame.FULLSCREEN)

It is fine if I pass a resolution of (1280,1024), my screen resolution.  I 
note however that later in the program an object created with 
pygame.display.info fails - current_w does not exist.  Any idea what is wrong, 
or better still, how I may fix it?  

Pete



Re: [pygame] pygame parachute and inconsistent interned sting state - but only on Slackware 13.0 32 bit

2009-09-16 Thread Peter Chant
On Wednesday 16 September 2009, René Dudfield wrote:
 I guess the next step is to try and put print debugging in.

 You start by putting a few print statements in, and see where it gets
 up to.  Then you refine until you get really close to it... doing a
 binary search of your source until you find the place/places that make
 it crash.


D'oh so obvious.  What I regularly do whilst developing things, but not when 
bugs suddenly appear.

FOUND IT!
 self.screen.blit(clear,(0,0))


 - look for the exclamation marks

def clearScreen(self):
print In clearScreen
print About to call pygame.display_get_surface()
clear = pygame.display.get_surface()
print About to fill surface to clear it
clear.fill((0,0,0))
print About to self.screen.blit -  this crashes
self.screen.blit(clear,(0,0))
print just blitted - ! does not get to here


self.screen is initialised by the output of another class.
  self.screen = h.screen

in class h 

  self.screen=pygame.display.get_surface()


Only fails on 32 bit Slack 13.0.




 cheers,

 On Tue, Sep 15, 2009 at 11:56 PM, Peter Chant p...@petezilla.co.uk wrote:
  On Friday 11 September 2009, René Dudfield wrote:
  ah.  that stack trace doesn't show where the problem is... looks like
  the stack is getting corrupted.
 
  Any thoughts on what next?  My next move, in the abscence of any better
  plan is to try to downgrade the version of python used in slack 13.0 to
  that used in slack 12.2 - as everything works in 12.2.  This does not
  find the bug but it gets me up and running.
 
  Pete
 
 
  --
  Peter Chant
  http://www.petezilla.co.uk


-- 
Peter Chant
http://www.petezilla.co.uk


Re: [pygame] pygame parachute and inconsistent interned sting state - but only on Slackware 13.0 32 bit

2009-09-16 Thread Peter Chant
Thank to Rene, Claudio and Brian,

On Wednesday 16 September 2009, Brian Fisher wrote:
 Well that looks like a very complicated way to clear the screen, which also
 involves blitting a surface to itself (you are blitting the
 pygame.display.get_surface() to the pygame.display.get_surface() after
 clearing the surface)


Claudio said much the same thing.  I must admit it looked over complicated 
when I put it in the email.  This is my roughly my second attempt at something 
non-trivial with python so I am very much a learner.  

 The symptoms of your original bug report seem remarkably similar to a bug
 that existed in SDL with blitting a surface to itself due to a change in
 gcc 4.0 (it stopped restoring the direction flag). The exact problem in
 that case was that the SDL code to blit a surface to itself was special
 cased, and that special case assumed the direction flag was cleared when it
 did a rep movsb. But since it wasn't with the new gcc, if the direction
 flag had been set elsewhere, then the copy went in the other way and either
 corrupted memory, resulting in that string state error message, or crashed

Slack 13.0 64 bit:  gcc 4.3.3   sdl  1.2.13
Slack 13.0 32 bit:  gcc 4.3.3   sdl  1.2.13
Slack 12.0 (32 bit only)gcc 4.2.4   sdl  1.2.13


 I don't recall how that old bug was (or was not) resolved for pygame, but
 there is history on that bug on the list archive.

 Lenard probably remembers it much better than me.

 ... but you could also fix this by replacing thatvery  convoluted
 clearScreen body with a simple self.screen.fill((0,0,0))

Yes, works, I also ought to put that function somewhere more sensible as 
well...

Thanks All,

Pete
-- 
Peter Chant
http://www.petezilla.co.uk


Re: [pygame] pygame parachute and inconsistent interned sting state - but only on Slackware 13.0 32 bit

2009-09-11 Thread Peter Chant
/data/home/pete/.kde/share/config/gtkrc',
 
'DISPLAY': ':0.0', 'MAIL': '/var/spool/mail/pete', 'LS_COLORS': 
'no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.bat=01;32:*.BAT=01;32:*.btm=01;32:*.BTM=01;32:*.cmd=01;32:*.CMD=01;32:*.com=01;32:*.COM=01;32:*.dll=01;32:*.DLL=01;32:*.exe=01;32:*.EXE=01;32:*.7z=01;31:*.ace=01;31:*.arj=01;31:*.bz2=01;31:*.cpio=01;31:*.deb=01;31:*.dz=01;31:*.gz=01;31:*.jar=01;31:*.lzh=01;31:*.lzma=01;31:*.rar=01;31:*.RAR=01;31:*.rpm=01;31:*.rz=01;31:*.tar=01;31:*.taz=01;31:*.tb2=01;31:*.tbz2=01;31:*.tbz=01;31:*.tgz=01;31:*.tlz=01;31:*.trz=01;31:*.txz=01;31:*.tz=01;31:*.tz2=01;31:*.xz=01;31:*.z=01;31:*.Z=01;31:*.zip=01;31:*.ZIP=01;31:*.zoo=01;31:*.aac=00;35:*.anx=01;35:*.asf=01;35:*.ASF=01;35:*.au=00;35:*.axa=00;35:*.axv=01;35:*.avi=01;35:*.AVI=01;35:*.bmp=01;35:*.BMP=01;35:*.flac=01;35:*.FLAC=01;35:*.gif=01;35:*.GIF=01;35:*.jpg=01;35:*.JPG=01;35:*.jpeg=01;35:*.JPEG=01;35:*.m2a=01;35:*.M2A=01;35:*.m2v=01;35:*.M2V=01;35:*.m4a=01;35:*.M4A=01;35:*.m4p=01;35:*.M4P=01;35:*.m4v=01;35:*.M4V=01;35:*.mid=00;35:*.midi=00;35:*.mka=00;35:*.mov=01;35:*.MOV=01;35:*.mp3=01;35:*.MP3=01;35:*.mp4=01;35:*.mp4v=01;35:*.mpc=01;35:*.MPC=01;35:*.mpeg=01;35:*.MPEG=01;35:*.mpg=01;35:*.MPG=01;35:*.nuv=01;35:*.oga=00;35:*.ogv=01;35:*.ogx=01;35:*.ogg=01;35:*.OGG=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.PNG=01;35:*.ppm=01;35:*.qt=01;35:*.ra=00;35:*.ram=01;35:*.RAM=01;35:*.rm=01;35:*.RM=01;35:*.spx=00;35:*.svg=01;35:*.svgz=01;35:*.tga=01;35:*.TGA=01;35:*.tif=01;35:*.TIF=01;35:*.tiff=01;35:*.TIFF=01;35:*.vob=01;35:*.wav=01;35:*.WAV=01;35:*.wma=01;35:*.WMA=01;35:*.wmv=01;35:*.WMV=01;35:*.xbm=01;35:*.xcf=01;35:*.xpm=01;35:*.xspf=00;35:*.xwd=01;35:*.XWD=01;35:',
 
'KDE_MULTIHEAD': 'false'}
working_dir:  /usr/lib64/python2.6/site-packages/pygame-1.9.1release-py2.6-
linux-x86_64.egg/pygame
return (top 5 lines):
loading pygame.tests.midi_test


--
Ran 404 tests in 33.973s

FAILED (errors=2)

bash-3.1$



 Are you using any other modules apart from pygame?  Since pygame
 displays that error message, even though the crash is caused by other
 modules.


subprocess and os.



 cheers,

Thanks.


-- 
Peter Chant
http://www.petezilla.co.uk


Re: [pygame] pygame parachute and inconsistent interned sting state - but only on Slackware 13.0 32 bit

2009-09-11 Thread Peter Chant
On Friday 11 September 2009, René Dudfield wrote:
 ah.  that stack trace doesn't show where the problem is... looks like
 the stack is getting corrupted.

 yeah, having your own select module is a problem.  Since the select
 module is a python one that other python modules use.  It's an
 annoying problem with the python module system :(

Hmm.  I'm fairly new to python.  I was trying to work out if modules ran 
similarly to namespaces.


 So can you try renaming your module, and see if that fixes the problem?

Yes, but guess what the answer is, no luck.  I renamed select.py pselect.py 
and housekeeping.py phousekeeping.py.

Pete

-- 
Peter Chant
http://www.petezilla.co.uk


Re: [pygame] pygame parachute and inconsistent interned sting state - but only on Slackware 13.0 32 bit

2009-09-10 Thread Peter Chant
On Thursday 10 September 2009, René Dudfield wrote:

 to debug it, people would need some code to try and reproduce it.

René, sorry, I'm not really a C hacker so I'm not quite sure what you'd want.  
Sample code could be tricky.  The machine where I developed the code runs it 
without issue.  It only falls over when installed on my media PC running 
Slackware 13.0 32 bit, and a virtualbox machine running the same OS.  64 bit 
slack and 12.2 32 bit slack is fine.  For that reason I don't know what the 
problematic line of code is that causes the error.


 Do example programs work?
 eg.
 python -m pygame.examples.chimp


chimp OK
aliens OK
arraydemo OK
blend_fill OK
blit_blends OK
camera - no camera!
chimp OK
cursors - bit confused by that one, but no crash
eventlist OK
fastevents OK
fonty ABORTED
glcube OK 
headless_no_window - not sure, think it wants and image
liquid OK
mask - no images available to test
midi - don't think I have midi running on test virtual machine
moveit OK
movieplayer - no movies on virtual machine
oldalien OK
overlay - don't understand demo
pixelarray OK
scaletest - no images to scale
scrap_clipboard - don't understand example
scroll OK
sound - example did not complain, but I have not got sound on virtual machine
sound_array_demos - ditto
stars OK
testsprite OK
vgrade - This example requires Numeric and the pygame surfarray module

No failures like the one I am seeing.  Happy to re-run the tests that I did 
not manage to do in the quick run through above.



 Have you run it with gdb?  Is there a stack trace?
 $ gdb python
 (gdb) run main.py
 (gdb) where


Here we go.  Had to modify script slightly to stop it going fullscreen and 
locking me out, but that makes no difference to the crash I beleive.  Not sure 
if this helps. 

(gdb) run pslide.py
Starting program: /usr/bin/python pslide.py
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[New Thread 0xb7c596c0 (LWP 3119)]
(no debugging symbols found)
(no debugging symbols found)
housekeeping
select
__main__
[New Thread 0xb7303b90 (LWP 3120)]
[New Thread 0xb6ac5b90 (LWP 3121)]
Output:  . ['pslide-old2.pyc', 'pslide-old.py', 'pvideo.pyc', 'audio.pyc', 
'paudio.
py', '__init__.py', 'pslide.py', 'audio.py', 'pslide-old2.py', 
'housekeeping.pyc',
'pslide-old.pyc', 'pslide.pyc', 'main.py', 'select.pyc', '__init__.pyc', 
'paudio.py
c', 'housekeeping.py', 'select.py', 'pvideo.py', 'main.pyc']
Fatal Python error: Inconsistent interned string state.

Program received signal SIGABRT, Aborted.
[Switching to Thread 0xb7c596c0 (LWP 3119)]
0xb7c86456 in raise () from /lib/libc.so.6
(gdb)




-- 
Peter Chant
http://www.petezilla.co.uk


Re: [pygame] pygame parachute and inconsistent interned sting state - but only on Slackware 13.0 32 bit

2009-09-10 Thread Peter Chant
On Thursday 10 September 2009, Peter Chant wrote:
 On Thursday 10 September 2009, René Dudfield wrote:
  to debug it, people would need some code to try and reproduce it.

 René, sorry, I'm not really a C hacker so I'm not quite sure what you'd
 want. Sample code could be tricky.  The machine where I developed the code
 runs it without issue.  It only falls over when installed on my media PC
 running Slackware 13.0 32 bit, and a virtualbox machine running the same
 OS.  64 bit slack and 12.2 32 bit slack is fine.  For that reason I don't
 know what the problematic line of code is that causes the error.


By reference ot C hacker I meant I'm not any good with gdb!  I can of course 
supply my code in an egg, but there is too much to put here.


 Fatal Python error: Inconsistent interned string state.

 Program received signal SIGABRT, Aborted.
 [Switching to Thread 0xb7c596c0 (LWP 3119)]
 0xb7c86456 in raise () from /lib/libc.so.6
 (gdb)

If glibc is relevent I note that slack 13.0 is using the following source for 
libc (I think):

glibc-2.9-20090316.tar.bz2

Pete


-- 
Peter Chant
http://www.petezilla.co.uk


Re: [pygame] pygame parachute and inconsistent interned sting state - but only on Slackware 13.0 32 bit

2009-09-09 Thread Peter Chant
On Saturday 05 September 2009, Peter Chant wrote:


 Fatal Python error: Inconsistent interned string state.

I've also reproduced this by installing my app on a fresh installation of 
Slackware 13.0 32 bit running on VirtualBox.

Pete


-- 
Peter Chant
http://www.petezilla.co.uk


[pygame] pygame parachute and inconsistent interned sting state - but only on Slackware 13.0 32 bit

2009-09-05 Thread Peter Chant
Any thoughts on how to resolve this one:

Application I am producing, works fine on Slackware 12.2 (32 bit), Slackware 
13.0 (64 bit) but when running on Slackware 13.0 32 bit I get the following, 
depending on what parts of the application I call:

more pygame_error*   (2 files with errors in)
::
pygame_error1
::
Fatal Python error: (pygame parachute) Segmentation Fault
::
pygame_error2
::
Fatal Python error: Inconsistent interned string state.


Note, I am building the application using setuptools, so I can call bits 
different ways.  


Python is version 2.6.2 and pygame is pygame-1.9.1release.

Note, firstly setuptools automagically installed pygame, but when I had 
problems I downloaded it and built it to see if that made a difference.

Pete

-- 
Peter Chant
http://www.petezilla.co.uk


Re: [pygame] Shutting down the video screen

2009-08-17 Thread Peter Chant
On Friday 14 August 2009, René Dudfield wrote:
 hi,

 you can call eg pygame.display.quit()


Similar question from myself.  Any way of just temporarily hiding the display 
and then restoring it later?

I.e. a hypothetical:

pygame.display.hide()

#Do some stuff
.
.
.

pygame.display.unhide()

?

Or do I quit and then re-initialise the display?

Thanks,

Pete



-- 
Peter Chant
http://www.petezilla.co.uk


Re: [pygame] Pygame font issues

2009-05-04 Thread Peter Chant
On Sunday 03 May 2009, René Dudfield wrote:
 heh, I guess not.

 It'd be good to report to slackware.  Please let me know if you do...
 otherwise I'll report the bug.

Its not an official slackware package.  I've reported it to its source, 
slacky.eu, a large established repository run by Italian slackers.



-- 
Peter Chant
http://www.petezilla.co.uk


Re: [pygame] Pygame font issues

2009-05-03 Thread Peter Chant
On Sunday 03 May 2009, René Dudfield wrote:
 hi,

 what are the permissions of the font file?  Maybe something weird is
 going on there?

Bingo.

the default font was set to 700, set it to 644 and it worked.  Sounds like a 
pygame installation issue, but then if it is surely someone else would have 
spotted it by now?

Pete


-- 
Peter Chant
http://www.petezilla.co.uk


Re: [pygame] Pygame font issues

2009-05-02 Thread Peter Chant
On Friday 01 May 2009, Jake b wrote:
 1) Are you using py2exe?


No.

 2) Copy-ing the font to the same folder as the game will probably work.


Unfortuately it did not.

 3) I ripped out my font name matching code, it might help. [It might
 be easier if you want the whole font wrapper class.]


Thanks.  I'm not sure that it does.  You've created a wrapper, which does some 
useful checking, but at the end of the day it still appears to make a simple 
call with a font name.

font = pygame.font.Font(None, 36)
#font = pygame.font.Font('liberationserif',36)

I suspect it is a path problem, but I'm new to python and am not really sure 
how to fix it.  In fact, I have just found that if I pass the file path it 
does not throw an error.

Unfortunately I still have not got test displayed for other reasons I am just 
learning.  However, it is a sunny day so perhaps I ought to take advantage of 
it.

Pete






-- 
Peter Chant
http://www.petezilla.co.uk


Re: [pygame] Pygame font issues

2009-05-02 Thread Peter Chant
On Saturday 02 May 2009, Yanom Mobis wrote:
 does

 font = pygame.font.Font(None, 36)

 use the player's default system font?

None does not work:

self.font = pygame.font.Font(None,36)
RuntimeError: default font not found 'freesansbold.ttf'

its looking for freesansbold, which even though it exists, can't be found:

bash-3.1$ locate freesansbold.ttf
/usr/lib/python2.5/site-packages/pygame/freesansbold.ttf

Note, I think your reference to default systems font is a windows reference.  
I'm on linux.

Pete



-- 
Peter Chant
http://www.petezilla.co.uk