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

Re: [pygame] I\'m getting BSOD while using PyGame.



I snipped out a bunch of your code fixes from this reply, except where
I didn't understand them.

> > The code was \"x = ones( ( 3, 4 ) )\"
>
> Not enought context to tell wat was going . What is \'ones\' ?

That was a function from PyNum module, following the tutorial. It's
supposed to initialize a 3x4 matrix/array with the value '1'. But
removing PyNum lib didn't stop the BSOD ( and sometimes just a full
freeze, no BSOD, but nothing responds, requiring a reboot )

I tested the exact same code that causes a crash on another computer.
As far as I can tell, they both have the exact version of Python and
PyGame installed. The 2nd computer does not crash at all.

I'm using default values for my surfaces ( meaning they are software,
no hardware accel, no OpenGL ). Just regular blit's.

I am able to get the same program written in c++ using libSDL to work
on both computers, with no crashing.

The one that it does crash, sometimes crashes playing other games, but
it's not very frequent. And if they crash, it is rarely a BSOD. ( And
those games even use 3D accel, ie: teamfortress 2 )

I have updated to my latest video driver, and have been trying newer
BIOS drivers. This is the only game that has a 100% BSOD rate ( on one
computer, but not the other. )

> >                 # ... code ...
> >
> >                 # blit it
> >                 self.screen.blit( self.tileset, dest_rect, src_rec )
>
> seems ok, if self.tileset is initialized to a pygame surface anywhere

Yes. It is also blitting correctly. Sometimes for multiple seconds
before a crash, at many renders a second.

> >     def __init__(self, cols, rows):
> >         \"\"\"Initialize array size [cols][rows]\"\"\"
> >         self.resize(cols, rows)
> >
> >     def resize(self, cols, rows):
> >         \"\"\"resize array, works same way as constructor arguments\"\"\"
> >         # populate: None\'s
> >         self.__rows = rows
> >         self.__cols = cols
> >         self.__data = [ [None for row in range(rows)] for col in
> > range(cols)
> > ]
>
> Why the names begins with \'__\'  ? Usually its only used to hide members.
> To the readers convey the sense  \'We play tricks with this members, dont touch\'

I'm new to python, I think prefixing a variable with "__" declares it
as a private member. I did that so __rows, __cols, wouldn't be
accidently modified. I now know from your snippet below that I can
remove them all together, and use a len() call instead.

> >     def get(self, x, y):
> >         \"\"\"get the value at the offset
> >
> >         for now, if invalid bounds, then return None\"\"\"
> >         if self.validIndex( x, y ):
> >             return self.__data[x][y]
> >         return None # maybe throw exception? Haven\'t learned about them
> > yet.
> >
> >     def set(self, x, y, value):
> >         \"\"\"set the value at the offset
> >
> >         for now, if invalid bounds, then return None\"\"\"
> >         if self.validIndex( x, y ):
> >             self.__data[x][y] = value
> >         # todo: else throw exception / error but doesn\'t need to halt
> > program.
>
> Returns None any time

I don't understand what you mean? In a stand alone test and in the
game the .get() and set() are returning the value, except if the index
is out of bounds.

-- 
Jake