omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    FTP multiple threads, storbinary callback not called

    Pythonista
    2
    6
    3097
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • cvp
      cvp last edited by

      I'm tying to perform multiple uploads to several FTP servers by using threads.
      Threads seem to work but it seems that my callback code is not called when executing the storbinary command, even with callback=lambda block:print(len(block)).

      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        double check line 17. thats where your problem lies.

        1 Reply Last reply Reply Quote 2
        • cvp
          cvp last edited by cvp

          As I didn't post my source code, I suppose it's humor.
          My code is very long and callback did function before I modified it for multiple threads, thus my question was "general", does need callback something special when executed in a thread run?

          1 Reply Last reply Reply Quote 0
          • cvp
            cvp last edited by

            @jonb Thanks for your hilarious post, it forced me to deeper check my source, and I found my error.
            Sorry to have so quickly posted a topic, but I really had tried some hours...

            1 Reply Last reply Reply Quote 0
            • JonB
              JonB last edited by

              I told you... it is always line 17 :)

              Out of curiosity... did you have to do anything special, or was it just a stupid bug?

              1 Reply Last reply Reply Quote 0
              • cvp
                cvp last edited by

                Really stupid bug, just near line 17.😤
                I had subs, for connecting, sending, deconnecting and I have integrated all theses subs in an inline code because I thought it would be easier to set it as able for multi thread due to a lot of variables (not easy to explain). And so, just before my storbinary line, I added an if (bad invention, isn't it?) and it was always False and my storbinary was not executed, thus also not it's callback. So easy, but I swear, I've tested during hours, and after your post, I've just done a code review...and I found this 🐜
                Thanks for your patience for helping us so much.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Powered by NodeBB Forums | Contributors