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.

autocompletion on subpackages not working

See original GitHub issue

Hi, I cannot get autocompletion to work on some custom python packages. I have added my custom package path in user sublime settings as:

"python_package_paths": [
     // path for package
    "/home/ilias/modules/lib/python2.7/site-packages/moduleA",
    ],

Autocompletion works fine for the functions declared in the __init__.py file of moduleA by writing:

import ModuleA as MA
MA.read_files()

In the same directory however, I also have some other .py subpackages (e.g. mergefunct.py) which include additional functions. In my main code, I can normally import and call these as:

import ModuleA.mergefunct as mergefunct
mergefunct.perform_merging()

Autocomplete locates the package mergefunct under ModuleA, but as soon as I press ‘dot’ to use the functions inside it, it doesn’t detect the functions at all. Furthermore, after this autocompletion no longer works even for normal python functions as math or numpy etc. and I need to restart sublime to get it working again.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
srusskihcommented, Aug 21, 2017

@iliasptr about example that you provided. Yes, this all about how python discovers packages and modules. When I tried to complete package name in othermodule.py on import linefrom python (and jedi) I were unable to see mypackage, because mypackage is not in python path.

For this, specific, case, I have changed example.sublime-project in next way

{
	"folders":
	[
		{
			"path": ".",
		}
	],
    "settings": {
        "python_package_paths": [
            "$project_path"
        ]
    }
}

And restarted sublime text (!) to restart completion daemon with new settings (yeah, restart required when new extra package appears in settings).

And completion works (:

We pointed python to a directory when it should looks for packages.

0reactions
srusskihcommented, Aug 22, 2017

@iliasptr please reopen the issue if you still have a problem with this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sub-packages and auto-completion
So I can provide some clarification and a workaround. Clarification. First off, this only triggers on the EndPackage :.
Read more >
Sub-packages and auto-completion - Wolfram Community
Wolfram Community forum discussion about Sub-packages and auto-completion. Stay on top of important topics and build connections by joining Wolfram ...
Read more >
r/learnpython - Autocomplete for packages and "sub ... - Reddit
Autocomplete for packages and "sub-packages" works in Spyder and Jupyter/IPython, but not ... In case anyone else has the same problem:.
Read more >
How to enable autocomplete (IntelliSense) for python package ...
I've found a solution, but I would appreciate some explanation from someone more experienced with Python: import package.module as module.
Read more >
Code autocomplete does not recognize custom packages
It seems that custom packages are not still handled properly by the code editor as the code editor does not offer my sub-packages,...
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