Access file in Python script

Is it possible to access files written in project space path through python script.
If yes can any one share an example

Hi @ash42,

You can read the file with a File reader, and pass the content to the script.
Here’s the piece of code that I’ve been using to import a zip file into the script. It might not be of an immense help, but it can help you to get some pointers at least:

inDoc =
content = inDoc.get('content')
files = zipfile.ZipFile(io.BytesIO(content))


1 Like

Hi Thanks for response
Basically my requirement is to move or wrtite the file to a ftp server as the the file writer snap is taking too long to write to ftp server ,so i was trying to find a way if we can directly move the file written in project path to a ftp location through script

Hi @ash42,

I’ve not found a way to read from the Snaplogic project folder itself but if you have a groundplex you can write to a folder of your choosing using a binary file writer and the path


Once done you can pick them up using the method suggested by @bojanvelevski.

I did something similar but now pass the raw binary data into the Python script snap (use case is unzip and rotate images), it is more involved but might also save you the io of a additional disk write. Happy to share if you’re interested.


sure ,please share the sample…

The Jersey payload should execute without any other components and the python script will unzip the binary payload and pass it on as one or more unzipped binary payloads.

All of which can done more transaparently with Snaps but the requirement to rotate the image led me to the script so I thought I’d see how much I could do without writing to the disk (answer - some not all). :slightly_smiling_face:

Python, Powershell Example_2023_03_24.slp (235.8 KB)