You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ tree
.
├── a
│ ├── __init__.py
│ └── b.py
└── r.py
1 directory, 3 files
$ cat a/b.py
def f():
print("b.f() called")
$ cat r.py
from a.b import f
f()
This gives:
$ lpython r.py semantic error: Could not find the module '__init__.py'. If an import path is available, please use the `-I` option to specify it --> r.py:1:1 |1 | from a.b import f | ^^^^^^^^^^^^^^^^^ Note: if any of the above error or warning messages are not clear or are lackingcontext please report it to us (we consider that a bug that needs to be fixed).
$ lpython -I . r.pysemantic error: Could not find the module '__init__.py'. If an import path is available, please use the `-I` option to specify it --> r.py:1:1 |1 | from a.b import f | ^^^^^^^^^^^^^^^^^ Note: if any of the above error or warning messages are not clear or are lackingcontext please report it to us (we consider that a bug that needs to be fixed).
Ok, the above now works with #1306, but more deeply nested doesn't:
$ tree aa├── __init__.py├── b.py└── c ├── __init__.py └── d.py(lf) repos/lpython(nested_modules_02) $ cat a/c/d.py def g(): print("a.c.g() called")(lf) repos/lpython(nested_modules_02) $ cat r.py from a.b import ff()from a.c.d import gg()(lf) repos/lpython(nested_modules_02) $ python r.py b.f() calleda.c.g() called(lf) repos/lpython(nested_modules_02) $ lpython r.pysemantic error: Could not find the module 'a/c.d.py'. If an import path is available, please use the `-I` option to specify it --> r.py:3:1 |3 | from a.c.d import g | ^^^^^^^^^^^^^^^^^^^ Note: if any of the above error or warning messages are not clear or are lackingcontext please report it to us (we consider that a bug that needs to be fixed).
I can't think of any case that doesn't work, so I am going to close this issue as fixed. If we discover more things that don't work, I'll open a new issue.
Activity
certik commentedon Nov 16, 2022
@Thirumalai-Shaktivel any idea why this does not work?
Thirumalai-Shaktivel commentedon Nov 17, 2022
Currently, we don't support
Instead, this works:
I will try to work on this soon.
Thirumalai-Shaktivel commentedon Nov 18, 2022
Fixed here: #1306
certik commentedon Nov 18, 2022
Ok, the above now works with #1306, but more deeply nested doesn't:
Thirumalai-Shaktivel commentedon Nov 19, 2022
Fixed here: #1315
certik commentedon Nov 20, 2022
I think it works now!
I can't think of any case that doesn't work, so I am going to close this issue as fixed. If we discover more things that don't work, I'll open a new issue.
@Thirumalai-Shaktivel, @czgdp1807 are we ready now to start making Python packages that compile with LPython?
Thirumalai-Shaktivel commentedon Nov 21, 2022
I came across another issue that doesn't work yet. Like for this example:
Error:
I will try to work on this later this week. After that, I think we are ready to start making python packages.
certik commentedon Nov 21, 2022
Can you open up a dedicated issue for this and close this issue?
czgdp1807 commentedon Nov 21, 2022
At least I will start writing code in a modular way and compile it using LPython. Probably by the end of this week or early next week.
Thirumalai-Shaktivel commentedon Nov 21, 2022
Yup, that would be very helpful. That way, we can test and report any bugs.
Thirumalai-Shaktivel commentedon Nov 21, 2022
I referenced this as a new issue.
certik commentedon Nov 21, 2022
Thanks!
#1317