Forum Archive

[solved]Saving PDF (or anything) to Dropbox in Editorial (path problem...)

cook

I'd appreciate a little help with getting my path stuff to work.

I have a workflow to make a PDF from my current document. What I want is to save the PDF in the current directory, the same as the current document.

In my workflow I have this code. I found this forum post and it seems like this is the right track...but I'm coming up with an error (path/directory doesn't exist) for the save PDF workflow bit.

So, what's the right path?

Here's my code:

#coding: utf-8
import workflow
import os

params = workflow.get_parameters()
#'currentfile' is the path/filename from the workflow part 'get file name'
currentp = os.path.split(params['currentfile'])[0] 

dbpath = os.path.expanduser('~/Library/Application Support/Dropbox').split('private')[1] + currentp + '/'

#this works, and reading it works, but it is not in the dropbox directory! Where is it!?? lol
with open(dbpath + 'test.txt', 'w') as file:
    file.write('test')

workflow.set_output(dbpath)

cook

[solved]

Sorry...I was doing too much. I realized that the Generate PDF Document already had the root of dropbox so I just needed the rest of the path after that.