anyone used phython in cfml or lucee as a custom t...
# cfml-general
g
anyone used phython in cfml or lucee as a custom tag, if yes can anyone please guide or share any piece of code. i read somewhere cfexecute can do it ?
s
If
python
or
python3
is installed on the server then you can use
cfexecute
to run Python code, just like you'd run any other command. Perhaps take a step back and explain what problem you're actually trying to solve? There have been several projects that have made it possible to run JVM-based scripting languages directly from CFML. I did one for PHP (using the Quercus engine for the JVM) and there were others for JRuby, Jython, Groovy, and several other languages. Most of those are unmaintained these days.
b
You can run Python via JSR-223 and I've done it, but I'd agree-- step back and see what you're trying to solve first.
Apologies, I didn't use JSR-223, I used Jython. ( I couldn't find a Java-based syntax highlighting library as good as pygments ) https://github.com/scottsteinbeck/commandbox-gitbook/blob/master/models/CodeFormatService.cfc
e
You can, but the question is what is python doing that is so magical, you need ColdFusion to run it? if its some sample code to do X, post it on here or stackoverflow as someone already has or can help you do exactly what you need to do, or at least give you the correct pointers. I can tell you from personal experience, code mixing only leads to hours of frustration later on, do not do it.
s
Perhaps it's a shared program, developed and maintained by another team? No sense in duplicating it into CFML if that's the case.