[Tutor] file open error

Jalil jalilsan at gmail.com
Fri Feb 9 00:16:27 CET 2007


Hey guys,

I have this simple code and i cant seem to get it to run.
here is the code.


from os import *
import re

hostname =raw_input("Host name : ") or '<unknown>'
mac_addr =input("Mac address : ")

filename='/etc/dhcpd.conf'
fh=open(filename)

m = re.match(hostname,fh.readlines())
if m!=None:
    m.group()


Here is the error I get when i try to run the code


monkeysee% python sys_wireless.py
Host name :
Mac address : 1234567
Traceback (most recent call last):
  File "sys_wireless.py", line 8, in ?
    fh=open("/etc/dhcpd.conf","r")
TypeError: an integer is required



I dont know what the issue is?

any hints ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070208/3ea0737b/attachment.html 


More information about the Tutor mailing list