Can't open files/folders from server with PyRevit

Hi everyone,

I’m trying to make an custom extension for my company. I want to open folders or files from our server (X:) with a simple pushbutton in the extension. In the attachment you can find my script. When I run it, my explorer opens until the first folder of the server filepath: "X:", not deeper into the folder. Am I doing something wrong? I hope somebody could help me :slight_smile:

(I don’t know if it is relevant but we use Parallels to run Windows on our Mac. So Mac shares all the folders with Windows. I’m not in favor of it, but I have to live with it :frowning: )

Welcome.
First things first, this is something you would catch up with easily with a modern code editor: vscode, pycharm, …

It probably has to do with the \ being read as an escape character in python.

One way to solve it is to add a second backslash:

supprocess.Popen(["start X:\\you first folder name\\the second one\\ and so on"], shell=True)
# I typed it directly in discourse with no check whatsoever :) 

Dear Jean-Marc.
Thanks for the quick reply! I tested it and it works fine, both for folders and files.

1 Like