marekq / list-ec2

List all EC2 instances in an AWS account using AWS API keys.
1 stars 3 forks source link

Invalid syntax in line 105 #1

Open mofoster opened 7 years ago

mofoster commented 7 years ago

Hi, it's a great script, 100% fit my needs, however I am getting the following error when I try to run under window...

C:\python\list-ec2-master>python list-ec2.py File "list-ec2.py", line 105 print y[:-2].strip() ^ SyntaxError: invalid syntax

Thanks ;)

marekq commented 7 years ago

Make sure you are running the script using Python 2 instead of Python 3 - the syntax for i.e. print statements is different depending on the version, I get exactly the same issue on my Mac;

macbook:list-ec2 marekku$ python3 list-ec2.py 
  File "list-ec2.py", line 105
    print y[:-2].strip()
          ^
SyntaxError: invalid syntax

Once you try running with python 2.7 (which is usually just called 'python' on Mac/Linux), it should work well. You can check the version of Python installed by running 'python -v' on the command line.

Let me know if this solves the issue for you.

mofoster commented 7 years ago

Thanks for your prompt response, yes this does works under my ubuntu box. btw does the name tag still working for you? Mine has been showing blanks

marekq commented 7 years ago

I've just pushed an update that should print all the EC2 tags you defined for an instance. Let me know if it works now.