4

I have code wrote on Windows, compiles and works correctly, but fails on the raspberry pi

wrote some simple test code to see if it spits out the same error

a = input('this is a test string to split at space \n').split()

print(a)

typed 15:00 (need this data point for the bigger project) and i got this error

15:00
Traceback (most recent call last):
  File "test.py", line 1, in <module>
    a = input('this is a test string to split at : \n').split(':')
   File "<string>", line 1
    15:00
      ^
 SyntaxError: invalid syntax

then tried 15 00 at the request of someone on discord, got this message

15 00
Traceback (most recent call last):
  File "test.py", line 2, in <module>
    a = input('this is a test string to split at : \n').split(':')
  File "<string>", line 1
    15 00
        ^
SyntaxError: unexpected EOF while parsing
Luka
  • 43
  • 4

1 Answers1

1

You may be running different versions of python from windows to Raspberry Pi.

Thanks to this answer:

Note: this is only for Python 2. For Python 3, raw_input() has become plain input() and the Python 2 input() has been removed.

Reference

a = raw_input('this is a test string to split at space \n').split(':')

print(a)

enter image description here

Durdu
  • 4,649
  • 2
  • 27
  • 47