Scientific Mode in PyCharm 2017.3 says "mulitple statements found while compling a single statement" error

已回答

Hello all,

I'm using PyCharm 2017.3 EAP in scientific mode. The console gives a syntax error, though the code is correct.

# Python code

print("Hello world!")

a = 3
b = 1 + 3

# Here's the console output:

Running /usr/Desktop/helloworld.py
Hello world!
>>> a
  File "<input>", line 1
    print('PyDev console: starting.\n')
                                     ^
SyntaxError: multiple statements found while compiling a single statement
>>> a
3
>>> b
4

The syntax error comes up every time after the code is compiled for the first time.

Why is that, is it my problem or is there something in PyCharm that's beyond me?

Thank you!

0

Hi brandenju! Could you please describe your steps in more details? Do you run "Execute Selection in the Console" on this code?

0
Avatar
Permanently deleted user

Hi Pavel. I run hello.py in scientific mode. Here's the 3 lines of code, very simple:

print("Hello world!")
a = 3
b = 1 + 3

Next, I run it by choosing Run in the menu. 

Then, I move to the console, do a REPL. I check the value of a by typing a into the console.

>>> a
  File "<input>", line 1
    print('PyDev console: starting.\n')
                                     ^
SyntaxError: multiple statements found while compiling a single statement
>>> a
3
>>> b
4

As you see, the first time I type in a, the console does not return its value 3. There is an error message.

0

Sorry for the late response. This problem was fixed in the final 2017.3 release: PY-25742. If it's still affects you - please comment.

0

请先登录再写评论。