Using a Python script in my build

I have a Python script that I would like to run. The script takes an input (several) and outputs an answer based on on the input (but that’s handled in the script).Does anyone know how I could do that?

Thanks in advance

I think you may be on the wrong forum – what does this have to do with Tumult Hype?

If you’re working on an Export Script, what are you trying to achieve? (Just noticed the tag you included)

Looking back I can see I missed a few things so let me rephrase:
I have a build in hype and I am trying to make it so the python script is part of my build. I would like to have a field to enter the input and a place for the output in my project, if it is possible. Basically I am wondering if a my project could work with a python script.

In my limited understanding of hype to be able to work with python I would need to first export the file. Am I wrong? I am sorry if I was wrong, I am fairly new to hype

Tumult Hype’s Export Scripts infrastructure allows code to be run upon export and/or preview. This can be python code, in fact the sample scripts we have are all in Python.

General info:
Developer docs & code:

With this, you can arbitrarily modify Hype’s output however you see fit.

You’ll get a new File > Export as HTML5 > … menu item; this allows choosing a location to save. I don’t think there’s any way to bypass the save dialog at this point. You probably just ignore it. (Though I guess you could also be clever and have a Preview stick your document wherever you want, since previewing doesn’t have a prompt).

You may also not even need the export script for your purposes; the standard macOS app Automator has a system called Folder Actions. It can watch a folder and when there’s a change will run arbitrary actions, which could be a python script. So you could in theory just set something up such that when you save to a special folder code is run.

Does that help?

@Daniel, @jonathan

I think what @Barak_Eyal is asking is if they can use a python function in the same way we would use a javascript within a Hype Project. So instead of a js function generating answer from the user input a python script does it.

My thoughts are that you would need to make post to the py file on the server

My observation:

I would say it’s more along the lines of … say … PHP. Where he has a server side language that he wants to use to handle some logic given from an input inside of Hype. So, he’s looking to send said info to the py script, and probably get a result back. Which is what @MarkHunte is pretty much saying but I thought I’d distinguish that it’s more front end / back end.

1 Like