Help Please: 'module' object has no attribute 'compile'

Kent Johnson kent at kentsjohnson.com
Sat Jan 7 15:03:10 EST 2006


livin wrote:
> I beleive so... I cannot know for sure becasue the models are not 
> separate... they are in the python23.zlib file... I'm no sure how to check 
> the file, it looks as if it is compiled (I'm new to python so forgive my 
> ignorance)

Yes, there should be an re module in your Python distribution, and it 
should have a compile attribute. You can check this from the python 
intepreter easily:
  >>> import re
  >>> re.compile
<function compile at 0x008FE0B0>

What I am suggesting is that YOU may have created a module named re that 
Python is finding instead of the system module by that name. In this 
case your module doesn't have a compile attribute. This would cause the 
error you see.

Kent

> 
> 
> "Kent Johnson" <kent at kentsjohnson.com> wrote in message 
> news:43beeb5d$1_1 at newspeer2.tds.net...
> 
>>livin wrote:
>>
>>>my log...
>>>
>>>INFO urllib.urlopen('http://192.168.1.11/hact/kitchen.asp', 
>>>urllib.urlencode({'Action': 'hs.ExecX10ByName+Kitchen+Lights%2C+On 
>>>%2C+100&x=4&y=6'}))
>>>INFO
>>> INFO   File "Q:\python\python23.zlib\urllib.py", line 78, in urlopen
>>>INFO   File "Q:\python\python23.zlib\urllib.py", line 159, in open
>>>INFO   File "Q:\python\python23.zlib\urllib.py", line 957, in splittype
>>>INFO AttributeError
>>>INFO :
>>>INFO 'module' object has no attribute 'compile'
>>
>>That line reads
>>        _typeprog = re.compile('^([^/:]+):')
>>
>>Do you have a module named 're' that is shadowing the library module of 
>>the same name?
>>
>>Kent 
> 
> 
> 



More information about the Python-list mailing list