omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


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

    Editorial
    1
    2
    2370
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • cook
      cook last edited by 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)
      
      
      1 Reply Last reply Reply Quote 0
      • cook
        cook last edited by

        [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.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Powered by NodeBB Forums | Contributors