私はこれを変換しようとしていますVBScriptコードをにPython(Win32)コードですが運がありません!VBScriptからPythonスニペットへの変換
Dim objMain, objSysInf, stMsg
Set objMain = CreateObject("nnetcom.oMain")
Call objMain.UnlockComponent("xxx-xxxxx-xxxxx-xx")
Set objSysInf = CreateObject("nnetcom.oSystemInfo")
Call objSysInf.GetSystemInfos
stMsg = objSysInf.cOsName & " " & objSysInf.cOsType & vbCrLf & _
objSysInf.cOsCpu & vbCrLf & objSysInf.cOsMem & vbCrLf & _
objSysInf.cOsGpu
MsgBox stMsg, vbInformation, "System Information"
Set objSysInf = Nothing
Set objMain = Nothing
私がインストールされたWindows拡張用のPython 2.7.3のPythonとし、Windows 7の32ビット版を実行していますよ。 はまた、私は...から「makepy.pyc」を実行することにより、COMオブジェクトを追加しました「のLib \サイト - パッケージ\ win32comクライアント\ \」...と運、常にいくつかのエラーメッセージを取得して
以下は私のPythonコードです:
import pythoncom
import win32com.client
objMain = win32com.client.Dispach("nnetcom.oMain")
ret = objMain.UnlockComponent("xxx-xxxxx-xxxxx-xx")
objSysInf = win32com.client.Dispach("nnetcom.oSystemInfo")
objSysInf.GetSystemInfos()
stMsg = objSysInf.cOsName
print(stMsg)
この会話で私を助けることができる人はいますか?
完全なエラー出力を表示してください。ここで – Marcin
**こんにちはマルチン** はエラー出力です: C:\> C:\ PROGRA〜1 \ Pythonの\ python.exe C:\ example2.py トレースバック(最新の呼び出しの最後): ファイル:で、4行目、 "C \ example2.py" objMain = win32com.client.Dispach( "nnetcom.oMain") はAttributeError: 'モジュール' オブジェクトが属性 'Dispach' は、あなたが私を助けることができていません? ** Ragards、Viktor ** –
beic