Closed lxmnk closed 2 years ago
I experienced the same thing. When I run the "sample" project it has no issues. But, when I try to implement it into my project it has a problem. So, to run the worker I need to make my own script, it can be seen here https://github.com/getpay-id/getpay-api/blob/main/runworker.py.
@tobymao I've made a PR for this https://github.com/tobymao/saq/pull/27
Your app
module needs to be discoverable by the import system.
Two common ways to do this are:
pyproject.toml
file look like? Did you run poetry install
?yea, this is just how python works. you either need to install your app or add it in python path, it's a bit annoying, but adding some special handling in saq for this sounds a bit dangerous
Thank you all for help!
I've figured out that my package is not valid. I forgot about it, because I don't use this package as a library. So I've added packages
to pypoject.toml
and the problem was gone.
[tool.poetry]
name = "test-bot"
version = "0.1.0"
description = "TODO"
packages = [{ include = "app" }]
authors = []
Maybe the Readme example should be changed to python -m saq examples.simple.settings
?
Running as python module (-m
) automatically adds the current directory to sys.path
.
sure, wanna make a pr?
Hello! Thank you for nice framework!
I'm trying to use it, but getting an exception on attempt to start worker:
Project structure:
worker.py
contents:If I try to use
importlib
from interpreter, everything is OK:I've found, that current directory not in
sys.path
and usedPYTHONPATH
to this fix the problem:Could you help me to figure out, is this a bug or my fault?