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.

Automatic Model imports don't work!

See original GitHub issue

When I run shell_plus, it instantly prints out all the models it found in all my apps. Then it gives me these nice lines, which imply that the classes were really auto-imported, which is so impressive and reassuring:

Shell Plus Model Imports
from b2bpay.apps.transactions.models import Attachment

But they aren’t! Why not? Why is it printing stuff out when it hasn’t actually imported anything?

In [2]: Attachment
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-2-c74e9844aceb> in <module>()
----> 1 Attachment

NameError: name 'Attachment' is not defined

So I even defined SHELL_PLUS_POST_IMPORTS:

Shell Plus User Imports
from b2bpay.apps.onboard.models import *
from b2bpay.apps.wizard.models import *

But again, no class got imported.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gabn88commented, Jul 10, 2018

Same problem here with ipython on a clean ubuntu 18.04 install. On my previous Ubuntu 16.04 everything was working fine. Now resolved to bpython, which does work!

1reaction
typeshigecommented, Nov 9, 2016

If I don’t use ipython (shell_plus --plain), the auto imports work fine.

–bpython also works fine.

It’s strange since I have another project with the same versions of extension, django and ipython and it works just fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Auto-import doesn't work · Issue #28 · microsoft/pylance-release
The auto-import still is not working in some cases. I have defined variable (type alias) ImagePil = PIL.Image.Image in one module. When I...
Read more >
Visual Studio Code Automatic Imports - typescript
Yes, auto-imports work great on Mac out of the box regardless of if your project's version of typescript matches with what shipped with...
Read more >
Confused as to why this import is not mapping automatically
I am trying to build a process where end users can upload values into an input module. Ideally they can export out the...
Read more >
Auto import | WebStorm Documentation - JetBrains
In JavaScript and TypeScript files, WebStorm automatically adds import statements for modules, classes, components, and any other symbols ...
Read more >
import - JavaScript - MDN Web Docs - Mozilla
Modules are automatically interpreted in strict mode. There is also a function-like dynamic import() , which does not require scripts of ...
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