Ask Your Question

Making Code Warnings aware of print_function

asked 2020-01-22 09:04:09 -0600

s0lstice gravatar image

updated 2020-01-22 14:57:28 -0600

If I use the following at the top of a Python source file, to replace the print statement with a print function:

from __future__ import print_function

subsequent lines such as:

print("hello world", end = '')

execute correctly, but are highlighted with SyntaxError by the IDE. It appears the IDE is expecting a print statement. How do I make it aware of the __future__ import? (Wing Pro, Python 2.7.12)


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-01-22 20:14:59 -0600

Right now Wing shows those warnings if you are using Python 2 and isn't looking for the from __future__ import. I think the issue is actually the end='' part and it shouldn't flag other print()'s that don't have that. So it may be that just hovering over the error and clicking the red X to disable that warning will serve as a work-around, if there are not too many of them. They can safely be ignored in any case.

edit flag offensive delete link more


Yes, the issue only arises when setting sep, end, or file in a print function. Unfortunately, Code Warnings sees this as a 'SyntaxError', and doesn't offer a red X. In my current project I have quite a few, and they are difficult to ignore, as the red squiggle extends to the end of the source line, including any comment.

s0lstice gravatar image s0lstice  ( 2020-01-23 02:06:22 -0600 )edit

I can confirm that this is a problem and that they cannot be removed because they are identified as syntax errors. We'll try to fix this soon.

Wingware Support gravatar image Wingware Support  ( 2020-01-23 04:44:16 -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: 2020-01-22 09:04:09 -0600

Seen: 208 times

Last updated: Jan 22 '20