Transcrypt fails to find relative imports
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, python
- Domain
- compilers
Research direction
Reproduce the failure with main.py, parentmod/init.py, and parentmod/childmod.py, first comparing Python execution with transpiling main.py. Trace how the compiler resolves the relative import from parentmod/init.py and make the example compile and run successfully without the 'could not find' error.
Written by the indexing model from the issue text.
Description
Of a low priority to me, but thought I'd report this anyways. Relative imports (from .mod import ...) don't seem to work in Transcrypt, and produce a 'could not find' error.
Test case:
main.py:
import parentmod
parentmod.afunc()
parentmod/__init__.py:
from .childmod import afunc
parentmod/childmod.py:
def afunc():
print('childmod: afunc!')
Running python main.py works as expected, but trying to transcrypt main.py results in the following error:
Transcrypt (TM) Python to JavaScript Small Sane Subset Transpiler Version 3.6.4
Copyright (C) Geatec Engineering. License: Apache 2.0
Error in program main.py, module childmod, line 1:
Attempt to load module: childmod
Can't find any of:
/home/daboross/Projects/Python/TranscryptTest/src/__javascript__/childmod.mod.js
/home/daboross/Projects/Python/TranscryptTest/src/__javascript__/childmod.mod.js
/home/daboross/Projects/Python/TranscryptTest/env/lib/python3.5/site-packages/transcrypt/modules/__javascript__/childmod.mod.js
/home/daboross/Projects/Python/TranscryptTest/env/lib/python3.5/site-packages/transcrypt/modules/__javascript__/childmod.mod.js
/home/daboross/Projects/Python/TranscryptTest/env/bin/__javascript__/childmod.mod.js
/home/daboross/Projects/Python/TranscryptTest/env/bin/__javascript__/childmod.mod.js
/home/daboross/Projects/Python/TranscryptTest/env/lib64/python35.zip/__javascript__/childmod.mod.js
/home/daboross/Projects/Python/TranscryptTest/env/lib64/python35.zip/__javascript__/childmod.mod.js
/home/daboross/Projects/Python/TranscryptTest/env/lib64/python3.5/__javascript__/childmod.mod.js
/home/daboross/Projects/Python/TranscryptTest/env/lib64/python3.5/__javascript__/childmod.mod.js
/home/daboross/Projects/Python/TranscryptTest/env/lib64/python3.5/plat-linux/__javascript__/childmod.mod.js
/home/daboross/Projects/Python/TranscryptTest/env/lib64/python3.5/plat-linux/__javascript__/childmod.mod.js
/home/daboross/Projects/Python/TranscryptTest/env/lib64/python3.5/lib-dynload/__javascript__/childmod.mod.js
/home/daboross/Projects/Python/TranscryptTest/env/lib64/python3.5/lib-dynload/__javascript__/childmod.mod.js
/usr/lib64/python3.5/__javascript__/childmod.mod.js
/usr/lib64/python3.5/__javascript__/childmod.mod.js
/usr/lib/python3.5/__javascript__/childmod.mod.js
/usr/lib/python3.5/__javascript__/childmod.mod.js
/usr/lib/python3.5/plat-linux/__javascript__/childmod.mod.js
/usr/lib/python3.5/plat-linux/__javascript__/childmod.mod.js
/home/daboross/Projects/Python/TranscryptTest/env/lib/python3.5/site-packages/__javascript__/childmod.mod.js
/home/daboross/Projects/Python/TranscryptTest/env/lib/python3.5/site-packages/__javascript__/childmod.mod.js
/usr/lib/python3.5/site-packages/__javascript__/childmod.mod.js
/usr/lib/python3.5/site-packages/__javascript__/childmod.mod.js
Aborted
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 218
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from TranscryptOrg/Transcrypt
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
TranscryptOrg/Transcrypt#913 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
TranscryptOrg/Transcrypt#911 · 2 comments ·
-
IS: bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
TranscryptOrg/Transcrypt#908 ·
-
SUB: documentation
Difficulty 1/5 Under an hour Newbie friendliness 62/100
TranscryptOrg/Transcrypt#656 · 7 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 76/100
TranscryptOrg/Transcrypt#914 ·
All issues in TranscryptOrg/Transcrypt
Similar issues
-
area/auth bug comp/agent P3 platform/discord type/security
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
NousResearch/hermes-agent#117848 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100