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

13,665

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.

Share:
13,665

Related videos on Youtube

Connor Spangler
Author by

Connor Spangler

Passion is a close competitor of competency when it comes to measuring the value of a software developer in today's saturated market, which is why I've always taken great pride in embodying both to the fullest extent. My journey with programming started in middle school with basic self-taught video game and script development, and exploded into a career of software development ranging from simple quality of life utilities to full-blown enterprise software solutions for some of the most respected private and federal institutions in the nation. Throughout these experiences, my almost intractable ethos that good software written today saves bad time and money tomorrow has been the defining factor in the quality of the solutions that I develop and manage. Languages and Frameworks: C++/C Qt Java/Maven/JUnit Python PHP MySQL/PostgreSQL/pgTAP Verilog HTML/CSS/JavaScript x86 Assembly (ASM) Propeller Assembly Language (PASM)/Propeller Spin Systems: *NIX Microchip PIC Microcontrollers Parallax Propeller Microcontrollers Intel Cyclone FPGA Arduino/AVR Microcontrollers Raspberry Pi Other Platforms: PCB Design Amazon Web Services (AWS) Git/GitHub/GitLab/BitBucket/Mercurial Docker Jenkins SonarQube JIRA Confluence

Updated on September 15, 2022

Comments

  • Connor Spangler
    Connor Spangler over 1 year

    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.

  • Connor Spangler
    Connor Spangler almost 8 years
    I swear to God I copied and pasted the raw link, it's a conspiracy! Thanks for pointing out the obvious!