Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5800

Open Pdf file programmatically on Mac os

$
0
0

Hi there,

i want to open a pdf file from a Python script on Mac os. Under Windows i can simply use:

cmd = "_Run {}".format(pdf_file_path_name)
rs.Command(cmd, True)

Unfortunately, this does not work on Mac, it gives the following error:

Unknown command: Run

I’ve tried the following:

import subprocess
subprocess.Popen(pdf_file_path_name, shell=True)

or this:

import webbrowser
webbrowser.open_new(pdf_file_path_name)

or this:

import os
os.system(pdf_file_path_name)

all 3 fail, but i get no error message. My file path is valid, if i check it like this:

import System
print System.IO.File.Exists(pdf_file_path_name)

it returns True. How can i programmatically open my pdf file on Mac ?

thanks,
c.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 5800

Trending Articles