Replies: 2 comments 1 reply
-
I think maybe I can fix this by using some config file. |
Beta Was this translation helpful? Give feedback.
-
Hi Taketo - generally, when launching a Python project from a folder/package, any modules referenced must either be contained within that folder/package or installed as a separate package. I'll shamelessly plug a recent blog post on packaging we put out 😄 You have two options here:
.
├── __init__.py
├── common_resources
│ ├── io_managers
│ ├── __init__.py
│ └── redis_io_manager
└── preprocess_project
├── Dockerfile
├── Pipfile
├── Pipfile.lock
├── README.md
├── preprocess_project
├── __init__.py
from .preprocess_project.preprocess_project import defs as defs And then point Dagster at this file/folder. You probably will also need an empty
First, you'd need to create a
from setuptools import setup
setup(
name="common_resources",
version="0.1",
author="FooBar",
author_email="[email protected]",
license="MIT",
packages=["common_resources"],
zip_safe=False,
) .
├── common_resources
│ ├── setup.py
│ ├── common_resources
│ ├── __init__.py
│ ├── io_managers
│ ├── __init__.py
│ └── redis_io_manager
└── preprocess_project
├── Dockerfile
├── Pipfile
├── Pipfile.lock
├── README.md
├── preprocess_project
├── __init__.py Install (preprocess_project) root@c717e5a997c4:~/polish-pipeline# pip install -e common_resources Then, you can use it in from common_resources.io_managers import RedisIOManagerFactory |
Beta Was this translation helpful? Give feedback.
-
I write the following code with the following directory structure and got the following error.
Error is caused by importing module outside of project.
How can I fix this?
./preprocess_project/preprocess_project/__init__.py
./preprocess_project
and errorsIf I place the
common_resources
directory under the./preprocess_project/preprocess_project
directory, there was no errors.Therefore, module outside of project cause the error.
Beta Was this translation helpful? Give feedback.
All reactions