Hi DR0ID,

Thanks to charlesej, all of those have a get_init() now.
https://github.com/pygame/pygame/issues/616


On Sat, Nov 10, 2018 at 10:56 AM DR0ID <dr...@bluewin.ch> wrote:

> Hi
>
> Thanks for adding the issue.
>
> ~DR0ID
>
>
> On 10.11.2018 09:42, René Dudfield wrote:
> > Hi,
> >
> > 1)
> > - "all modules without a get_init() should have one if they have a
> > .init()"
> > https://github.com/pygame/pygame/issues/616
> >
> > 3) yeah, there are tools that catch bugs with apps and log them for you.
> >
> > cheers,
> >
> > On Thu, Nov 8, 2018 at 8:15 PM DR0ID <dr...@bluewin.ch
> > <mailto:dr...@bluewin.ch>> wrote:
> >
> >     Hi there
> >
> >     1.) For one of my last projects I have been toying around with
> >     pygame initialization. Instead of using pygame.init() and let it
> >     initialize everything I went through the trouble to initialize
> >     every module. Of course I didn't want to do it manually so I wrote
> >     some code to do it for me. It worked, but I found it to be
> >     inconsistent that certain modules have an init() method but no
> >     get_init(). I would have expected that every module that has an
> >     init() method also should have an get_init(). To have only the
> >     init() method does not make much sense to me. Maybe this could go
> >     into the next refactor version of pygame.
> >
> >     I have attached an snippet from my log indicating in which modules
> >     the get_init() method is missing, see first paragraph in attached
> >     'pygame_init_errors.txt' [1].
> >
> >     2.) I also found that a few modules that have an init() method
> >     raised an error (see second paragraph in attached log). Not sure
> >     if this is due to the way I initialize the modules or it is
> >     because pygame was not compiled with that support. Or my
> >     platform/hardware does not support those.
> >
> >     The code generating the log can be found in the attached
> >     'context_init_pygame.py' [2].
> >
> >     3.) While writing this initialization code I started to wonder if
> >     I should log the capabilities of the system it was running on. And
> >     that would be my next question: I think it would help diagnose
> >     problems if there were some sort of capabilities script that reads
> >     the system/hardware and collects information about it. Maybe it
> >     could later be uploaded to pygame.org <http://pygame.org> (or
> >     somewhere else) anonymously for further analysis. Initialization
> >     and capabilities are not the same but I'm unsure if would make
> >     sense in case the initialization would fail to log the
> >     capabilities. But then it should probably collect a bit more info
> >     than only the display modes, mixer configurations and success full
> >     pygame modules initialization (you probably want to know about the
> >     OS and its version, hardware, etc). But then I'm pretty sure there
> >     are already other tools doing that.
> >
> >
> >     4.) Another thing I noticed in the docs is that certain modules
> >     should (like scrap) or can (like mixer) be initialized after the
> >     display module. Not sure how scrap it initialized when using
> >     pygame.init() since this would be before scrap (maybe scrap has to
> >     be initialized separately? I haven't tried.). This give me the
> >     idea to write a PygameInitializer class (see attached
> >     'pygame_initializer.py' [3] which is a proof of concept) that is a
> >     context manager. So in code it would look like this:
> >
> >
> >     ---- code ----
> >
> >     def main():
> >          logger.info  <http://logger.info>("before pygame init")
> >          with PygameInitializer(env_settings=(('SDL_VIDEO_CENTERED',
> '1'),))as pio:
> >              pio.mixer_frequency =1 pio.mixer_size =1 pio.mixer_channels
> =1 pio.mixer_buffer_size =16 screen = pygame.display.set_mode((800, 600),
> pygame.DOUBLEBUF, 32)
> >              logger.info  <http://logger.info>("set display set mode")
> >
> >          # your application code here logger.info  
> > <http://logger.info>("application
> run!")
> >
> >     ---- end code ----
> >
> >     But then I wondered if it is really worth going through all this
> >     if there is pygame.init().
> >
> >
> >
> >
> >     [1] log: https://bpaste.net/show/53dccc5bd3cf
> >
> >     ---- log snippet ----
> >     #### modules with missing get_init() method but has a init()
> >     method -> no consistency for modules that have an init() method!!
> ####
> >     2566 [MainProcess 15488 MainThread 9212]: INFO initializing module
> >     <module 'pygame._freetype' from
> >
>  '...\\python360\\lib\\site-packages\\pygame\\_freetype.cp36-win_amd64.pyd'>
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(258)]
> >     2567 [MainProcess 15488 MainThread 9212]: INFO init() <module
> >     'pygame._freetype' from
> >
>  '...\\python360\\lib\\site-packages\\pygame\\_freetype.cp36-win_amd64.pyd'>
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(259)]
> >     2567 [MainProcess 15488 MainThread 9212]: ERROR missing get_init()
> >     in module <module 'pygame._freetype' from
> >
>  '...\\python360\\lib\\site-packages\\pygame\\_freetype.cp36-win_amd64.pyd'>:
> >     module 'pygame._freetype' has no attribute 'get_init'
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(267)]
> >     2569 [MainProcess 15488 MainThread 9212]: INFO initializing module
> >     <module 'pygame.base' from
> >
>  '...\\python360\\lib\\site-packages\\pygame\\base.cp36-win_amd64.pyd'>
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(258)]
> >     2569 [MainProcess 15488 MainThread 9212]: INFO init() <module
> >     'pygame.base' from
> >
>  '...\\python360\\lib\\site-packages\\pygame\\base.cp36-win_amd64.pyd'>
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(259)]
> >     3177 [MainProcess 15488 MainThread 9212]: ERROR missing get_init()
> >     in module <module 'pygame.base' from
> >
>  '...\\python360\\lib\\site-packages\\pygame\\base.cp36-win_amd64.pyd'>:
> >     module 'pygame.base' has no attribute 'get_init'
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(267)]
> >     3198 [MainProcess 15488 MainThread 9212]: INFO initializing module
> >     <module 'pygame.fastevent' from
> >
>  '...\\python360\\lib\\site-packages\\pygame\\fastevent.cp36-win_amd64.pyd'>
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(258)]
> >     3199 [MainProcess 15488 MainThread 9212]: INFO init() <module
> >     'pygame.fastevent' from
> >
>  '...\\python360\\lib\\site-packages\\pygame\\fastevent.cp36-win_amd64.pyd'>
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(259)]
> >     3200 [MainProcess 15488 MainThread 9212]: ERROR missing get_init()
> >     in module <module 'pygame.fastevent' from
> >
>  '...\\python360\\lib\\site-packages\\pygame\\fastevent.cp36-win_amd64.pyd'>:
> >     module 'pygame.fastevent' has no attribute 'get_init'
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(267)]
> >     3204 [MainProcess 15488 MainThread 9212]: INFO initializing module
> >     <module 'pygame.freetype' from
> >     '...\\python360\\lib\\site-packages\\pygame\\freetype.py'>
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(258)]
> >     3204 [MainProcess 15488 MainThread 9212]: INFO init() <module
> >     'pygame.freetype' from
> >     '...\\python360\\lib\\site-packages\\pygame\\freetype.py'>
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(259)]
> >     3205 [MainProcess 15488 MainThread 9212]: ERROR missing get_init()
> >     in module <module 'pygame.freetype' from
> >     '...\\python360\\lib\\site-packages\\pygame\\freetype.py'>: module
> >     'pygame.freetype' has no attribute 'get_init'
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(267)]
> >     3219 [MainProcess 15488 MainThread 9212]: INFO initializing module
> >     <module 'pygame.midi' from
> >     '...\\python360\\lib\\site-packages\\pygame\\midi.py'>
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(258)]
> >     3219 [MainProcess 15488 MainThread 9212]: INFO init() <module
> >     'pygame.midi' from
> >     '...\\python360\\lib\\site-packages\\pygame\\midi.py'>
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(259)]
> >     3222 [MainProcess 15488 MainThread 9212]: ERROR missing get_init()
> >     in module <module 'pygame.midi' from
> >     '...\\python360\\lib\\site-packages\\pygame\\midi.py'>: module
> >     'pygame.midi' has no attribute 'get_init'
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(267)]
> >     533054 [MainProcess 15488 MainThread 9212]: INFO initializing
> >     module <module 'pygame.scrap' from
> >
>  '...\\python360\\lib\\site-packages\\pygame\\scrap.cp36-win_amd64.pyd'>
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(258)]
> >     533057 [MainProcess 15488 MainThread 9212]: INFO init() <module
> >     'pygame.scrap' from
> >
>  '...\\python360\\lib\\site-packages\\pygame\\scrap.cp36-win_amd64.pyd'>
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(259)]
> >     533060 [MainProcess 15488 MainThread 9212]: ERROR missing
> >     get_init() in module <module 'pygame.scrap' from
> >
>  '...\\python360\\lib\\site-packages\\pygame\\scrap.cp36-win_amd64.pyd'>:
> >     module 'pygame.scrap' has no attribute 'get_init'
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(267)]
> >
> >
> >     #### modules throwing error on init() on my machine probably due
> >     to missing hardware or missing code at compile time (?) ####
> >     2560 [MainProcess 15488 MainThread 9212]: INFO initializing module
> >     <module 'pygame._camera_vidcapture' from
> >     '...\\python360\\lib\\site-packages\\pygame\\_camera_vidcapture.py'>
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(258)]
> >     2561 [MainProcess 15488 MainThread 9212]: INFO init() <module
> >     'pygame._camera_vidcapture' from
> >     '...\\python360\\lib\\site-packages\\pygame\\_camera_vidcapture.py'>
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(259)]
> >     2565 [MainProcess 15488 MainThread 9212]: ERROR init() raised an
> >     exceptions: No module named 'VideoCapture'
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(269)]
> >     3179 [MainProcess 15488 MainThread 9212]: INFO initializing module
> >     <module 'pygame.camera' from
> >     '...\\python360\\lib\\site-packages\\pygame\\camera.py'>
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(258)]
> >     3179 [MainProcess 15488 MainThread 9212]: INFO init() <module
> >     'pygame.camera' from
> >     '...\\python360\\lib\\site-packages\\pygame\\camera.py'>
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(259)]
> >     3182 [MainProcess 15488 MainThread 9212]: ERROR init() raised an
> >     exceptions: cannot import name '_camera'
> >     [gamelib.context_init_pygame: _init_module in
> >     context_init_pygame.py(269)]
> >
> >
> >     ---- end log snippet ----
> >
> >
> >     [2] context_init_pygame.py: https://bpaste.net/show/937b80cb07f9
> >     [3] pygame_initializer.py: https://bpaste.net/show/ee88d45ea10a
> >
> >     ~DR0ID
> >
> >
>
>

Reply via email to