Ask Your Question

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

asked 2017-05-07 22:08:00 -0600

woodword's avatar

updated 2020-01-22 19:55:18 -0600

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 :

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2017-05-09 09:00:00 -0600

updated 2019-03-07 07:15:45 -0600

Wingware Admin's avatar

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!

edit flag offensive delete link more

answered 2017-05-08 08:46:00 -0600

updated 2019-03-07 07:14:56 -0600

Wingware Admin's avatar

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:

edit flag offensive delete link more


the editor screenshot is here and WingIDE should easily identify a variable A is a TextIO if you use " A = open(you_file)"

woodword's avatar woodword  ( 2017-05-09 01:25:00 -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



Asked: 2017-05-07 22:08:00 -0600

Seen: 817 times

Last updated: Mar 07 '19