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

L

livin

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'
 
K

Kent Johnson

livin said:
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
 
L

livin

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)


Kent Johnson said:
livin said:
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
 
K

Kent Johnson

livin said:
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:<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
livin said:
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
 
L

livin

Oh, no I did not create any modules, wish I had the knowledge to do so!

I think I've moved beyond whatever that issue was and now getting a timeout.
The info is below... any help you can give is appreciate!


I'm running this code...

import os, re, string, urllib, types
data = urllib.urlencode({'control_device': 'Kitchen Lights=on'})
urllib.urlopen('http://192.168.1.11', data)


and get this error log from Python...

File "Q:\python\python23.zlib\urllib.py", line 78, in urlopen
File "Q:\python\python23.zlib\urllib.py", line 183, in open
File "Q:\python\python23.zlib\urllib.py", line 297, in open_http
File "Q:\python\python23.zlib\httplib.py", line 712, in endheaders
File "Q:\python\python23.zlib\httplib.py", line 597, in _send_output
File "Q:\python\python23.zlib\httplib.py", line 564, in send
File "Q:\python\python23.zlib\httplib.py", line 548, in connect
IOError
:
[Errno socket error] (10060, 'Operation timed out')


Kent Johnson said:
livin said:
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:<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
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
 
D

Dennis Lee Bieber

import os, re, string, urllib, types
data = urllib.urlencode({'control_device': 'Kitchen Lights=on'})
urllib.urlopen('http://192.168.1.11', data)
And you are sure that a server is running on node "192.168.1.11"
port 80? Heck, are you sure that there IS a "192.168.1.11" machine...
and get this error log from Python...

File "Q:\python\python23.zlib\urllib.py", line 78, in urlopen

That "python23.zlib" has been bothering me from the start... Is your
installation running from a compressed archive?

-=-=-=-=-=-=-Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "E:\Plone_2\Python\lib\urllib.py", line 78, in urlopen
return opener.open(url, data)
File "E:\Plone_2\Python\lib\urllib.py", line 183, in open
return getattr(self, name)(url, data)
File "E:\Plone_2\Python\lib\urllib.py", line 297, in open_http
h.endheaders()
File "E:\Plone_2\Python\lib\httplib.py", line 715, in endheaders
self._send_output()
File "E:\Plone_2\Python\lib\httplib.py", line 600, in _send_output
self.send(msg)
File "E:\Plone_2\Python\lib\httplib.py", line 567, in send
self.connect()
File "E:\Plone_2\Python\lib\httplib.py", line 551, in connect
raise socket.error, msg
IOError: [Errno socket error] (10060, 'Operation timed out')
-=-=-=-=-=-=-

Expected, in my case, as I know I have no host with that IP. But my
library modules are in the common "...\lib\..." path. Using an actual
LAN host IP gives me a 10061, Connection Refused (no server running on
the real machine).

C:\Documents and Settings\Dennis Lee Bieber>ping 192.168.1.11

Pinging 192.168.1.11 with 32 bytes of data:

Request timed out.

Ping statistics for 192.168.1.11:
Packets: Sent = 1, Received = 0, Lost = 1 (100% loss),
Control-C
^C
C:\Documents and Settings\Dennis Lee Bieber>ping 192.168.1.100

Pinging 192.168.1.100 with 32 bytes of data:

Reply from 192.168.1.100: bytes=32 time<1ms TTL=128
Reply from 192.168.1.100: bytes=32 time<1ms TTL=128
Reply from 192.168.1.100: bytes=32 time<1ms TTL=128

Ping statistics for 192.168.1.100:
Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
Control-C
^C
C:\Documents and Settings\Dennis Lee Bieber>


File "Q:\python\python23.zlib\urllib.py", line 183, in open
File "Q:\python\python23.zlib\urllib.py", line 297, in open_http
File "Q:\python\python23.zlib\httplib.py", line 712, in endheaders
File "Q:\python\python23.zlib\httplib.py", line 597, in _send_output
File "Q:\python\python23.zlib\httplib.py", line 564, in send
File "Q:\python\python23.zlib\httplib.py", line 548, in connect
IOError
:
[Errno socket error] (10060, 'Operation timed out')


Kent Johnson said:
livin said:
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
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
--
> ============================================================== <
> (e-mail address removed) | Wulfraed Dennis Lee Bieber KD6MOG <
> (e-mail address removed) | Bestiaria Support Staff <
> ============================================================== <
> Home Page: <http://www.dm.net/~wulfraed/> <
> Overflow Page: <http://wlfraed.home.netcom.com/> <
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top