советую процитировать как именно "ругается" python. мы тут все люди взрослые %)) ну там. самые непристойности можно конечно пропустить. по идее всё должно работать в том виде который ты привёл. попробуй | Код | '\\'.join ( absname ).split ('/') # хотя откровенно говоря есть способ попитонистее ( почитай help (os) ) |
но, повторюсь, у меня всё работает с прямыми слэшами. хотя ещё можно ещё ввести проверку того что путь существует | Код | os.path.exists ( absname ) |
вообще рекоммендую вчитаться в хэлпа. ит хэлпс. в библиотеке os можно обнаружить такую функцию: startfile () в описании читаем | Цитата | startfile( path)
Start a file with its associated application. This acts like double-clicking the file in Windows Explorer, or giving the file name as an argument to the start command from the interactive command shell: the file is opened with whatever application (if any) its extension is associated. startfile() returns as soon as the associated application is launched. There is no option to wait for the application to close, and no way to retrieve the application's exit status. The path parameter is relative to the current directory. If you want to use an absolute path, make sure the first character is not a slash ("/"); the underlying Win32 ShellExecute() function doesn't work if it is. Use the os.path.normpath() function to ensure that the path is properly encoded for Win32. Availability: Windows. New in version 2.0. |
то есть почти ShellExecute, насколько я понял. удачи. (кстати, зарегистрируйся)
|