First time here? Check out the FAQ!
1

Further auto-completion testing on wing in debug mode for aiida package.
 

Hi,

This is some further tests for using wing to give auto-completion suggestions for aiida package in debug mode.

For testing it, you should still from within virtualbox vm described here: https://ask.wingware.com/question/182...

from aiida import load_profile
load_profile()
from aiida.orm import load_node

node=load_node('be52abbf-8e3a-4e64-afc0-cb6fd471ad94') 
for i in dir(node.inputs): 
     if not i.startswith('_'): 
         print(i)

The above code snippet should gives the following output:

code
kpoints
parameters
parent_folder
pseudos__As
pseudos__Ga
structure

But when I enable the debug mode, I cannot find auto-completions for them. For example, when I input node.inputs.c<tab>, wing won't give code as one of the candidates.

Any hints for this problem?

Regards

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
hongyi-zhao's avatar
557
hongyi-zhao
asked 5 years ago, updated 5 years ago

Comments

I haven't been able to reproduce (downloading the virtualbox image is taking hours), but could you try checking Allow Calls in Data Inspection on the Debugger: Data Inspection page of the Preferences dialog? This will allow __dir__() methods to be called when getting symbols for autocomplete lists. It's off by default because a __dir__() method could potentially be buggy and you don't want the debugger displaying incorrect info when you're trying to debug something.

Wingware Support's avatar Wingware Support (5 years ago)

Try this directly in the host's aiida without using virtualbox vm:

$ curl -L 'https://github.com/aiidateam/aiida-core/blob/develop/tests/fixtures/calcjob/arithmetic.add.aiida?raw=true' -o arithmetic.add.aiida

$ verdi import arithmetic.add.aiida

For test, revise the code snippet given by me as following:

change

node=load_node('be52abbf-8e3a-4e64-afc0-cb6fd471ad94')

to

node= load_node('9d3fda4f-6782-4441-a276-b8965aa3f97f')

Side note, I've enable the preference Allow Calls in Data Inspection, but has no effect on this problem. Another note, I also noted that even in ipython, it also not gives suggestions on these names.

hongyi-zhao's avatar hongyi-zhao (5 years ago)

Did you try changing your Allow Calls in Data Inspection preference? I think there's a good chance that it will fix your problem. I did get the image to download and will be looking at it tomorrow.

Wingware Support's avatar Wingware Support (5 years ago)

I unchecked the preference Allow Calls in Data Inspection, now only the names begin with _ are suggested. But it's obviously then I don't want these at all. I want to obtain the suggestions starting without _.

hongyi-zhao's avatar hongyi-zhao (5 years ago)
see more comments

1 Answer

0

The debugger's inspection of attributes is failing because getattr(node.inputs, '__all__', None) is raising an exception and Wing's debugger isn't handling it. This is arguably a bug in the class of node.inputs and it or something similar may be the reason ipython also has problems. We'll work around this problem in a future Wing release.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Wingware Support's avatar
4.3k
Wingware Support
answered 5 years ago, updated 5 years ago
link

Comments

Thanks a lot for your analysis, I've posted this comment on the aiida's google group for their developers' referring on.

hongyi-zhao's avatar hongyi-zhao (5 years ago)
see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)