Thanks for your reply! I tried with Ironclad but I got the same error:
IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.1873 Type "help", "copyright", "credits" or "license" for more information. >>> import ironclad >>> import bluetooth Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: global name 'discover_devices' is not defined Thanks again! Sebastian 2010/8/22 Lukas Cenovsky <cenov...@bakalari.cz> > I guess Pybluez is not pure Python module and uses some C code, so to make > it work in IronPython, try IronClad: http://code.google.com/p/ironclad/ > > -- > -- Lukáš > > > > On 21.8.2010 19:33, Sebastian Urbanski wrote: > > Hello, i'm a student from Argentina > > I am developing an application that send and receive SMS messages. > > This works fine in Python + Pybluez, but when i want to execute this code > from VBNET, i have problems. Ironpython can't resolve the bluetooth import > > I am using NET 2008, python 2.6, Iron python 2.6 and > PyBluez-0.18.win32-py2.6.exe > > > Here i have a testing class "HelloWorl.py" to try to import package > bluetooth. The error result in NET is "global name 'discover_devices' is not > defined" > > import clr > import sys > sys.path.append(r"C:\Python26\Lib") > sys.path.append(r"C:\Python26\Lib\site-packages") > import bluetooth > import select > clr.AddReference('prueba') > from prueba import HelloWorldVB > class HelloWorldIronPython(HelloWorldVB): > def HelloWorld(self, name): > return "Hello '" + name + "' from IronPython" > Bluetooth's package is installed in the following path: > C:\Python26\Lib\site-packages\bluetooth > > I founded the function discover_devices and it is in bluez.py > > If i try to import directly the bluez.py i have another error. Ironpython > not found the _bluetooth import. > > import sys > import struct > import binascii > from btcommon import * > import _bluetooth as _bt > import array > import fcntl > > Here my code for NET (solutions name is "prueba"): > > > Private > Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) > Handles Button1.Click Dim helloWorld As New HelloWorldVB() > > MsgBox(helloWorld.HelloWorld( > "Maurice")) Dim runtime As ScriptRuntime = > IronPython.Hosting.Python.CreateEngine.Runtime Dim scope As ScriptScope = > runtime.ExecuteFile("HelloWorld.py") Dim pythonType As PythonType = > scope.GetVariable(Of PythonType)("HelloWorldIronPython") > > helloWorld = > CType(runtime.Operations.Invoke(pythonType), HelloWorldVB) > > MsgBox(helloWorld.HelloWorld( > "Maurice")) End Sub > > > Public > Class HelloWorldVB Public Overridable Function HelloWorld(ByVal name As > String) As String Return String.Format("Hello '{0}' from Visual Basic", > name) End Function > > End > Class > > > Any idea to import correctly the package bluetooth???? > > > Thanks!!! > > > Sebastian > > > > > > > > > > _______________________________________________ > Users mailing list > us...@lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > >
_______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com