Processing.py-Bugs icon indicating copy to clipboard operation
Processing.py-Bugs copied to clipboard

Launch sketch from command line?

Open schuelaw opened this issue 10 years ago • 16 comments

With a regular processing sketch, one can launch from the command line using something like:

processing-java --sketch=Conway --output=/tmp/Conway --run

This doesn't work when the sketch was created in python mode. Is there a workaround?

schuelaw avatar Dec 10 '14 18:12 schuelaw

If I'm not wrong, what you are looking for is this: https://github.com/jdf/processing.py#processingpy

diogotito avatar Jul 01 '15 17:07 diogotito

The precise link. Note that on Windows, it would be e.g.

processing-py.bat foo.pyde

although I use the following (rather brittle) .cmd file:

javaw -Xmx1024m -jar "%~dp0\processing-py.jar" "%~1"

as processing-py.cmd foo.pyde

tildebyte avatar Jul 02 '15 16:07 tildebyte

I'm not sure if this has changed since the release of Processing v3 with Python Mode, but I'm not sure where to get processing-py.jar; it's nowhere to be found in the ./modes/PythonMode/ folder found in my processing_sketchbook folder.

Once Python mode is installed, what's the recommended way to run my .pyde file from from the command line? (I've confirmed that processing-java still doesn't work...)

jsundram avatar Mar 28 '16 15:03 jsundram

@jsundram Have you found a solution? I'm stuck with this same problem when trying to build my sketch from Sublime Text with a build system... :'(

b-jufre avatar May 04 '16 16:05 b-jufre

Have you tried tildebyte's suggestion above? I never did. Like you, I would love to break away from the processing editor and, in my case, use vim to edit and run sketches. Whenever I'm forced to use a text editor other than vim, I feel like an amputee. After using vim for 24 years, it is like an extension of my body. :)

schuelaw avatar May 04 '16 17:05 schuelaw

Some things have changed in P5/P5Py 3+, among them, the standalone hasn't really been tested, so you're in virgin territory ;)

tildebyte avatar May 04 '16 17:05 tildebyte

Yeah, I just poked around in the python mode directory and there are now several jar files. No idea how to slap them together to do a command-line run.

schuelaw avatar May 04 '16 17:05 schuelaw

Apparently this will be fixed soonish?

https://forum.processing.org/two/discussion/15361/#Comment_64949

eraserpeel avatar Jun 18 '16 00:06 eraserpeel

Anyone who's after a quick fix can apply the attached patch in their Processing directory patch.txt

Bob131 avatar Nov 21 '16 21:11 Bob131

Is there a way to run python mode from CLI yet?

atoav avatar Mar 20 '18 22:03 atoav

@atoav -- I got this to work:

  1. Read http://py.processing.org/tutorials/command-line/
  2. Download the standalone Processing.py for MacOSX here
  3. Copy processing-py.jar to your sketch directory (you may also need to copy processing-py-natives-macosx-universal.jar to this directory)
  4. Run your sketch from the sketch directory: java -jar processing-py.jar sketch.py

jsundram avatar Mar 21 '18 19:03 jsundram

I have followed all the steps outlined in http://py.processing.org/tutorials/command-line/, however, I keep getting the following error message:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.python.core.PySystemState (file:/Users/vivek/Documents/GitHub/Coding-PyTrain/Keys/processing-py.jar) to method java.io.Console.encoding()
WARNING: Please consider reporting this to the maintainers of org.python.core.PySystemState
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
java.lang.NoClassDefFoundError: com/apple/eawt/QuitHandler

eigenvivek avatar Jun 28 '18 15:06 eigenvivek

@v715 I have exactly the same issue. I think you can ignore the warnings, the main problem is that the application just won't start up. A Java applet briefly appears in the dock but then instantly disappears. That's when the QuitHandler error prints in my case.

etsuko-io avatar Nov 05 '18 20:11 etsuko-io

Same for me

auraz avatar Feb 01 '19 18:02 auraz

Is there a solution to this problem? It works on my PC, but when I try to do this on Mac OS Mojave 10.14.4 I get the same warnings mentioned above along with this message: java.lang.NoClassDefFoundError: com/apple/eawt/QuitHandler

juanedflores avatar May 12 '19 23:05 juanedflores

I've just encountered this problem while trying to launch a sketch from CodeRunner.

processing-py.jar and processing-py-natives-macosx-universal.jar are in the sketch directory, and the run command is: java -jar processing-py.jar $filename

As in v715's post above, the error message is: WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.python.core.PySystemState (PATH/TO/processing-py.jar) to method java.io.Console.encoding() WARNING: Please consider reporting this to the maintainers of org.python.core.PySystemState WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release java.lang.NoClassDefFoundError: com/apple/eawt/QuitHandler

davidspry avatar Jul 03 '19 04:07 davidspry