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

Using sticky tape to pass code to external engine #19

Closed
PMLP-novo opened this issue Dec 9, 2020 · 1 comment
Closed

Using sticky tape to pass code to external engine #19

PMLP-novo opened this issue Dec 9, 2020 · 1 comment

Comments

@PMLP-novo
Copy link

PMLP-novo commented Dec 9, 2020

I want to be able to compile a python module down to a string, that can be passed along with arguments to an external engine which then loads the module and runs the run function with the arguments.

So my basic test is if the following is posible:

import stickytape
def test(*args, **kwargs):raise ImportError("No test function loaded")
source_code = stickytape.script("stickytape_test/__init__.py")
exec(source_code)
assert test("test") == "test"

# stickytape_test/__init__.py
from .core import *

# stickytape_test/core.py
def test(out):
     return out

I get a
NameError: name '__stickytape_working_dir' is not defined

Any suggestions on how to do something like this?

@mwilliamson
Copy link
Owner

This isn't really stickytape's intended use-case, so I wouldn't suggest using it in this way.

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