0

(Note - this is a separate issue from one previously reported. The older report was Netbeans 7.x which did not yet support Python 3.x.)

Netbeans with Python treats f-string as error.

Netbeans IDE 8.0.2. Python project platform set Python 3.7.3. I can copy and paste the code snip into Idle without a problem. However, in Netbeans the f-string sets a "No viable alternative at input '"{fn} {ln}"' I've tried single quote f'{fn} {ln}' and parentheses f('{fn} {ln}').

fn = "Joe"
ln = "Blow"
full_name = f'{fn} {ln}'
print (full_name)
fname = fn + ln
print (fname)

from sys import version_info
print(version_info)

Strangely enough, both print statements function as expected. Output follows:

Joe Blow JoeBlow sys.version_info(major=3, minor=7, micro=3, releaselevel='final', serial=0)

I inserted the version_info call to ensure I was getting a Python newer than 2.7.

L. Price
  • 11
  • 2
  • It would seem you python code is perfectly fine, and Netbeans which is either mis-configured or has a bug. – Aaron Jun 28 '19 at 19:53
  • Possible duplicate of [NetBeans complains, but the code runs](https://stackoverflow.com/questions/34969930/netbeans-complains-but-the-code-runs) – skomisa Jun 28 '19 at 21:44
  • The circumvention for your problem is to upgrade to NetBeans 8.2 or later. Earlier releases did not officially support Python 3.x, as documented in [Bug 257702 - The plugin is running 3.5, but the syntax checking is 2.](https://netbeans.org/bugzilla/show_bug.cgi?id=257702) – skomisa Jun 28 '19 at 21:46

0 Answers0