0

I would like to download financial reports from Google Finance and i have discovered this gist and from this SO answer. However i am used to downloading a git repository go to the file directory where the downloaded git is and with the use of the cmd excecute the setup.py to setup and then use the git in my machine.

However once I download the gist i get

  • pax_global_header
  • A folder named gist6952087-f454536fdd54c47d42017aa1e9f286524b9bd9e8 which inside has a gistfile1.txt

How can i actually put this thing to work with my python from the cmd?

EDIT

I have tried to do this:

C:\Users\Μαρίνος\Desktop\New folder\gist>python gistfile1.py -h
  File "gistfile1.py", line 72
    except Exception, _:
                    ^
SyntaxError: invalid syntax

And it throws an error

Community
  • 1
  • 1
Codo
  • 271
  • 3
  • 10
  • 24

1 Answers1

1

gistfile1.txt is the script; the gist author just didn't give it a name.

If you want, give it a name with a .py extension instead, and run the script with Python:

python gistfile1.py -h

gives you the command-line help message.

Do make sure you have pyquery installed first.

The file is written for Python 2. If you have Python 3 installed, it is easy enough to have it converted:

python3 -m lib2to3 -w gistfile1.py

This will replace the script with one that will work just fine on Python 3.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • Just a sec let me test – Codo May 30 '14 at 17:46
  • Do i need to `python gistfile1.py install` or not? I will try to use it at once – Codo May 30 '14 at 17:50
  • 1
    @Codo: no, this is not a package. It's just *one script*. – Martijn Pieters May 30 '14 at 17:51
  • I did what you have said me but gives me an error `C:\Users\Μαρίνος\Desktop\New folder\gist>python gistfile1.py -h File "gistfile1.py", line 72 except Exception, _: ^ SyntaxError: invalid syntax` – Codo May 30 '14 at 17:53
  • 1
    @Codo: it's a *Python 2* script. You are running it with Python 3. – Martijn Pieters May 30 '14 at 17:54
  • Oh dear! Is there a way to have Python2 and 3 on your machine? I am running an application that works only with Python 3... – Codo May 30 '14 at 17:55
  • 1
    @Codo: you can, they can be installed side by side. – Martijn Pieters May 30 '14 at 17:56
  • Thank you so much! One final question how will my machine actually know how which `python` edition to use when i type say: `python setup.py`? ___when i type this i am going to the downloaded gist directory not in the directory where a Python edition is downloaded – Codo May 30 '14 at 17:57
  • 1
    @Codo: I tested using the Python 2-to-3 conversion tool, and it works fine for this script. Instructions added. – Martijn Pieters May 30 '14 at 18:00
  • 1
    For Windows, read the [Using Python on Windows](https://docs.python.org/3/using/windows.html) documentation, it'll tell you everything you need to know about running multiple versions of Python on a Windows machine, including picking what Python interpreter is used for what script. – Martijn Pieters May 30 '14 at 18:01
  • @Codo: not if you have converted the script with `lib2to3`, you don't. – Martijn Pieters May 30 '14 at 18:04
  • The new converted file has the suffix `bak` which i will remove. :P thank you so much again – Codo May 30 '14 at 18:06
  • @Codo: no, `.bak` is the *back-up*, the unaltered original file; the file itself was re-written. – Martijn Pieters May 30 '14 at 18:08
  • Ohhhhhh oh dear thanks i am a catastrophe on keyboard – Codo May 30 '14 at 18:09