Ask Your Question
1

Package import under WingIDE debugger

asked 2017-10-17 02:57:00 -0500

Peter Isaac gravatar image

updated 2019-03-13 10:10:40 -0500

Hello WingIDE community,

First post, so respect to those who have gone before and thanks for the help and support.

I'm having trouble importing a package I am developing when running code in Wing's debug mode (Debug/Start/Continue).  The package is installed using pip and shows up correctly under "pip list".  I can also import the package and associated modules correctly using vanilla Python (including the Python shell in the Wing IDE) and the Jupyter notebook.

Basic details are:

  • OS Ubuntu 16.04 with Anaconda3 Python 3.6.0 distribution.
  • Wing Pro 6.0.5-1 with project properties setting the Python executable to the Anaconda installation.

Running in debug mode, the package imports OK using "import pfp" but any attempt to import modules from the package using e.g. "from pfp.scripts import pfp_compliance" results in the exception:

builtins.ModuleNotFoundError: No module named 'pfp.scripts'; 'pfp' is not a package

And yet, as outlined above, the same lines work fine in the WingIDE Python shell, vanilla Python and the Jupyter notebook.

Any help greatly appreciated.

Cheers,

Peter

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2017-10-17 09:16:00 -0500

updated 2019-03-07 07:48:58 -0500

Wingware Admin gravatar image

Using extra info in the email you sent to support@wingware.com I see that the problem is that your script is named pfp.py and the import is finding that first on the Python Path and importing that instead of the real pfp package installed by pip.

This is probably because you have '' or '.' on the Python Path inside Wing and not outside of Wing, or you have the actual path to the directory where your pfp.py is located on the Python Path in Wing.

You can alter this in the Python Path setting in Project Properties. Or, just rename your script since this is a general issue that could reoccur in other environments and cause confusion.

edit flag offensive delete link more

Comments

Hi Wingware Support,

Many thanks for the quick response!  The tyranny of time zones (I'm in Melbourne, Australia) meant I didn't get to see it until just now.

I followed your suggestion to give the top level script a different name than the package name and I am now able to run the top level script (and the package code it uses) in the WingIDE debugger. As with so many problems, the solution is obvious with the benefit of hindsight and I am embarrassed that it didn't occur to me.

Once again, many thanks for the support and for WingIDE!

Cheers,

Peter

Peter Isaac gravatar imagePeter Isaac ( 2017-10-17 17:22:00 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2017-10-17 02:57:00 -0500

Seen: 335 times

Last updated: Mar 07