kelvinau / crypto-arbitrage

Automatic Cryptocurrency Trading Bot using Triangular or Exchange Arbitrages
MIT License
713 stars 193 forks source link

SyntaxError: invalid syntax #10

Closed ristono closed 6 years ago

ristono commented 6 years ago

C:\Users\Ariez\Desktop\crypto-arbitrage-master>python main.py -m triangular File "main.py", line 25 print 'Mode {0} is not recognized'.format(args.mode) ^ SyntaxError: invalid syntax

What is wrong?

surugh commented 6 years ago

hat is because in Python 3, they have replaced the print statement with the print function.

The syntax is now more or less the same as before, but it requires parens:

From the "what's new in python 3" docs:

Old: print "The answer is", 2*2
New: print("The answer is", 2*2)

Old: print x,           # Trailing comma suppresses newline
New: print(x, end=" ")  # Appends a space instead of a newline

Old: print              # Prints a newline
New: print()            # You must call the function!

Old: print >>sys.stderr, "fatal error"
New: print("fatal error", file=sys.stderr)

Old: print (x, y)       # prints repr((x, y))
New: print((x, y))      # Not the same as print(x, y)!
AKimmel commented 6 years ago

This error wants parentheses around the print statement. print ('Mode {0} is not recognized'.format(args.mode))

ristono commented 6 years ago

thanks, how about this

File "C:\Users\Ariez\Desktop\crypto-arbitrage-master\engines\triangular_arbitrage.py", line 19 print strftime('%Y%m%d%H%M%S') + ' starting Triangular Arbitrage Engine...' ^ SyntaxError: invalid syntax

surugh commented 6 years ago

Old: print # Prints a newline New: print() # You must call the function!

kelvinau commented 6 years ago

Sorry this is written in Python 2 syntax. Quite a few people used Python 3 and asked me about the same issue. I am updating the readme to explicitly mention this.