Ask Your Question
1

Failed to run/debug pdfarranger from wing IDE: builtins.ImportError: attempted relative import with no known parent package.

asked 2022-01-05 07:33:53 -0600

hongyi-zhao gravatar image

I try to run/debug pdfarranger from wing IDE, using a virtualenv created as follows:

$ sudo apt-get -y install python-is-python3 python3-virtualenv python3-pip python3-distutils-extra python3-wheel python3-gi python3-gi-cairo gir1.2-gtk-3.0 gir1.2-poppler-0.18 python3-setuptools
$ pyenv shell system
$ pyenv virtualenv --system-site-packages pdfarranger

When I try to run the main file of pdfarranger, the following error is triggered:

image

Any hints for fixing this problem? See here for relevant discussion.

Regards, HZ

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-01-05 09:49:28 -0600

updated 2022-01-06 10:17:50 -0600

Many modules in packages such as pdfarranger.py are not meant to be run as scripts. If you ran 'python /path/to/pdfarranger.py', you should get the same exception. You probably want to start the debugger with the module / script used to run the program. According to the README in the pdfarranger project, it's run via python3 -m arranger. To debug in Wing, set the python path so it includes the parent directory of the pdfarranger package directory and create a named entry point using the Named Module option with pdfarranger as the the module name.

More details on how to run / debug:

  1. One way to add the parent directory of the pdfarranger package directory to the python path is to add it in the Project Properties dialog -- image description

  2. To create a named entry point, use Debug > Debug Named Entry Point > Manage Named Entry Points to display the dialog for all named entry points and then click the plus icon to add a new one. Select the Named Module option and enter pdfarranger as the the module name -- image description

edit flag offensive delete link more

Comments

To debug in Wing, set the python path so it includes the parent directory of the pdfarranger package directory and create a named entry point using the Named Module option with pdfarranger as the the module name.

I am still confused by your above description. Can you give me more detailed information?

hongyi-zhao gravatar image hongyi-zhao  ( 2022-01-05 18:19:51 -0600 )edit

I edited the above answer to add detail because comments can't include images

Wingware Support gravatar image Wingware Support  ( 2022-01-06 10:19:20 -0600 )edit

Thanks a lot. It works as expected.

hongyi-zhao gravatar image hongyi-zhao  ( 2022-01-06 17:53:33 -0600 )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: 2022-01-05 07:33:53 -0600

Seen: 35 times

Last updated: Jan 06