SMB module and do_get_file_info
- From: "Philippe Normand" <philippe fluendo com>
- To: <gnome-vfs-list gnome org>
- Subject: SMB module and do_get_file_info
- Date: Thu, 30 Mar 2006 16:23:46 +0200 (CEST)
I'm now playing with the Python gnomevfs package. But having issues with
gnomevfs.exists, see the attached code. When looking up for a SMB uri
pointing to a dead machine, the whole python process is locked and i don't
understand why.
So I came up to wonder why the do_get_file_info() function takes so much
time to resolve SMB uris which don't exist.
Tracing my code, it seems to block on the LOCK_SMB() in do_get_file_info()
function, but i really can't figure out why it locks my everything. In the
gnome-python binding, the GIL seems to be well used.
I tried the usual trick (gtk_threads_enter/leave) but it didn't helped at
all. I know this question is heavily Python related, but in the end the
gnome-vfs C package is involved, so i hope somebody would have an idea
about my problem ;-)
Best regards,
Philippe
import threading, sys, time, gnomevfs
URIS = ('file:///etc/passwd',
'smb://192.168.2.70/test/',
'file:///etc/fstab',)
def log(msg):
print msg
sys.stdout.flush()
class Loader(threading.Thread):
def __init__(self, uri):
threading.Thread.__init__(self)
self.setDaemon(True)
self.uri = uri
#self.run = self.spare_time
self.start()
def spare_time(self):
log('Starting .. %s' % self.uri)
for i in range(len(self.uri)):
time.sleep(0.1)
self.done(1)
def run(self):
r = gnomevfs.exists(self.uri)
if r:
self.done(r)
else:
self.failed()
return r
def done(self, result):
log('Done: %s : %s' % (self.uri, result))
def failed(self, error=None):
if error:
log('Error : %s' % error)
else:
log('Error')
def run():
loaders = [ Loader(u) for u in URIS ]
while 1:
log("Refresh %s" % time.time())
time.sleep(0.1)
status = []
for l in loaders:
status.append(l.isAlive())
if status == map(lambda x: False, range(len(loaders))):
break
if __name__ == '__main__':
run()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]