-
Notifications
You must be signed in to change notification settings - Fork 13
Errors, missing code/links in Workers section #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
So using the example on the page above - and trying to create a worker from within main.py:
Creating worker from mainI change to pyodide and add config (which was hard to work out) to get:
With an empty file "./worker.py" this code runs and reports the two "ready states" on the pyscript terminal. If I change the code to:
I also get the two responses even if there is no "./satin_worker/worker.py" I suppose the environment starts but the worker has not been called yet - so it is not checked for existence.
Then "Foo (only appears in JS console)" will be printed into the JS console but not the pyscript terminal. and if main.py has one line added to it:
Then I see in the pyscript terminal ""Pyodide bootstrapped Bar" Doing something in the worker on requestSo now to try to get the worker doing something after initialisation If I add this function to main.py:
and in worker I add:
I cannot get The docs seem to confuse starting a worker in index.html with starting a worker in main.py |
the |
I agree completely but I am using pyscript docs page. |
BTW the reason why I picked PyWorker from the docs is I want to use a worker in my single file components - so that I can make larger UI's out of files, which do the UI for one aspect of what is on the page. If that's not a goal for pyscript - that's ok, Just means I won't be able to do that. I will then find another way to do it. |
I have just found a section in the docs on named workers. Thanks for your hint. I will see if this helps me do what I want. Cheers |
In one place where workers are mentioned:
There are several pieces of code with code elements missing.
Also the two ways workers can be started are confusing because of this missing code.
Also the link to a working example is 404
The only problem with this is that people who are NOT Javascript experts may not be able to work out all the usecases that are legitimate from the code available. (I know I can't.)
Common use case
the code refers togreeting
which is defined in the previous sectionWorker interactions
but not in this code. Its not clear which code should be carried forward from example to example and which is standalone. Ideally all the code for main and worker should (IMHO) be standalone and complete - or point to an example which works.IMHO - It would be nice if the sections showed:
from pyscript import workers
)?__export__ = ["fname1", "fname2"]
)?from pyscript import PyWorker
)IMHO this would make it easier for people to work out how to use workers in pyscript.
Any examples that could be generated for the docs would also be great and it would be nice if they followed the categories indicated above.
(I'd happily contribute a demo if I could work out how to make it ALL work.)
The text was updated successfully, but these errors were encountered: