Re: [BangPypers] mac IP

2011-04-14 Thread Noufal Ibrahim
On Fri, Apr 15 2011, Nitin Kumar wrote: > Hi Noufal, > > I am not in a condition to use any third party, I need any way to fetch ip > using normal python command. Should i use Popen with ipconfig? [...] Last option. That would work. :) -- ___ BangPyp

Re: [BangPypers] mac IP

2011-04-14 Thread Noufal Ibrahim
On Fri, Apr 15 2011, Nitin Kumar wrote: > the reason for the same is: > > We got to machine setup, one is US and one in India, according to > machine location we need to use local server. So I was looking for IP > which help me differentiate the position of client Machine to use that > to chose s

Re: [BangPypers] mac IP

2011-04-14 Thread Nitin Kumar
Hi Noufal, I am not in a condition to use any third party, I need any way to fetch ip using normal python command. Should i use Popen with ipconfig? Nitin k On Thu, Apr 14, 2011 at 6:26 PM, Noufal Ibrahim wrote: > On Thu, Apr 14 2011, Nitin Kumar wrote: > > > Hi All, > > > > Is anyone aware h

Re: [BangPypers] mac IP

2011-04-14 Thread Nitin Kumar
the reason for the same is: We got to machine setup, one is US and one in India, according to machine location we need to use local server. So I was looking for IP which help me differentiate the position of client Machine to use that to chose server. thanks Nitin K On Thu, Apr 14, 2011 at 6:28

Re: [BangPypers] mac IP

2011-04-14 Thread Nitin Kumar
Ya this is the issue, I am writing code generic to all OS (windows 7, XP, mac) so ioctl wont be good to use. Nitin K On Thu, Apr 14, 2011 at 7:15 PM, Noufal Ibrahim wrote: > On Thu, Apr 14 2011, Ruchir Shukla wrote: > > > here is a sample code > > > > > import fcntl, socket, struct >

Re: [BangPypers] mac IP

2011-04-14 Thread Noufal Ibrahim
On Thu, Apr 14 2011, Ruchir Shukla wrote: > here is a sample code > > import fcntl, socket, struct def getHwAddr(ifname): > ... s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) > ... info = fcntl.ioctl(s.fileno(), 0x8927, struct.pack('256s', > ifname[:15])) > ... re

Re: [BangPypers] mac IP

2011-04-14 Thread Ruchir Shukla
here is a sample code >>> import fcntl, socket, struct >>> >>> def getHwAddr(ifname): ... s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) ... info = fcntl.ioctl(s.fileno(), 0x8927, struct.pack('256s', ifname[:15])) ... return ''.join(['%02x:' % ord(char) for char in info[18:24]]

Re: [BangPypers] mac IP

2011-04-14 Thread Santosh Rajan
I think the solution below will give you all the ip addresses including 127.0.0.1. In any case this is not an easy one to solve. Depends on a lot of factors. You might want to revisit your original question on why you want the ip address? and which ip address (local or inet)?, and investigate wethe

Re: [BangPypers] mac IP

2011-04-14 Thread Noufal Ibrahim
On Thu, Apr 14 2011, Nitin Kumar wrote: > Hi All, > > Is anyone aware how to fetch mac machine IP using python? This module http://pypi.python.org/pypi/pynetinfo/0.1.9 seems to be able to to do it. -- ___ BangPypers mailing list BangPypers@python.or

Re: [BangPypers] mac IP

2011-04-14 Thread Sudharshan Gupta
Hi nitin, I think this works import socket socket.gethostbyname(socket.gethostname()) socket.gethostbyname_ex(socket.gethostname()) Nitin Kumar wrote: Hi All, Is anyone aware how to fetch mac machine IP using python? -- Thanks & Regards Sudharshan

[BangPypers] mac IP

2011-04-14 Thread Nitin Kumar
Hi All, Is anyone aware how to fetch mac machine IP using python? -- Nitin K ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers

Re: [BangPypers] Broken pipe error

2011-04-14 Thread Kenneth Gonsalves
On Thu, 2011-04-14 at 16:17 +0530, Noufal Ibrahim wrote: > On Thu, Apr 14 2011, Kenneth Gonsalves wrote: > > > On Thu, 2011-04-14 at 15:21 +0530, Amit Sethi wrote: > >> File "/usr/lib/python2.6/socket.py", line 286, in flush > >> self._sock.sendall(buffer) > >> error: [Errno 32] Broken pipe >

Re: [BangPypers] Broken pipe error

2011-04-14 Thread Noufal Ibrahim
On Thu, Apr 14 2011, Kenneth Gonsalves wrote: > On Thu, 2011-04-14 at 15:21 +0530, Amit Sethi wrote: >> File "/usr/lib/python2.6/socket.py", line 286, in flush >> self._sock.sendall(buffer) >> error: [Errno 32] Broken pipe > > strange - I have been using it for over 5 years and have never got

Re: [BangPypers] Broken pipe error

2011-04-14 Thread Kenneth Gonsalves
On Thu, 2011-04-14 at 15:21 +0530, Amit Sethi wrote: > File "/usr/lib/python2.6/socket.py", line 286, in flush > self._sock.sendall(buffer) > error: [Errno 32] Broken pipe strange - I have been using it for over 5 years and have never got this error -- regards Kenneth Gonsalves http://lawgon

Re: [BangPypers] Broken pipe error

2011-04-14 Thread Baishampayan Ghose
On Thu, Apr 14, 2011 at 3:21 PM, Amit Sethi wrote: > File "/usr/lib/python2.6/socket.py", line 286, in flush >    self._sock.sendall(buffer) > error: [Errno 32] Broken pipe This happens when the request from the client (browser) is closed/interrupted. Sometimes this happens when you press the Esc

[BangPypers] Broken pipe error

2011-04-14 Thread Amit Sethi
Many times on making request to a the django development server I get this error File "/usr/lib/python2.6/socket.py", line 286, in flush self._sock.sendall(buffer) error: [Errno 32] Broken pipe However usually it is momentary. But I have been getting this error continuously. Thus I am curiou