I have:

```
filename = input()
with open(filename) as file:
    print('It opened.')

```

saved on my desktop as "test.py".

I run it from the terminal, and get:

```
blahblahblah:~ rickyd$ python /users/rickyd/desktop/test.py
/users/rickyd/desktop/tryme.txt
Traceback (most recent call last):
  File "/users/rickyd/desktop/test.py", line 1, in <module>
    filename = input()
  File "<string>", line 1
    /users/rickyd/desktop/tryme.txt
    ^
SyntaxError: invalid syntax

```

When I run it in the shell, it works perfectly:

```
>>> ================================ RESTART ================================
>>> 
/users/rickyd/desktop/tryme.txt
It opened.
>>> 

```

Why isn't it working in the terminal?

Is there any way to make sure that (at least for code not explicitly designed to do otherwise)
the shell and the terminal will give the same behavior, so I won't have to check both separately?