SyntaxError when executing *.sh file

Discussion in 'Mac Basics and Help' started by mcmacker4, Sep 30, 2012.

  1. mcmacker4, Sep 30, 2012
    Last edited: Sep 30, 2012

    mcmacker4 macrumors newbie

    Joined:
    Aug 13, 2012
    #1
    Whenever I try to do this it tells me this:
    Code:
    macpro:mcp72 mcmacker4$ bash /Users/mcmacker4/Desktop/mcp72/decompile.sh 
    /Users/mcmacker4/Desktop/mcp72/runtime/commands.py:137: Warning: 'with' will become a reserved keyword in Python 2.6
    Traceback (most recent call last):
      File "runtime/decompile.py", line 13, in <module>
        from commands import Commands, CLIENT, SERVER, CalledProcessError
      File "/Users/mcmacker4/Desktop/mcp72/runtime/commands.py", line 137
        with open(csvfile, 'rb') as fh:
                ^
    SyntaxError: invalid syntax
    This is a .sh file I have to run to decompile some files to be able to modify a game called Minecraft (it uses Java)
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    It looks like this shell script is a thin wrapper around a python script, and it looks like it uses language features that are not included in the version of python included with your version of the OS. You probably need to get a new version of python, then modify the shell script to use that version rather than the default version.

    -Lee
     
  3. mcmacker4 thread starter macrumors newbie

    Joined:
    Aug 13, 2012
    #3
    SyntaxError when executing *.sh file

    Hi everyone,

    I opened this tread because i couldn't find the answer to my problem anywhere.

    My problem is that I want to make mods for a game called Minecraft. To do this, the developers of this game released the MCP (Minecraft Coder Pack) which you can use to decompile and compile the game. This folder (mcp is a folder) contains .sh files to execute .py files, which decompile/compile the game.

    What i have to do is run a file called decompile.sh in the terminal by changing the directory to the folder containing the file and then execute it with
    Code:
    bash /Users/mcmacker4/Desktop/mcp72/decompile.sh
    Now, when i do so i get an error message in terminal that says this:

    Code:
    macpro:~ mcmacker4$ cd /Users/mcmacker4/Desktop/mcp72 
    macpro:mcp72 mcmacker4$ bash /Users/mcmacker4/Desktop/mcp72/decompile.sh 
    /Users/mcmacker4/Desktop/mcp72/runtime/commands.py:137: Warning: 'with' will become a reserved keyword in Python 2.6
    Traceback (most recent call last):
      File "runtime/decompile.py", line 13, in <module>
        from commands import Commands, CLIENT, SERVER, CalledProcessError
      File "/Users/mcmacker4/Desktop/mcp72/runtime/commands.py", line 137
        with open(csvfile, 'rb') as fh:
                ^
    SyntaxError: invalid syntax
    I wached some videos about how to use the MCP Folder on a Mac but no one had this error.

    If anyone wants to download the folder and investigate you can download the MCP here: http://mcp.ocean-labs.de/index.php/MCP_Releases

    Please help me.

    Anyone has an idea of why this is happening?
     
  4. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #4
    What version of python are you running? To check in Terminal :

    Code:
    python -V
     
  5. mcmacker4 thread starter macrumors newbie

    Joined:
    Aug 13, 2012
    #5
    Now, i have a problem because Python is available in Mac 32bit with 10.3 to 10.5 (included) and Mac 64bit 10.6 and 10.7

    I'm running on Mac OS X 10.5 with a 64bit processor. Which one should i install? I'm confused with this compatibility.
     
  6. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #6
    I believe as of Snow Leopard OSX had the ability to run a 64bit kernel. Don't know for certain you might want to look that up on Google. To be on the safe side I'd use this version : http://www.python.org/ftp/python/2.7.3/python-2.7.3-macosx10.3.dmg Won't do any harm as it would just be your 64bit OS running 32bit software.
     
  7. mcmacker4 thread starter macrumors newbie

    Joined:
    Aug 13, 2012
    #7
    I installed 3.0.1 and the SyntaxError still appears. I don't know what to do.
     
  8. itickings macrumors 6502a

    itickings

    Joined:
    Apr 14, 2007
    #8
    Have you tried installing 2.7, like the page you link to says?

     
  9. mcmacker4 thread starter macrumors newbie

    Joined:
    Aug 13, 2012
    #9
    I just did, AND IT WORKS!!! Thank you very much man! In fact THANK YOU ALL for all this help :) :apple:

    Finally...
     

Share This Page