First time here? Check out the FAQ!
1

A weird problem: no auto-completion for Text IO Stream in Editor
 

As you can see, when I type in python shell everything is fine, but in Editor Wing can't recognize variable"temp"is a TextIO. Source Assistant doesn't respond either. 

But Wing Pro 5 doesn't have this problem.

Screenshot : http://www.dumpt.com/img/viewer.php?f...

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)
woodword's avatar
11
woodword
asked 7 years ago
Wingware Support's avatar
4.2k
Wingware Support
updated 5 years ago

Comments

see more comments

2 Answers

1

Thanks, I see this too.  For me at least with Python 3.6 (and probably all Python 3.x versions) Wing completely fails to determine type of f after f = open().  This is a bug.  It works with Python 2.x so I think it's something conflicting with this particular builtin, and possibly others.  Thanks for reporting this!

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.2k
Wingware Support
answered 7 years ago
Wingware Admin's avatar
270
Wingware Admin
updated 6 years ago
link

Comments

see more comments
0

I can't seem to see the editor screenshot (bad url, and in any case AllAnswered seems to have made a mess of your post).  However, this is most likely a difference between the capabilities of static analysis and runtime analysis.  In the editor, Wing uses static analysis and that cannot determine the type of everything. 

One solution is to run to a breakpoint in the context you want to edit and then Wing also uses runtime analysis in the editor. 

Another possibility is to add things like "isinstance(temp, TextIO)" to code or to use Python 3.x type annotations. 

There are some details on the options here:  http://wingware.com/doc/edit/helping-...

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.2k
Wingware Support
answered 7 years ago
Wingware Admin's avatar
270
Wingware Admin
updated 6 years ago
link

Comments

the editor screenshot is here http://www.dumpt.com/img/viewer.php?file=pgb330yi6bfm3cso7imk.jpg and WingIDE should easily identify a variable A is a TextIO if you use " A = open(you_file)"

woodword's avatar woodword (7 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)