Running pyftpdlib as a Cherrypy Plugin

68 views
Skip to first unread message

ian luddy

unread,
Jan 9, 2012, 1:01:52 PM1/9/12
to Python FTP server library - Discussion group
Hi,

I'm trying to run a pyftpdlib FTP Server as a Cherrpy plugin. I have
specified a class which extends the Cherrypy SimplePlugin class and is
instantiated like this:

CoreFTPServer(bus = cherrypy.engine, addr, port, root, user,
password).subscribe()

In the CoreFTPServer class I start the FTP Server in a new thread like
this (I have increased the timeout and set Polling to True but this
hasn't solved the issue):

threading.Thread(target = self.ftpd.serve_forever , args = (10.0 ,
True))

The FTP Server runs fine but eventually runs into the following issue:

Traceback (most recent call last):
File "C:\Python26\lib\asynchat.py", line 110, in handle_read
data = self.recv (self.ac_in_buffer_size)
File "C:\Python26\Lib\asyncore.py", line 362, in recv
data = self.socket.recv(buffer_size)
error: [Errno 10035] A non-blocking socket operation could not be
completed immediately

Is there a way to set the FTP Server so that it's using a blocking
socket? Or is there a better solution? I am a relatively inexperienced
programmer and any help would be appreciated.

Cheers

Giampaolo Rodolà

unread,
Jan 12, 2012, 4:40:46 PM1/12/12
to pyft...@googlegroups.com

Mmm, that looks like a bug.
Please, download the latest SVN version and retry, then copy & paste
the traceback message including a bunch of lines above it.
Taking a look at the actual server code you're using would also be nice.
Also, note that the test suite already has a pretty nice thread-based
server you can even start, stop and restart:
http://code.google.com/p/pyftpdlib/source/browse/tags/release-0.6.0/test/test_ftpd.py#156
You can use it as-is.


Regards,

--- Giampaolo

Reply all
Reply to author
Forward
0 new messages