jdf / Processing.py-Bugs

A home for all bugs and feature requests about Python Mode for the Processing Development Environment.
41 stars 8 forks source link

Launch sketch from command line? #120

Open schuelaw opened 9 years ago

schuelaw commented 9 years ago

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?

diogotito commented 9 years ago

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

tildebyte commented 9 years ago

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

jsundram commented 8 years ago

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...)

b-jufre commented 8 years ago

@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... :'(

schuelaw commented 8 years ago

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. :)

tildebyte commented 8 years ago

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

schuelaw commented 8 years ago

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.

eraserpeel commented 8 years ago

Apparently this will be fixed soonish?

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

Bob131 commented 7 years ago

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

atoav commented 6 years ago

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

jsundram commented 6 years ago

@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
eigenvivek commented 6 years ago

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
etsuko-io commented 6 years ago

@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.

auraz commented 5 years ago

Same for me

juanedflores commented 5 years ago

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

davidspry commented 5 years ago

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