def open_img(self):
try:
os.startfile("Data")
except Exception as es:
messagebox.showerror("Error",f" due to : {str(es)}",parent=self.root)
Asked
Active
Viewed 66 times
-1

ti7
- 16,375
- 6
- 40
- 68
-
1Welcome to Stack Overflow. Please include your code and format your post to include the full traceback error. – ewokx May 11 '22 at 04:25
-
2Does this help? https://stackoverflow.com/questions/17317219/is-there-an-platform-independent-equivalent-of-os-startfile – Fed_Dragon May 11 '22 at 04:27
1 Answers
1
os.startfile
is explicitly only available under Windows per the docs
https://docs.python.org/3/library/os.html#os.startfile
Availability: Windows.

ti7
- 16,375
- 6
- 40
- 68
-
-
is there any another function like startfile for linux operating system – Rakesh Chaurasiya May 11 '22 at 04:29
-
while this is surely an [XY Problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem), take a look at the duplicate mark! `xdg-open` is likely what you're after – ti7 May 11 '22 at 04:30
-
-
you can use `xdg-open` to start the program associated with its argument type (in your case, perhaps a directory) Microsoft VSCode is irrelevant – ti7 May 11 '22 at 04:42