0

After installing both by moving them into the Lib folder of my python installation, I get this error when trying to import cocos.

Traceback (most recent call last):
  File "C:/Users/test/PycharmProjects/Testing/main.py", line 1, in <module>
    import cocos
  File "C:\Python34\lib\cocos\__init__.py", line 69, in <module>
    import os, pyglet
  File "C:\Python34\lib\pyglet\__init__.py", line 276
    print '[%d] %s%s %s' % (thread, indent, name, location)
                   ^
SyntaxError: invalid syntax
CodeSmile
  • 64,284
  • 20
  • 132
  • 217
Connorelsea
  • 2,308
  • 6
  • 26
  • 47

1 Answers1

1

You are using Python 3, but attempting to use Python 2's print statement. In Python 3 the print statement was changed to a print function. Try:

print('[%d] %s%s %s' % (thread, indent, name, location))

You can also use a newer way to format strings in Python 3:

print('{:0d} {}{} {}'.format(thread, indent, name, location))
NSchrading
  • 144
  • 1
  • 13