我一直在試圖調試這個示例代碼,但我遇到了麻煩。Iron Python - 沒有名爲「os」的模塊
下面是代碼:
import System
import get_events_devices
from System.Windows.Forms import *
from System.ComponentModel import *
from System.Drawing import *
from clr import *
clr.AddReference("IronPython")
class Check: # namespace
class Form1(System.Windows.Forms.Form):
"""type(_label1) == System.Windows.Forms.Label, type(_button1) == System.Windows.Forms.Button"""
__slots__ = ['_label1', '_button1']
def __init__(self):
self.InitializeComponent()
@accepts(Self(), bool)
@returns(None)
def Dispose(self, disposing):
super(type(self), self).Dispose(disposing)
@returns(None)
def InitializeComponent(self):
self._button1 = System.Windows.Forms.Button()
self._label1 = System.Windows.Forms.Label()
self.SuspendLayout()
#
# button1
#
self._button1.Location = System.Drawing.Point(58, 61)
self._button1.Name = 'button1'
self._button1.Size = System.Drawing.Size(75, 23)
self._button1.TabIndex = 0
self._button1.Text = 'Click'
self._button1.UseVisualStyleBackColor = True
self._button1.Click += self._button1_Click
#
# label1
#
self._label1.AutoSize = True
self._label1.Location = System.Drawing.Point(190, 70)
self._label1.Name = 'label1'
self._label1.Size = System.Drawing.Size(0, 13)
self._label1.TabIndex = 1
#
# Form1
#
self.ClientSize = System.Drawing.Size(292, 273)
self.Controls.Add(self._label1)
self.Controls.Add(self._button1)
self.Name = 'Form1'
self.Text = 'Form1'
self.ResumeLayout(False)
self.PerformLayout()
@accepts(Self(), System.Object, System.EventArgs)
@returns(None)
def _button1_Click(self, sender, e):
# Snippet Statement
pass
# End Snippet Statement
self._label1.Text = 'mohsin'
get_events_devices.units()
我剛纔添加optparse.py,get_events_devices.py和鐵python.dll。
從哪裏得到ironpython_module.dll,因爲我已經安裝了鐵蟒我沒有得到這個.dll?
任何想法?
問題是什麼的庫路徑?你的'問題'中的評論似乎也與這個主題沒有任何關係。 – Amy 2011-06-17 05:04:14
我已經告訴過我已經添加了哪些dll,並且代碼就在那裏,但之後我在get_events_devices.py中得到了錯誤。得到它 – 2011-06-17 05:22:58
給我們實際的錯誤追溯。 – 2011-06-17 13:48:58