First time here? Check out the FAQ!
1

Making Code Warnings aware of print_function

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 7.2.0.1, Python 2.7.12)

Thanks

s0lstice's avatar
11
s0lstice
asked 2020-01-22 09:04:09 -0500
Wingware Support's avatar
4k
Wingware Support
updated 2020-01-22 14:57:28 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

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.

Wingware Support's avatar
4k
Wingware Support
answered 2020-01-22 20:14:59 -0500
edit flag offensive 0 remove flag delete link

Comments

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's avatar s0lstice (2020-01-23 02:06:22 -0500) 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's avatar Wingware Support (2020-01-23 04:44:16 -0500) edit
add a comment 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