Dariusz Dariusz - 1 year ago 132
Python Question

PyQT QFileDialog - get full directory including IP of disk

I'd like to get full path of my directory, something like:




How can I get QFileDialog to give me the IP address of the HDD that I have selected?

Currently using

self.project= str(QtGui.QFileDialog.getExistingDirectory(self, "Select Directory", lastDir))

tried going via
but that only ever goes down to


Answer Source

Not sure where I found it but here is the option I followed at the end. I let user decide then which device to use for location

from netifaces import interfaces, ifaddresses, AF_INET
p =[]
for ifaceName in interfaces():
    addresses = [i['addr'] for i in ifaddresses(ifaceName).setdefault(AF_INET, [{'addr':'No IP addr'}] )]

print p[0],p[1]
print p
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download