question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Relative upper-level imports are improperly linked [python]

See original GitHub issue

Consider this code:

from ..models.alphaname import Alphaname
from ..forms.alphaname import AlphanameForm

from ..tasks import submitAlphanameInstantly

Module Linker creates references to:

instead of referring upper-level packages/modules.

However it successfully recognises same-package imports, like:

from .models.campaign import Campaign
from .models.task import Task
from .models.alphaname import Alphaname
from .models.message import Message

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
webknjazcommented, Jan 19, 2018

Also, this https://github.com/fiatjaf/module-linker/blob/d8e2601/languages/python.js#L36-L39 condition looks invalid: it’s never true, the code checks that the string is both empty and starts with a dot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

beyond top level package error in relative import
This is behavior since Python 2 when packages did not yet exist. Making the running directory a package would allow imports of modules...
Read more >
What's wrong with relative imports in Python?
The problem of import icing is that you don't know whether it's an absolute import or a relative import. icing could be a...
Read more >
Proper way of organizing code into subpackages - New to Julia
Hi all, I am in the process of converting a fairly complicated proprietary simulation model that I wrote in Python to Julia 1.5.3....
Read more >
Kaitai Struct User Guide
But sometimes we need just the opposite: how do we access upper-level elements from lower-level types? Kaitai Struct provides two options here: ...
Read more >
Absolute vs Relative Imports in Python
Syntax and Practical Examples; Pros and Cons of Relative Imports ... Watch Now This tutorial has a related video course created by the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found