What's __init__.py?

This is the location for all mods to collaborate. Anyone making or planning their own mod should post help requests, screen shots and news here.

Moderators: Omega, tillias, Mod Contributor

What's __init__.py?

Postby chuck_starchaser » Sun Sep 21, 2008 2:54 pm

Gorbalad, at the PU forum, is reporting random crashes. Part of his stderr.txt reports,
Code: Select all
 Next To: Gemini/Freyjadot -0.000490warning: Not importing directory 'E:\Spiele\PU\bases\fixers': missing __init__.py
Asking to undock
Destruct called. If called from C++ this is death 201053840 (0xbfbd690)BASE Destruct called. If called from C++ this is death 201053840 (0xbfbd690)dot 0.561228Assumed exit on unit LOAD_FAILED(if not quitting, report error)
Assumed exit on unit tungsten(if not quitting, report error)

Now, I think I remember seeing an __init__.py, somewere, some time, long ago. But now a search returns nothing.
Morover, I did a search of *.py files containing text "__init__" and that search comes empty as well.
Is __init__.py being called from code?
User avatar
chuck_starchaser
Elite
Elite
 
Posts: 8014
Topics: 195
Joined: Thu Sep 04, 2003 9:03 pm
Location: Montreal

Share On:

Share on Facebook Facebook Share on Twitter Twitter Share on Digg Digg

Postby ace123 » Sun Sep 21, 2008 5:31 pm

__init__.py is what python looks for when you ask it to import an entire directory.
I believe python is getting confused between "fixers.py" and the "fixers" directory
ace123
Lead Network Developer
Lead Network Developer
 
Posts: 2560
Topics: 32
Joined: Sun Jan 12, 2003 2:13 am
Location: Palo Alto CA

Postby chuck_starchaser » Sun Sep 21, 2008 7:15 pm

Thanks! I thought I'd search for some .py file with a statement "import ...fixers" and change it to "import ...fixers.py",
but I searched through trunk for .py files containing the word "fixers" and the only one is fixers.py :-/
(Unless it's windows' search tool acting up again...)
User avatar
chuck_starchaser
Elite
Elite
 
Posts: 8014
Topics: 195
Joined: Thu Sep 04, 2003 9:03 pm
Location: Montreal

Postby ace123 » Mon Sep 29, 2008 4:31 am

Yes, a lot of files contain "import fixers" or "from fixers import ..."
so it is windows acting up.

As to the __init__.py thing, if you look closely, it says "warning", not "error". So python is just making sure that we want the file to be imported and not the directory of the same name.

Unfortunately, the logs linked to in:
http://wcjunction.com/phpBB2/viewtopic. ... 3929#13929
do not seem to say anything useful about the reason for the crash.

We can try to pounce on a few things like __init__ or the load failed, but I don't think either of them caused the actual crash.
ace123
Lead Network Developer
Lead Network Developer
 
Posts: 2560
Topics: 32
Joined: Sun Jan 12, 2003 2:13 am
Location: Palo Alto CA

Postby chuck_starchaser » Tue Sep 30, 2008 3:26 pm

Thanks!
User avatar
chuck_starchaser
Elite
Elite
 
Posts: 8014
Topics: 195
Joined: Thu Sep 04, 2003 9:03 pm
Location: Montreal



Return to General Modding

Who is online

Users browsing this forum: No registered users and 0 guests

cron