From kris_beyers at hotmail.com Tue Apr 10 22:31:35 2007 From: kris_beyers at hotmail.com (Kris Beyers) Date: Tue, 10 Apr 2007 20:31:35 +0000 Subject: [Python.NET] Unable to import library imaplib Message-ID: Hi I'm trying to make a python script (which would be called from a C# application) and communicates with an IMAP server. Passing variables from C# to python and back is no problem, but when I type "import imaplib" on top of the python script to support IMAP, the script fails to run at line with following code: "func.Invoke(arguments)". Showing error message in the C# developer: "". I also tried to call PythonEngine.ImportModule("imaplib") first, but no change. Is there a way to import the library? Thank you in advance. Tip: Just found out about an amazing C# developer http://www.sharpdevelop.net (open source) Regards, Kris C# *** try { string imapUser = "kris"; string imapPassword = "a password"; PythonEngine.Initialize(); PyObject[] arguments = new PyObject[2]; arguments[0] = PyObject.FromManagedObject(imapUser); arguments[1] = PyObject.FromManagedObject(imapPassword); PyObject pyportal = PythonEngine.ImportModule("PyPortal"); PyObject func = pyportal.GetAttr("invoker"); PyObject result = func.Invoke(arguments); this.label1.Text = result.ToString();} catch (Exception err) { this.label1.Text = err.Message.ToString();} The file PyPortal.py *************** import imaplib # <-- causes error def invoker(imapUser, imapPassword): messages = [] M = imaplib.IMAP4('imap.next.mail.yahoo.com') M.login(imapUser, imapPassword) M.select() typ, data = M.search(None, 'ALL') for num in data[0].split(): typ, data = M.fetch(num, '(RFC822)') messages.append('Message %s\n%s\n' % (num, data[0][1])) M.close() M.logout() return ''.join(messages) _________________________________________________________________ Ontdek Windows Live Hotmail, het ultieme online mailprogramma! http://get.live.com/mail/overview -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070410/a3a4a3d0/attachment.html From dvpdiner2 at yahoo.com Wed Apr 11 04:39:43 2007 From: dvpdiner2 at yahoo.com (Darryl Pogue) Date: Tue, 10 Apr 2007 19:39:43 -0700 (PDT) Subject: [Python.NET] Unable to import library imaplib Message-ID: <871901.28694.qm@web31603.mail.mud.yahoo.com> Did you use (in Python) >>> import clr to import the Common Language Runtime and support .NET assemblies? Uru Live IRC Chat: unreal.JustIRC.net #uru ----- Original Message ---- From: Kris Beyers To: pythondotnet at python.org Sent: Tuesday, April 10, 2007 1:31:35 PM Subject: [Python.NET] Unable to import library imaplib P { margin:0px;padding:0px;} body { FONT-SIZE:10pt;FONT-FAMILY:Tahoma;} Hi I'm trying to make a python script (which would be called from a C# application) and communicates with an IMAP server. Passing variables from C# to python and back is no problem, but when I type "import imaplib" on top of the python script to support IMAP, the script fails to run at line with following code: "func.Invoke(arguments)". Showing error message in the C# developer: "". I also tried to call PythonEngine.ImportModule("imaplib") first, but no change. Is there a way to import the library? Thank you in advance. Tip: Just found out about an amazing C# developer http://www.sharpdevelop.net (open source) Regards, Kris C# *** try { string imapUser = "kris"; string imapPassword = "a password"; PythonEngine.Initialize(); PyObject[] arguments = new PyObject[2]; arguments[0] = PyObject.FromManagedObject(imapUser); arguments[1] = PyObject.FromManagedObject(imapPassword); PyObject pyportal = PythonEngine.ImportModule("PyPortal"); PyObject func = pyportal.GetAttr("invoker"); PyObject result = func.Invoke(arguments); this.label1.Text = result.ToString(); } catch (Exception err) { this.label1.Text = err.Message.ToString(); } The file PyPortal.py *************** import imaplib # <-- causes error def invoker(imapUser, imapPassword): messages = [] M = imaplib.IMAP4('imap.next.mail.yahoo.com') M.login(imapUser, imapPassword) M.select() typ, data = M.search(None, 'ALL') for num in data[0].split(): typ, data = M.fetch(num, '(RFC822)') messages.append('Message %s\n%s\n' % (num, data[0][1])) M.close() M.logout() return ''.join(messages) het ultieme online mailprogramma! Ontdek Windows Live Hotmail,_________________________________________________ Python.NET mailing list - PythonDotNet at python.org http://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070410/336bea10/attachment.htm From kris_beyers at hotmail.com Wed Apr 11 11:16:42 2007 From: kris_beyers at hotmail.com (Kris Beyers) Date: Wed, 11 Apr 2007 09:16:42 +0000 Subject: [Python.NET] Unable to import library imaplib Message-ID: Hi I can import CLR, but not imaplib. Although imaplib is part of the standard python library, and I suppose I didn't need CLR. I also tried different combinations of case of the word "imaplib", since the import statement is case sensitive. Currently I have the latest Python version 25, and installed the latest PythonNet afterwards (PythonNet 1.0 release candidate 2). Also tried to include the path to the C:\Python25\Lib in the systemvariable PATH, where imaplib.py resides. Furthermore I included C:\Program Files\PythonNet in the same systemvariable, but that's nog part of the problem I guess. Regards, Kris Date: Tue, 10 Apr 2007 19:39:43 -0700From: dvpdiner2 at yahoo.comSubject: Re: [Python.NET] Unable to import library imaplibTo: kris_beyers at hotmail.comCC: pythondotnet at python.org Did you use (in Python)>>> import clrto import the Common Language Runtime and support .NET assemblies? Uru Live IRC Chat: unreal.JustIRC.net #uru ----- Original Message ----From: Kris Beyers To: pythondotnet at python.orgSent: Tuesday, April 10, 2007 1:31:35 PMSubject: [Python.NET] Unable to import library imaplib Hi I'm trying to make a python script (which would be called from a C# application) and communicates with an IMAP server.Passing variables from C# to python and back is no problem, but when I type "import imaplib" on top of the python script to support IMAP, the script fails to run at line with following code: "func.Invoke(arguments)". Showing error message in the C# developer: "". I also tried to call PythonEngine.ImportModule("imaplib") first, but no change.Is there a way to import the library? Thank you in advance. Tip: Just found out about an amazing C# developer http://www.sharpdevelop.net (open source) Regards,Kris C#***try { string imapUser = "kris"; string imapPassword = "a password"; PythonEngine.Initialize(); PyObject[] arguments = new PyObject[2]; arguments[0] = PyObject.FromManagedObject(imapUser); arguments[1] = PyObject.FromManagedObject(imapPassword); PyObject pyportal = PythonEngine.ImportModule("PyPortal"); PyObject func = pyportal.GetAttr("invoker"); PyObject result = func.Invoke(arguments); this.label1.Text = result.ToString();} catch (Exception err) { this.label1.Text = err.Message.ToString();} The file PyPortal.py***************import imaplib # <-- causes errordef invoker(imapUser, imapPassword): messages = [] M = imaplib.IMAP4('imap.next.mail.yahoo.com') M.login(imapUser, imapPassword) M.select() typ, data = M.search(None, 'ALL') for num in data[0].split(): typ, data = M.fetch(num, '(RFC822)') messages.append('Message %s\n%s\n' % (num, data[0][1])) M.close() M.logout() return ''.join(messages) het ultieme online mailprogramma! Ontdek Windows Live Hotmail, _________________________________________________Python.NET mailing list - PythonDotNet at python.orghttp://mail.python.org/mailman/listinfo/pythondotnet Now you can have a huge leap forward in email: get the new Yahoo! Mail. _________________________________________________________________ Ontdek Windows Live Hotmail, het ultieme online mailprogramma! http://get.live.com/mail/overview -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070411/b41b4d17/attachment.html From rlacko at gratex.com Wed Apr 11 13:56:59 2007 From: rlacko at gratex.com (Lacko Roman) Date: Wed, 11 Apr 2007 13:56:59 +0200 Subject: [Python.NET] Python 2.5 Message-ID: <451E11FD7D0ACB4A9207723712EC53D1ADB6DE@ex01.hq.gratex.com> Hi, A'm trying using PythonNET with Python 2.5 I have changed line in runtime.cs: internal const string dll = "python24"; to internal const string dll = "python25"; and succesfully recompiled the source, but when i try to import CLR, following error occurs: Traceback (most recent call last): File "D:\inews\pythonnetBinariesNet2.0\helloform.py", line 12, in import CLR.System.Windows.Forms as WinForms ImportError: No module named CLR.System.Windows.Forms But when running with python.exe build from PythonNET source it works OK. Please help, And thank you for great extension to python and .Net RomanL -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070411/cb53a35b/attachment.htm From brian.lloyd at revolution.com Wed Apr 11 17:18:24 2007 From: brian.lloyd at revolution.com (Brian Lloyd) Date: Wed, 11 Apr 2007 11:18:24 -0400 Subject: [Python.NET] Unable to import library imaplib In-Reply-To: Message-ID: Note that the latest PythonNet is built for and includes 2.4, not 2.5, unless you?ve built your own version. That probably means that pythonnet is looking at the PYTHONPATH for 2.4, which probably doesn?t have imaplib installed. I?d suggest making sure to install imaplib in the site-packages used by your PythonNet/2.4 installation... -Brian On 4/11/07 5:16 AM, "Kris Beyers" wrote: > Hi > > I can import CLR, but not imaplib. Although imaplib is part of the standard > python library, and I suppose I didn't need CLR. > I also tried different combinations of case of the word "imaplib", since the > import statement is case sensitive. > Currently I have the latest Python version 25, and installed the latest > PythonNet afterwards (PythonNet 1.0 release candidate 2). > Also tried to include the path to the C:\Python25\Lib in the systemvariable > PATH, where imaplib.py resides. > > Furthermore I included C:\Program Files\PythonNet in the same systemvariable, > but that's nog part of the problem I guess. > > Regards, > Kris >> >> Date: Tue, 10 Apr 2007 19:39:43 -0700 >> From: dvpdiner2 at yahoo.com >> Subject: Re: [Python.NET] Unable to import library imaplib >> To: kris_beyers at hotmail.com >> CC: pythondotnet at python.org >> >> Did you use (in Python) >> >>>>> >>> import clr >> >> to import the Common Language Runtime and support .NET assemblies? >> >> >> Uru Live IRC Chat: unreal.JustIRC.net #uru >> >> >> ----- Original Message ---- >> From: Kris Beyers >> To: pythondotnet at python.org >> Sent: Tuesday, April 10, 2007 1:31:35 PM >> Subject: [Python.NET] Unable to import library imaplib >> >> Hi >> >> I'm trying to make a python script (which would be called from a C# >> application) and communicates with an IMAP server. >> Passing variables from C# to python and back is no problem, but when I type >> "import imaplib" on top of the python script to support IMAP, the script >> fails to run at line with following code: "func.Invoke(arguments)". Showing >> error message in the C# developer: "". >> >> I also tried to call PythonEngine.ImportModule("imaplib") first, but no >> change. >> Is there a way to import the library? Thank you in advance. >> >> Tip: Just found out about an amazing C# developer http://www.sharpdevelop.net >> (open source) >> >> Regards, >> Kris >> >> C# >> *** >> try { >> string imapUser = "kris"; >> string imapPassword = "a password"; >> >> PythonEngine.Initialize(); >> >> PyObject[] arguments = new PyObject[2]; >> arguments[0] = PyObject.FromManagedObject(imapUser); >> arguments[1] = PyObject.FromManagedObject(imapPassword); >> >> PyObject pyportal = PythonEngine.ImportModule("PyPortal"); >> PyObject func = pyportal.GetAttr("invoker"); >> >> PyObject result = func.Invoke(arguments); >> this.label1.Text = result.ToString(); >> } catch (Exception err) { >> this.label1.Text = err.Message.ToString(); >> } >> >> The file PyPortal.py >> *************** >> import imaplib # <-- causes error >> def invoker(imapUser, imapPassword): >> messages = [] >> M = imaplib.IMAP4('imap.next.mail.yahoo.com') >> M.login(imapUser, imapPassword) >> M.select() >> typ, data = M.search(None, 'ALL') >> for num in data[0].split(): >> typ, data = M.fetch(num, '(RFC822)') >> messages.append('Message %s\n%s\n' % (num, data[0][1])) >> M.close() >> M.logout() >> return ''.join(messages) >> >> >> >> het ultieme online mailprogramma! Ontdek Windows Live Hotmail, >> >> _________________________________________________ >> Python.NET mailing list - PythonDotNet at python.org >> http://mail.python.org/mailman/listinfo/pythondotnet >> >> >> >> Now you can have a huge leap forward in email: get the new Yahoo! Mail. >> > a> > > > het ultieme online mailprogramma! Ontdek Windows Live Hotmail, > > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070411/9e032c86/attachment.html From kris_beyers at hotmail.com Fri Apr 13 10:45:53 2007 From: kris_beyers at hotmail.com (Kris Beyers) Date: Fri, 13 Apr 2007 08:45:53 +0000 Subject: [Python.NET] Unable to import library imaplib Message-ID: Hi I changed the version to 2.44, but the problem remains. Meanwhile I found another solution to communicate directly from C# to an IMAP server with a very nice freeware library. It also includes some other protocol communication like pop3, smtp, Auth_HttpDigest, dns, ftp, http, icmp, io, log, mime, nntp, sdp and sip. If you are interested, you can find my writings here http://www.lumisoft.ee/Forum/default.aspx?g=posts&t=98 The example there uses following library http://www.lumisoft.ee/lsWWW/ENG/Products/WEB_Mail/webmail_index_eng.aspx?type=download Rregards, Kris Date: Wed, 11 Apr 2007 11:18:24 -0400Subject: Re: [Python.NET] Unable to import library imaplibFrom: brian.lloyd at revolution.comTo: kris_beyers at hotmail.com; dvpdiner2 at yahoo.comCC: pythondotnet at python.org Note that the latest PythonNet is built for and includes 2.4, not 2.5, unless you?ve built your own version.That probably means that pythonnet is looking at the PYTHONPATH for 2.4, which probably doesn?t have imaplib installed.I?d suggest making sure to install imaplib in the site-packages used by your PythonNet/2.4 installation...-BrianOn 4/11/07 5:16 AM, "Kris Beyers" wrote: Hi I can import CLR, but not imaplib. Although imaplib is part of the standard python library, and I suppose I didn't need CLR.I also tried different combinations of case of the word "imaplib", since the import statement is case sensitive.Currently I have the latest Python version 25, and installed the latest PythonNet afterwards (PythonNet 1.0 release candidate 2).Also tried to include the path to the C:\Python25\Lib in the systemvariable PATH, where imaplib.py resides. Furthermore I included C:\Program Files\PythonNet in the same systemvariable, but that's nog part of the problem I guess. Regards,Kris Date: Tue, 10 Apr 2007 19:39:43 -0700From: dvpdiner2 at yahoo.comSubject: Re: [Python.NET] Unable to import library imaplibTo: kris_beyers at hotmail.comCC: pythondotnet at python.orgDid you use (in Python)>>> import clrto import the Common Language Runtime and support .NET assemblies? Uru Live IRC Chat: unreal.JustIRC.net #uru----- Original Message ----From: Kris Beyers To: pythondotnet at python.orgSent: Tuesday, April 10, 2007 1:31:35 PMSubject: [Python.NET] Unable to import library imaplibHi I'm trying to make a python script (which would be called from a C# application) and communicates with an IMAP server.Passing variables from C# to python and back is no problem, but when I type "import imaplib" on top of the python script to support IMAP, the script fails to run at line with following code: "func.Invoke(arguments)". Showing error message in the C# developer: "". I also tried to call PythonEngine.ImportModule("imaplib") first, but no change.Is there a way to import the library? Thank you in advance. Tip: Just found out about an amazing C# developer http://www.sharpdevelop.net (open source) Regards,Kris C#***try { string imapUser = "kris"; string imapPassword = "a password"; PythonEngine.Initialize(); PyObject[] arguments = new PyObject[2]; arguments[0] = PyObject.FromManagedObject(imapUser); arguments[1] = PyObject.FromManagedObject(imapPassword); PyObject pyportal = PythonEngine.ImportModule("PyPortal"); PyObject func = pyportal.GetAttr("invoker"); PyObject result = func.Invoke(arguments); this.label1.Text = result.ToString();} catch (Exception err) { this.label1.Text = err.Message.ToString();} The file PyPortal.py***************import imaplib # <-- causes errordef invoker(imapUser, imapPassword): messages = [] M = imaplib.IMAP4('imap.next.mail.yahoo.com') M.login(imapUser, imapPassword) M.select() typ, data = M.search(None, 'ALL') for num in data[0].split(): typ, data = M.fetch(num, '(RFC822)') messages.append('Message %s\n%s\n' % (num, data[0][1])) M.close() M.logout() return ''.join(messages) het ultieme online mailprogramma! Ontdek Windows Live Hotmail, _________________________________________________Python.NET mailing list - PythonDotNet at python.orghttp://mail.python.org/mailman/listinfo/pythondotnet Now you can have a huge leap forward in email: get the new Yahoo! Mail. het ultieme online mailprogramma! Ontdek Windows Live Hotmail, _________________________________________________Python.NET mailing list - PythonDotNet at python.orghttp://mail.python.org/mailman/listinfo/pythondotnet _________________________________________________________________ Ontdek Windows Live Hotmail, het ultieme online mailprogramma! http://get.live.com/mail/overview -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070413/c0c59b17/attachment.html From vipingupta2005 at yahoo.co.in Fri Apr 13 23:06:14 2007 From: vipingupta2005 at yahoo.co.in (vipin gupta) Date: Sat, 14 Apr 2007 02:36:14 +0530 (IST) Subject: [Python.NET] Unable to import library imaplib Message-ID: <316862.48183.qm@web8509.mail.in.yahoo.com> Dear Sir, My name is Vipin, I am a student doing an internship at a small software development company. I want to embed python in C#. But I have no specific idea how to do it. All material that I could find on the net and the books talk about embedding python in c/ c++ using pointers etc. But I want to embed python in a C# code. I read the Python for .NET web page and I think that is something that can fulfil my requiremenmts. But again using pointers in C# is not what we want as it makes us comple 'unsafe' & takes away our garbage collection also. As i am a beginer I would request you to please help me with a 'sample program' that illustrates the entire embedding process. Your help will be deeply appreciated by me. Thanking you, Sincerely, Vipin Gupta Send a FREE SMS to your friend's mobile from Yahoo! Messenger. Get it now at http://in.messenger.yahoo.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070414/db613a13/attachment.htm From rlacko at gratex.com Thu Apr 12 10:11:53 2007 From: rlacko at gratex.com (Lacko Roman) Date: Thu, 12 Apr 2007 10:11:53 +0200 Subject: [Python.NET] Python 2.5 build Message-ID: <451E11FD7D0ACB4A9207723712EC53D1ADBD0C@ex01.hq.gratex.com> Please can some one explain me how to properly build PythonNET for python 2.5 ? Thank you RomanL -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070412/c2738222/attachment.html From Aaron.Rubin at 4DTechnology.com Fri Apr 20 01:25:16 2007 From: Aaron.Rubin at 4DTechnology.com (Aaron Rubin) Date: Thu, 19 Apr 2007 16:25:16 -0700 Subject: [Python.NET] Installing Python for .NET with .NET 2.0? Message-ID: Hi - I am running Python 2.4 along with .NET 2.0 I understand that unless I get the trunk of the code, .NET 2.0 is not supported, but I figured it would be backwards compatible? Basically, my problem is the same problem in this posting: I cannot get things to work like the samples on the README on the website. I did, however, try to install in my existing installation of Python, instead of the stand alone. Anyone have the same problems? - Aaron Seshagiri Cherukuri seshagiri.cherukuri at gmail.com Mon Dec 4 21:50:47 CET 2006 * Previous message: [Python.NET] Help please: Convert to Python * Next message: [Python.NET] Subset implementation for CompactFramework * Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] ________________________________ hi All, I have just installed Pythonnet v2.4 and was trying to work with .net 2.0assemblies, it is not able to recognize any of the .net 2.0 assemblies either those in GAC or those not in GAC. Here are the problems I am seeing ( I am running the standalone pythonnet): 1. The readme files at http://pythonnet.sourceforge.net/readme.html mentions that you dont have to use the CLR.System kind of namespace anymore. However if I write something like from System import String There is an error which says "No module named System" 2. When using .net 2.0 assemblies, even the CLR.xxx syntax is not working - there is always an error which says "No module named xxx" 3. Not able to use any of the .net stuff - e.g. from CLR.System.Collections.Generic does not work because it is not able to see the module Generic. Am I doing something wrong? The 2.4 installation was obtained from here ( http://sourceforge.net/project/showfiles.php?group_id=162464). Do I have to get the latest code instead of these installers to be able to use the .net 2.0 and other features? Looking forward to your reply. Seshagiri Aaron Rubin Sr. Software Engineer 4D Technology Corporation (520) 294-5600 (ext 234) (520) 294-5601FAX aaron.rubin at 4DTechnology.com http://www.4dtechnology.com/ The information in this e-mail message is 4D Technology Confidential. The message is intended for the recipient only and not to be distributed beyond this point. If you are receiving this message in error, please notify me by reply e-mail and delete this message from your e-mail system. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070419/be4c62a9/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/jpeg Size: 6658 bytes Desc: att15528.jpg Url : http://mail.python.org/pipermail/pythondotnet/attachments/20070419/be4c62a9/attachment.jpe From alberto at metapensiero.it Fri Apr 20 10:49:12 2007 From: alberto at metapensiero.it (Alberto Berti) Date: Fri, 20 Apr 2007 10:49:12 +0200 Subject: [Python.NET] Installing Python for .NET with .NET 2.0? In-Reply-To: (Aaron Rubin's message of "Thu\, 19 Apr 2007 16\:25\:16 -0700") References: Message-ID: <87fy6vig6v.fsf@lizard.lizardnet> Hi Aaron, the tarballs on pythondotnet's site are for .NET 1, if you want to use it with .NET 2 you should checkout the last svn trunk and patch it with the instruxtions described in this mail http://thread.gmane.org/gmane.comp.python.dotnet/576 .In that message there is also a link to binary packages provided by Angel Ignacio. Hi hope soon to set up a wiki dedicated to pythondotnet as there aren't so many examples of using it for things like embedding etc. I'm just looking for a wiki engine which as some effective spam protection. If someone has any hint on a product or a service please drop me a line. Alberto From Aaron.Rubin at 4DTechnology.com Fri Apr 20 22:59:43 2007 From: Aaron.Rubin at 4DTechnology.com (Aaron Rubin) Date: Fri, 20 Apr 2007 13:59:43 -0700 Subject: [Python.NET] Installing Python for .NET with .NET 2.0? Message-ID: Hi Alberto - Thanks for your help! Seems to work fine now....except...I am trying to use arrays. I am following the README on the python for .NET website. Here are the commands I am trying to run: from System import Array # works! myarray = Array[int](10) # fails! TypeError: Cannot convert 10 to System.Int32[] I'm a little confused...obviously the example doesn't work, but how *should* arrays be initialized in Python .NET? The c# code might look like: int[,] numbers = new int[,] { {1, 2}, {3, 4}, {5, 6} }; I'm actually looking to make a 2D array. Further, the end goal is to make a 2D array...then serialize it....then deserialize it in c# code itself. I'm hoping to make this a transport layer between Python and C#. It's a bit complicated, but I have an existing application in Python which I want to get some calculated results out of without writing listeners, named pipes, web services, etc. All I want to do is to serialize a .NET 2D array created in Python. - Aaron > -----Original Message----- > From: pythondotnet-bounces at python.org > [mailto:pythondotnet-bounces at python.org] On Behalf Of Alberto Berti > Sent: Friday, April 20, 2007 1:49 AM > To: pythondotnet at python.org > Subject: Re: [Python.NET] Installing Python for .NET with .NET 2.0? > > > Hi Aaron, > > the tarballs on pythondotnet's site are for .NET 1, if you > want to use it with .NET 2 you should checkout the last svn > trunk and patch it with the instruxtions described in this mail > http://thread.gmane.org/gmane.comp.python.dotnet/576 .In that > message there is also a link to binary packages provided by > Angel Ignacio. > > Hi hope soon to set up a wiki dedicated to pythondotnet as > there aren't so many examples of using it for things like > embedding etc. I'm just looking for a wiki engine which as > some effective spam protection. If someone has any hint on a > product or a service please drop me a line. > > Alberto > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet > From brian.lloyd at revolution.com Sat Apr 21 00:27:28 2007 From: brian.lloyd at revolution.com (Brian Lloyd) Date: Fri, 20 Apr 2007 18:27:28 -0400 Subject: [Python.NET] Installing Python for .NET with .NET 2.0? In-Reply-To: Message-ID: Hi Aaron - PythonNet tip 'o the day: you can probably just construct the array in Python as a normal list: mylist = [[1, 2], [3, 4], ...] If you pass that to a method with a signature that takes int[,] then everything should Just Work so long as the lists and their contents are actually convertible to the stated type ;) The syntax you're using below is actually trying instantiate a bound generic type (Array[int] is equivalent to Array in C#), so when you say 'Array[int](10)' it is trying to create the bound generic type and initialize it with 10 (which is not an array), which is probably not what you intended. hope this helps, -Brian On 4/20/07 4:59 PM, "Aaron Rubin" wrote: > Hi Alberto - > > Thanks for your help! Seems to work fine now....except...I am trying to > use arrays. I am following the README on the python for .NET website. > Here are the commands I am trying to run: > > from System import Array # works! > myarray = Array[int](10) # fails! TypeError: Cannot convert 10 to > System.Int32[] > > I'm a little confused...obviously the example doesn't work, but how > *should* arrays be initialized in Python .NET? The c# code might look > like: > int[,] numbers = new int[,] { {1, 2}, {3, 4}, {5, 6} }; > > I'm actually looking to make a 2D array. Further, the end goal is to > make a 2D array...then serialize it....then deserialize it in c# code > itself. I'm hoping to make this a transport layer between Python and > C#. It's a bit complicated, but I have an existing application in > Python which I want to get some calculated results out of without > writing listeners, named pipes, web services, etc. All I want to do is > to serialize a .NET 2D array created in Python. > > - Aaron > > >> -----Original Message----- >> From: pythondotnet-bounces at python.org >> [mailto:pythondotnet-bounces at python.org] On Behalf Of Alberto Berti >> Sent: Friday, April 20, 2007 1:49 AM >> To: pythondotnet at python.org >> Subject: Re: [Python.NET] Installing Python for .NET with .NET 2.0? >> >> >> Hi Aaron, >> >> the tarballs on pythondotnet's site are for .NET 1, if you >> want to use it with .NET 2 you should checkout the last svn >> trunk and patch it with the instruxtions described in this mail >> http://thread.gmane.org/gmane.comp.python.dotnet/576 .In that >> message there is also a link to binary packages provided by >> Angel Ignacio. >> >> Hi hope soon to set up a wiki dedicated to pythondotnet as >> there aren't so many examples of using it for things like >> embedding etc. I'm just looking for a wiki engine which as >> some effective spam protection. If someone has any hint on a >> product or a service please drop me a line. >> >> Alberto >> _________________________________________________ >> Python.NET mailing list - PythonDotNet at python.org >> http://mail.python.org/mailman/listinfo/pythondotnet >> > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet > From alberto at metapensiero.it Sat Apr 21 02:12:38 2007 From: alberto at metapensiero.it (Alberto Berti) Date: Sat, 21 Apr 2007 02:12:38 +0200 Subject: [Python.NET] Installing Python for .NET with .NET 2.0? In-Reply-To: (Aaron Rubin's message of "Fri\, 20 Apr 2007 13\:59\:43 -0700") References: Message-ID: <87zm52a8ll.fsf@lizard.lizardnet> >>>>> "Aaron" == Aaron Rubin writes: Hi Aaron, Aaron> from System import Array # works! Aaron> myarray = Array[int](10) # fails! TypeError: Cannot.... the correct semantic is myarray = Array[int]((0,1,2,3,4,5,6,7,8,9)) Aaron> I'm a little confused...obviously the example doesn't work, Aaron> but how *should* arrays be initialized in Python .NET? The Aaron> c# code might look like: int[,] numbers = new int[,] { {1, Aaron> 2}, {3, 4}, {5, 6} }; i wasn't able to find the correct way to create an instance of a multidimensional Array... i think that actually it is not possible, but maybe someone can correct me here. Aaron> I'm actually looking to make a 2D array. Further, the end Aaron> goal is to make a 2D array...then serialize it....then Aaron> deserialize it in c# code itself. I'm hoping to make this Aaron> a transport layer between Python and C#. It's a bit Aaron> complicated, but I have an existing application in Python Aaron> which I want to get some calculated results out of without Aaron> writing listeners, named pipes, web services, etc. All I Aaron> want to do is to serialize a .NET 2D array created in Aaron> Python. I'm at the very start of my Python embedding journey, but since now i prefer to work with native Python objects on that side, and then deal with messy stuff at the messy level (read c#). So list and tuples become PyList, PyTuples and you can iterate or convert them appropriately. I do not know however if that is the correct way to do such things..... hope it helps Alberto From alberto at metapensiero.it Sat Apr 21 02:19:52 2007 From: alberto at metapensiero.it (Alberto Berti) Date: Sat, 21 Apr 2007 02:19:52 +0200 Subject: [Python.NET] Installing Python for .NET with .NET 2.0? In-Reply-To: (Brian Lloyd's message of "Fri\, 20 Apr 2007 18\:27\:28 -0400") References: Message-ID: <87vefqa89j.fsf@lizard.lizardnet> >>>>> "Brian" == Brian Lloyd writes: Brian> Hi Aaron - PythonNet tip 'o the day: you can probably just Brian> construct the array in Python as a normal list: Brian> mylist = [[1, 2], [3, 4], ...] Brian> If you pass that to a method with a signature that takes Brian> int[,] then everything should Just Work so long as the Brian> lists and their contents are actually convertible to the Brian> stated type ;) that is good! :-) Brian> The syntax you're using below is actually trying Brian> instantiate a bound generic type (Array[int] is equivalent Brian> to Array in C#), so when you say 'Array[int](10)' it Brian> is trying to create the bound generic type and initialize Brian> it with 10 (which is not an array), which is probably not Brian> what you intended. i should better understand what generic types are.... thanks Alberto P.S. Any commente on my idea of a wiki for pythondotnet? From alberto at metapensiero.it Sat Apr 21 02:29:53 2007 From: alberto at metapensiero.it (Alberto Berti) Date: Sat, 21 Apr 2007 02:29:53 +0200 Subject: [Python.NET] Installing Python for .NET with .NET 2.0? In-Reply-To: <87vefqa89j.fsf@lizard.lizardnet> (Alberto Berti's message of "Sat\, 21 Apr 2007 02\:19\:52 +0200") References: <87vefqa89j.fsf@lizard.lizardnet> Message-ID: <87r6qea7su.fsf@lizard.lizardnet> >>>>> "Alberto" == Alberto Berti writes: Alberto> i should better understand what generic types are.... i answer by myself.. generic classes are much more "pythonic" :)