[SOLVED] Does anyone know of a way to build Python code through Sublime Text 3?

I’m just starting to learn Processing, and I wanted to learn it using Python, but I’m used to the sublime text 3 environment. I just set up the Sublime Text 3 Processing package, but I can’t seem to figure out how to make it build Python Processing code instead of Java Processing code. In the mean time I’ve been just opening the .pyde file with Sublime Text and coding that way, but it would be very cool if I could also use Sublime Text to build my codes as well. Many thanks in advance!

1 Like

I had a quick crack at this and managed to get it working using the Sublime build system.

  1. Download the command line version of Processing.py here:
    https://py.processing.org/tutorials/command-line/
    I’m on a Mac at the moment, so I grabbed this file:
    http://py.processing.org/processing.py-macosx.tgz

  2. Extract the file wherever you please, but take note of the folder path.

  3. Then, in Sublime, create a new build system (Tools > Build System > New Build System…). Add the code below and save it as “Processing.py.sublime-build”, or whatever name makes sense to you (of course, you’ll have to substitute the /PATH/TO/YOUR/FOLDER/ part).

{
    "cmd": ["java", "-jar", "/PATH/TO/YOUR/FOLDER/processing-py.jar", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
}
  1. Create a new file in Sublime. First save it; using a .pyde file extension would make sense. Add some Processing.py code – maybe something simple, like a rectangle.

  2. Activate your new build system (Tools > Build System > Processing.py).

  3. Use Tools > Build (or ⌘B) to run the sketch.

Let me know if you run into any problems.

3 Likes

Hi! Thank you for the reply! I made the new build system for Sublime and tried executing a .pyde program, but I got a java.awt.HeadlessException error. I tried executing the program through the terminal via java -jar processing-py-natives-linux-amd64.jar ~/Path/To/File/testing_Processing_py.pyde and I get a no main manifest attribute, in processing-py-natives-linux-amd64.jar which makes me think its an issue with my version of Java. I did, however, successfully execute my program using processing-py.sh.

Edit: I got it working! I used this tutorial from Stack Overflow to try and combat the java.awt.HeadlessException error message and added a pom.xml file sourced from this tutorial to the same directory my processing-py.jar file was located and that did the trick! Thank you so much for your time @tabreturn !

1 Like

Even I was also facing the no main manifest attribute,in processing-py-natives-linux-amd64.jar error
I have made it working using this tutorial. Thank you for all the details and replies.