Skip to main content
Welcome guest. | Register | Login | Post

[SOLVED] Python Sockets ...

5 replies [Last post]
Offline
Joined: 2006-11-19

It was working perfectly today, dident touch it at all, then I came back a few hours later and ran the program and got an error.

tyler@tyler-laptop:~$ python chat.py
Traceback (most recent call last):
  File "chat.py", line 1, in 
    from socket import socket, gethostbyname, AF_INET, SOCK_STREAM;
  File "/usr/lib/python2.5/socket.py", line 5, in 
    This module provides socket operations and some related functions.
AttributeError: 'module' object has no attribute 'AF_INET'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/var/lib/python-support/python2.5/apport_python_hook.py", line 38, in apport_excepthook
    from apport.fileutils import likely_packaged
  File "/var/lib/python-support/python2.5/apport/__init__.py", line 1, in 
    from apport.report import Report
  File "/var/lib/python-support/python2.5/apport/report.py", line 14, in 
    import subprocess, tempfile, os.path, urllib, re, pwd, grp, os, sys
  File "/usr/lib/python2.5/urllib.py", line 26, in 
    import socket
  File "/usr/lib/python2.5/socket.py", line 5, in 
    This module provides socket operations and some related functions.
AttributeError: 'module' object has no attribute 'AF_INET'

Original exception was:
Traceback (most recent call last):
  File "chat.py", line 1, in 
    from socket import socket, gethostbyname, AF_INET, SOCK_STREAM;
  File "/usr/lib/python2.5/socket.py", line 5, in 
    This module provides socket operations and some related functions.
AttributeError: 'module' object has no attribute 'AF_INET'

Any idea how to fix this :S, I dont understand why it would randomly stop working?

Thanks.

tbuitenh's picture
Offline
Joined: 2005-12-21
possible reasons: 1) you

possible reasons:

1) you have multiple copies of your script, and accidentally ran a different one
2) automatic update run by a cron job?
3) filesystem corruption - how old is your hard disk?

Offline
Joined: 2006-11-19
1) Nope 2) Nope 3) 2 years

1) Nope
2) Nope
3) 2 years

a thing's picture
Offline
Joined: 2005-12-20
filesystem corruption

I doubt this will work, but try fscking the partitions that the script and Python are on anyway.

Offline
Joined: 2006-11-19
Ah I found the problem, it

Ah I found the problem, it seems I cant run socket things from my home folder ... I moved the script into a new folder and it worked.

Thanks.

tbuitenh's picture
Offline
Joined: 2005-12-21
odd. are you using SElinux

odd. are you using SElinux or something?

Comment viewing options