Home > Blockchain >  Python print statement ambiguity
Python print statement ambiguity

Time:01-19

I am running the following print statement in a file test.py within the Eclipse PyDev environment which gives the required output:

print(f"Epoch {j}: {self.evaluate(test_data)} / {n_test}")

However, when I attempt to run the same code from the file at the command prompt (OSX Terminal), I get the following

% python test.py
Traceback (most recent call last):
  File "test.py", line 7, in <module>
    import simple_nn
  File "/Users/davidklemitz/eclipse-workspace/_neural/simple_nn.py", line 47
    print(f"Epoch {j}: {self.evaluate(test_data)} / {n_test}")
                                                            ^
SyntaxError: invalid syntax

Anybody have some clues to resolve the issue, thanks ?

CodePudding user response:

Looks like you use two different python versions in Eclipse and your terminal. Try

python3 test.py

in your terminal

  •  Tags:  
  • Related