SyntaxError when executing *.sh file

mcmacker4

macrumors newbie
Original poster
Aug 13, 2012
28
0
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)
 
Last edited:

lee1210

macrumors 68040
Jan 10, 2005
3,182
1
Dallas, TX
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
 

mcmacker4

macrumors newbie
Original poster
Aug 13, 2012
28
0
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?
 

kryten2

macrumors 6502a
Mar 17, 2012
999
60
Belgium
Notes for the releases
Release 7.0a is an awesome update for MCP 7.0 - it now contains the fernflower decompiler after we got permission to distribute it with the MCP toolkit. All future updates will use fernflower as default decompiler and the JAD based tools were removed in MCP 7.2 and later versions.
The newest feature in MCP 6.0 (and higher) is the addition of javadoc comments in the decompiled source code. You can find links to those javadocs on the main page of this wiki.
Read the README-MCP.txt file in the docs folder for more information after you unzipped the file.
You need to install Python 2.7 on OSX and Linux to use this version. On Windows installing Python 2.7 is optional. If you have python 3.x installed it will not work, this will be fixed soon.
Feedback is appreciated.
What version of python are you running? To check in Terminal :

Code:
python -V
 

mcmacker4

macrumors newbie
Original poster
Aug 13, 2012
28
0
What version of python are you running? To check in Terminal :

Code:
python -V
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.
 

mcmacker4

macrumors newbie
Original poster
Aug 13, 2012
28
0
I installed 3.0.1 and the SyntaxError still appears. I don't know what to do.
 

itickings

macrumors 6502a
Apr 14, 2007
924
5
I installed 3.0.1 and the SyntaxError still appears. I don't know what to do.
Have you tried installing 2.7, like the page you link to says?

You need to install Python 2.7 on OSX and Linux to use this version. On Windows installing Python 2.7 is optional. If you have python 3.x installed it will not work, this will be fixed soon.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.