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

Issue with running from __main__ #58

Closed
PythonFZ opened this issue Aug 30, 2021 · 0 comments · Fixed by #59
Closed

Issue with running from __main__ #58

PythonFZ opened this issue Aug 30, 2021 · 0 comments · Fixed by #59
Assignees

Comments

@PythonFZ
Copy link
Member

The following code fails:

from pytrack import PyTrack, DVC, PyTrackProject


@PyTrack(package=False)
class HelloWorld:
    def __init__(self) -> None:
        self.output = DVC.result

    def __call__(self, *args, **kwds):
        pass

    def run(self):
        self.output = "Hello World"


if __name__ == "__main__":
    project = PyTrackProject()
    project.create_dvc_repository()

    hello_world = HelloWorld()
    hello_world()

with

ImportError: cannot import name 'HelloWorld' from '__main__' (unknown location) ERROR: failed to reproduce 'dvc.yaml': failed to run: python -c "from __main__ import HelloWorld; HelloWorld(id_=0).run()", exited with 1

@PythonFZ PythonFZ self-assigned this Aug 30, 2021
@PythonFZ PythonFZ linked a pull request Aug 30, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant