03-16-2023 09:08 AM
Is it possible to access files written in project space path through python script.
If yes can any one share an example
03-16-2023 10:17 AM
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 = self.input.next()
content = inDoc.get('content')
files = zipfile.ZipFile(io.BytesIO(content))
Regards,
Bojan
03-16-2023 10:52 PM
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
03-20-2023 03:34 AM
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
file:////
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.
Matt.
03-23-2023 10:00 PM
sure ,please share the sample…