Skip to content
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

Unable to inherit AioProcess #37

Open
TanyaEleventhGoddess opened this issue Sep 6, 2021 · 4 comments
Open

Unable to inherit AioProcess #37

TanyaEleventhGoddess opened this issue Sep 6, 2021 · 4 comments

Comments

@TanyaEleventhGoddess
Copy link

TanyaEleventhGoddess commented Sep 6, 2021

Executing the following code

from aioprocessing import AioProcess

class MyProcessClass(AioProcess):
    pass

results in the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: function() argument 1 must be code, not str

I uh... expect to easily be able to override how a class works & his internal functions

@dano
Copy link
Owner

dano commented Sep 7, 2021

Use from aioprocessing.process import AioProcess instead. aioprocessing mirrors the multiprocessing library here - the objects exposed from the top-level module namespace are functions, not classes. The actual class is in a sub-module.

@dano dano closed this as completed Sep 7, 2021
@TanyaEleventhGoddess
Copy link
Author

TanyaEleventhGoddess commented Sep 8, 2021 via email

@dano
Copy link
Owner

dano commented Sep 8, 2021

@TanyaEleventhGoddess Ah, looks like the implementation of multiprocessing has changed since I created aioprocessing, and no longer uses functions for the top-level imports. In any case, aioprocessing still does use functions, so just use from aioprocessing.process import AioProcess for now.

I'll leave this open for now, I'm not sure it's worth the effort to refactor the library to match what multiprocessing is doing now, but I should at least document the unusual "function instead of class" behavior.

@dano dano reopened this Sep 8, 2021
@TanyaEleventhGoddess
Copy link
Author

TanyaEleventhGoddess commented Sep 13, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants