[Python-3000] Persistent Error

Anand Balachandran Pillai abpillai at gmail.com
Fri Jun 6 11:45:04 CEST 2008


Hi Stefan,

   There are no build errors in the warnings module and _warnings.o is
generated.
However I looked at the make log and no _warnings.so is built by the
linker. Instead
_warnings.o is just archived into libpython3.0a.

Cannot find any error in config.log either. I tried to check how
_warnings.so was
built in previous Python versions (<=2.5) but apparently there is no
_warnings.so
in Python 2.5 and earlier, only warnings.py .

 I tried to build a _warnings.so manually and then copy it to
lib-dynload folder.
First time it failed with an Import Error.

$gcc -pthread -shared /home/anand/projects/py3k/Python/_warnings.o
-L/usr/local/lib -o build/lib.linux-i686-3.0/_warnings.so
$sudo cp build/lib.linux-i686-3.0/_warnings.so
/usr/local/lib/python3.0/lib-dynload/

[anand at localhost ~]$ python3
Fatal Python error: Py_Initialize: can't initialize sys standard streams
Traceback (most recent call last):
  File "/usr/local/lib/python3.0/io.py", line 63, in <module>
    import warnings
  File "/usr/local/lib/python3.0/warnings.py", line 268, in <module>
    from _warnings import (filters, default_action, once_registry,
ImportError: /usr/local/lib/python3.0/lib-dynload/_warnings.so:
undefined symbol: Py_DisplaySourceLine
Aborted

I figured Py_DisplaySourceLine is present in traceback.o, so did this
(clearly a wrong
way, but just to see if it works...)

$ gcc -pthread -shared /home/anand/projects/py3k/Python/_warnings.o
/home/anand/projects/py3k/Python/traceback.o -L/usr/local/lib -o
build/lib.linux-i686-3.0/_warnings.so
$ sudo cp build/lib.linux-i686-3.0/_warnings.so
/usr/local/lib/python3.0/lib-dynload/

Now it produces this error.

[anand at localhost py3k]$ python3
Fatal Python error: Py_Initialize: can't initialize sys standard streams
Traceback (most recent call last):
  File "/usr/local/lib/python3.0/io.py", line 63, in <module>
    import warnings
  File "/usr/local/lib/python3.0/warnings.py", line 268, in <module>
    from _warnings import (filters, default_action, once_registry,
ImportError: dynamic module does not define init function (init_warnings)
Aborted

Basically, I am stumped at this point. Any help is appreciated.

Regards

--Anand

On Fri, Jun 6, 2008 at 2:22 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:
> Anand Balachandran Pillai wrote:
>> After commenting out the code which catches the ImportError,
>> this is the trace.
>>
>> [anand at localhost ~]$ python3
>> Fatal Python error: Py_Initialize: can't initialize sys standard streams
>> Traceback (most recent call last):
>>   File "/usr/local/lib/python3.0/io.py", line 63, in <module>
>>     import warnings
>>   File "/usr/local/lib/python3.0/warnings.py", line 268, in <module>
>>     from _warnings import (filters, default_action, once_registry,
>> ImportError: No module named _warnings
>> Aborted
>
> Looks like you should rebuild your Python and check for build errors in the
> _warnings module.
>
> Stefan
>
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/abpillai%40gmail.com
>



-- 
-Anand


More information about the Python-3000 mailing list