[Bf-python] Changing confusing python console start-up message

Stephen Swaney sswaney at centurytel.net
Sat Jul 8 01:14:12 CEST 2006


On Fri, Jul 07, 2006 at 11:27:59AM -0700, Ken Hughes wrote:

> Was looking at bug report 4398 ("console message for python version 
> tracking")
> 
> http://projects.blender.org/tracker/index.php?func=detail&aid=4398&group_id=9&atid=125
> 
> The initial report was based on the user being confused by the console 
> messages.

The bug says that Python 2.4 was succesfully importing the 2.3 site module.

> I also changed the "looking for" message to "Internal Python interpreter 
> version".  I think at the very least we should change this.

I don't have a problem with this part.

However, I am not convinced that the bug ( 4398 ) motivating the rest
of this proposal is not just some local strangeness.

Importing modules from the wrong version is an error since structure 
sizes (and features) change between versions.  I am unable to make
python 2.4 import 2.3 modules on my linux box. ( bug was reported on
win 98)  This may be possible for some minimal case.

> I'm proposing before the release we change the messages to indicate the 
> build-in Python version and the installed Python version.  I've added a 
> simple test inside init_syspath which checks the methods defined in the 
> site module to determine the version:
> 
> 
>      printf("Looking for Python installation... ");
>      mod = PyImport_ImportModule( "site" );  /* new ref */
>      if( mod ) {
>         if( PyDict_GetItemString(PyModule_GetDict(mod),"addsitepackages") )
>             printf( "found version 2.4.\n" );
>         else if( PyDict_GetItemString(PyModule_GetDict(mod),"sitedirs") )
>             printf( "found version 2.3 or earlier.\n" );
>         else
>             printf( "found version 2.2 or earlier.\n" );
>         Py_DECREF( mod );
>     } else
> 	print warning.....

This part makes me a little twitchy.  As I said above, I am not
convinced py 2.4 is importing the 2.3 site module.

If we *are* going to do something like checking for version specific
items in a module, we need to go ahead and handle Python 2.5.  It is
already available and at some point we *will* be moving to it.

Summary:

Feel free to change the message about the internal interpreter version.

Importing modules from a version that does not match the internal one
should be an error.
-- 
Stephen Swaney			
sswaney at centurytel.net




More information about the Bf-python mailing list