Forums

Find answers, ask questions, and connect with our
community all around the world.

Home Forum Omnis General Forum Browser or Proxy error when trying Python Worker

  • Browser or Proxy error when trying Python Worker

    Posted by Nathanaël on August 17, 2023 at 3:12 pm

    Windows 11 + O$ 11 Build 110035439 64 bit + Python 3.11.4

    I made a simple desktop lib to test the new Python worker, using the pyworker/omnis_test provided module. Python is installed and working (with pure Python tests). I did install the Omnis Python requirements ([my profile]\AppData\Local\Omnis Software\OS 11\pyworker>pip install -r requirements.txt)

    The worker starts with no error, but after calling the test method (Do $cinst.$callmethod(‘omnis_test’,’test’)), the call back is always an error (code 10811) :

    A problem occurred when trying to call the method : 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.

    Any idea why and what I could look at?

    maxperique replied 5 months ago 3 Members · 4 Replies
  • 4 Replies
  • Götz Krija

    Member
    August 18, 2023 at 9:27 am

    Hello Nathanaël,

    Did you test the demo library in the Omnis Studio HUB > Samples > Python Worker

    The library works fine for me on Windows 11:

    1. Installed Python 3.11.4 (in the installer checked the box ‘Add python.exe to PATH’)

    2. In command line executed: pip install -r “C:\Users\[USER]\AppData\Local\OS 11 35439 x64\pyworker\requirements.txt”

    3. Tested the Python Worker sample in HUB and the result was successfully returned in the $pyWorkerComplete method

    Götz

  • Nathanaël

    Member
    August 18, 2023 at 10:10 am

    Hi @Götz Krija

    Thanks for your answer.

    In between, I found out about the new sample library and it’s working very well on my setup indeed.

    Not sure what caused the original error in my previous test/own library (except that I used an object instead of an object reference for the pyWorker), but at least now I can copy the logic and good practices of the sample library.

  • maxperique

    Member
    February 28, 2025 at 10:30 pm

    Hi.

    I’ve got the same error 10811.

    I’m on macOS 15.3.1, Apple M1, and I’m using Omnis Studio Community Edition version 11.1

    There is no Python sample under Hub in the Community Edition, so I can’t compare my code with a working example.

    I created an object with the OW3 Python Worker superclass, overriding $methodreturn and $methoderror methods to send the response row back to the calling instance, a remote form, where an object reference to the objPythonWorker has been set.

    Python 3.11 is correctly installed in a conda environment, and all the required packages are installed, too.

    I tried to call the basic omnis_test module and I can see the __pycache__ inside pyworker folder (so, at least something is actually working).

    Is it an issue/limitation of the Community Edition?

    Thank you.

  • maxperique

    Member
    March 1, 2025 at 10:36 am

    UPDATE: solved!

    For anyone facing the same issue, the problem was that I was not passing any vListOrRow to $callmethod.

    Passing an empty Row defined as

    Do locRow.$define('')

    and calling the module as

    Do ivPythonWorker.$callmethod("omnis_test","test",locRow,,locErrorText) Returns #F

    solved the issue, where ivPythonWorker is an object reference of subtype objPythonWorker defined as

    Calculate ivPythonWorker as $objects.objPythonWorker.$newref()

    and objPythonWorker is an object with OW3 PYTHONWorker superclass and overridden methods to send the response back to the calling item (a remote form, in my case).

    • This reply was modified 5 months ago by  maxperique. Reason: wrong formatting

Log in to reply.