Problems with importation of regsub module in 2.2

morden morden at shadows.net
Mon Jun 2 15:53:39 EDT 2003


Gerhard Haering wrote:
> * morden <morden at shadows.net> [2003-06-01 15:22 -0700]:
> 
>>I got this trace after upgrade from 1.x tro 2.2:
>>
>>...
>>    import regsub
>>  File "/usr/local/lib/python2.2/regsub.py", line 20, in ?
>>    import regex
>>ImportError: /usr/local/lib/python2.2/lib-dynload/regex.so: undefined 
>>symbol: _Py_NoneStruct
> 
> 
> Strange. There must have been something gone wrong when you compiled
> Python. What you should be getting is this:
> 
> #v+
> 
>>>>import regsub
> 
> /usr/lib/python2.2/regsub.py:15: DeprecationWarning: the regsub module is deprecated; please use re.sub()
>   DeprecationWarning)
> #v-
> 
> Do you get the same error message if you try to import something else
> from dynload, like 'time' or 'sha'?
> 
Different:
   File "/usr/lib/textbook/prtempl/prn_ascii.py", line 23, in ?
     import time
ImportError: /usr/local/lib/python2.2/lib-dynload/time.so: undefined 
symbol: PyExc_IOError


My port on SCO still uses 1.4
Is there any way to make my code use regsub module on 1.4 and re module 
on 2.2 without branching? I could not kill SCO port just yet and would 
rather not go thru the trouble of upgrading it to 2.2

re.sub() works like charm. Thank you.





More information about the Python-list mailing list