typed_python icon indicating copy to clipboard operation
typed_python copied to clipboard

Cannot import submodules within an Entrypointed function

Open wllgrnt opened this issue 1 year ago • 0 comments

Test:

from typed_python import Entrypoint
@Entrypoint
def f(x):
    import os.path
    return os.path.basename(x)

print(f('test/test2/test3.py'))

Expected behaviour

prints 'test3.py'

Actual behaviour

Error thrown by importlib - AttributeError: 'list' object has no attribute 'startswith' (the importlib call is from _convert_statement_ast in function_conversion_context.py)

wllgrnt avatar Mar 01 '23 23:03 wllgrnt