Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange HTML doctype error when trying to run Python script from bash

I have a bash script which is supposed to call a Python script stored on GitHub and run it with arguments:

#!/bin/bash +x

wget https://github.place.otherplace.com/myrepo/repo_folder/blob/Python/pythonScript.py
chmod +x pythonScript.py
python pythonScript.py

I'm getting the following response: HTTP request sent, awaiting response... 200 OK Length: unspecified [text/html] Saving to: ‘DisputeSystem.py’

 0K .......... .......... .......... ........               795K=0.05s

2016-06-14 11:08:24 (795 KB/s) - ‘pythonScript.py’ saved [39657]

  File "pythonScript.py", line 4
    <!DOCTYPE html>
    ^
SyntaxError: invalid syntax
Build step 'Execute shell' marked build as failure
[BFA] Scanning build for known causes...
[BFA] No failure causes found
[BFA] Done. 0s
Finished: FAILURE

I figure it has something to do with wget pulling the HTML headers as well, but I haven't been able to figure out a way to strip them. Any help is appreciated.

like image 905
Connor Spangler Avatar asked Jul 16 '26 13:07

Connor Spangler


1 Answers

You're not downloading the script. You're downloading a GitHub web page with the script and a whole bunch of other stuff on it, like GitHub navigation and a search bar and clickable line numbers.

Go to that page in your web browser, and you should see a "Raw" link. Click on that, and the resulting page is what you should be wgetting.

like image 117
user2357112 supports Monica Avatar answered Jul 19 '26 01:07

user2357112 supports Monica



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!