-Update在自下而上winshell.shortcut(父),得到「模塊沒有屬性‘快捷方式’
pywin32 &沒有明顯的錯誤,但 下面的測試代碼(從這裏的示例中提取winshell安裝: winshell examples):
import winshell
parent = 'H:\MUSIC\TESTC\TESTTB.lnk' # target is H:\MUSIC\TESTB
with winshell.shortcut(parent) as link:
print(link.path)
產生這樣的結果:
> Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
Traceback (most recent call last):
File "C:\Python33\MyScripts\Audio\shortcut2.py", line 3, in <module>
with winshell.shortcut(parent) as link:
AttributeError: 'module' object has no attribute 'shortcut'
>>>
想必丈二和尚摸不着頭腦,其實,正不用winshell安裝 - 我應該找什麼?
PS:系統似乎要求python窗口上的輸出被格式化爲代碼,這顯然不是。好奇爲什麼。它確實包含包含的代碼片段,但這不是一回事。
更新 - 大部分在文檔中示出的其它方法是不是在目錄(winshell)輸出(例如,文件的方法,如COPY_FILE):
>>> dir(winshell) >>> ['__RELEASE__', '__VERSION__', '__builtins__', >>> '__cached__', '__doc__', '__file__', >>> '__initializing__', '__loader__', '__name__', >>> '__package__', '__path__']