Discussion:
[bottlepy] gevent and FTP upload
Rémi Bouhl
2016-06-10 13:53:57 UTC
Permalink
Hi,

I am trying to set up a very simple web interface to allow people to upload
files on a FTP, without giving access to the whole FTP directory.
I get stuck at trying to upload the file in background while writing a
message to end user.

All I want to do is starting the FTP upload (and let it running to its
end), while displaying a friendly message.

I have set up two "greenlets" ("ftp_upload_greenlet" and "send_message"),
one for uploading, one for message, and I try to start them with
gevent.sleep(0).
As far as I know, the "ftp_upload_greenlet" starts, since I get the
"Tentative de connexion" message with.

The FTP code works and uploads files if I use it from a python console.

How do I start both gevents on the same time ?

Thx.
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.

---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Derek Bartron
2016-06-17 18:13:11 UTC
Permalink
You should move the inner defs to outside of the main function.

http://sdiehl.github.io/gevent-tutorial/

Look at the spot where they spawn greenlets and then test for outcome.
This is what you want to mimic.
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.

---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...