Skip to content Skip to sidebar Skip to footer

Attributeerror: 'module' Object Has No Attribute 'startfile'

Trying to run this program, I got this error: Traceback (most recent call last): File 'piltk.py', line 84, in os.startfile(filename) AttributeError: 'module' o

Solution 1:

On Linux you can use:

import subprocess, sysopener="open"if sys.platform == "darwin"else"xdg-open"
subprocess.call([opener, filename])

Adopted from here

Solution 2:

Given that you are not running on Windows you cannot use os.startfile. If you want to launch another process you could use os.system or look at the subprocess module

Solution 3:

Maybe so: os.system('xdg-open аny_file')

Post a Comment for "Attributeerror: 'module' Object Has No Attribute 'startfile'"