Run notepad from python script?

Hi djordje

Tried that it doesn’t work. The Run command doesn’t work if the are spaces in the program you are calling and spaces in the path to the file you’re trying to open.

_Run “C:\Xpert DNC\Program\xdncedit.exe c:\temp\temp.txt” works.

_Run “C:\Xpert DNC\Program\xdncedit.exe c:\temp\New Folder\temp.txt” doesn’t work.
_Run “C:\Xpert DNC\Program\xdncedit.exe”“c:\temp\New Folder\temp.txt” doesn’t work.

_Run “C:\windows\Notepad.exe c:\temp\New Folder\temp.txt” works.

The script below works ok with files in subdirectories with spaces in the name, but if you change the Editor to call a program in a subdirectory with spaces it doesn’t work.

import rhinoscriptsyntax as rs


filename = rs.OpenFileName("Open", "Text Files (*.txt)|*.txt||")

if filename:
    Editor = '"C:\windows\Notepad.exe '
    #Editor = '"C:\Xpert DNC\Program\xdncedit.exe '
    cmd = '_Run '+ Editor + filename + '"'
    rs.Command(cmd, False)