From michael.foord at resolversystems.com Mon Dec 1 14:13:43 2008 From: michael.foord at resolversystems.com (Michael Foord) Date: Mon, 01 Dec 2008 13:13:43 +0000 Subject: [IronPython] Change to COM Interop in IronPython 2 Message-ID: <4933E307.8040909@resolversystems.com> Hello guys, In some of our Resolver One installer tests we do some COM interop to check that the targets of the shortcuts the installer creates are correct. It looks like the way COM interop is done in IronPython 2 has changed a bit. We are now getting an exception thrown when previously None was returned to us, and I'd like to check that this is the correct / expected behaviour. The code use to look like this: def GetLinkTarget(filename): import clr import sys sys.path.append(Path.GetFullPath('TestUtils')) clr.AddReferenceToFile('Interop.Shell32.dll') from Interop.Shell32 import ShellClass shell = ShellClass() folder = shell.NameSpace(Path.GetDirectoryName(filename)) folderItem = folder.ParseName(Path.GetFileName(filename)) if folderItem is not None: return folderItem.GetLink.Path In moving to IronPython 2 we've had to change the last line to: return folderItem.GetLink().Path() If we call the function with a filename that doesn't exist, folder.ParseName(...) used to return None. Now we get the following exception: Traceback (most recent call last): File "FunctionalTests\UnitTests\InstallerTestTest.py", line 97, in testGetLinkTarget2 self.assertNone(InstallerTest.GetLinkTarget( File "C:\shared\Ipy2\FunctionalTests\InstallerTest.py", line 67, in GetLinkTarget folderItem = folder.ParseName(Path.GetFileName(filename)) TypeError: Value cannot be null. Parameter name: pUnk All the best, Michael Foord -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From fuzzyman at voidspace.org.uk Mon Dec 1 16:41:22 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 01 Dec 2008 15:41:22 +0000 Subject: [IronPython] __init__ ignored in favor of base class constructor? - blocker In-Reply-To: <4817b6fc0811300742i210e9a0at834b57803dd2e899@mail.gmail.com> References: <4817b6fc0811291904v4c284026o3fa7093096a056b@mail.gmail.com> <49329565.8030301@voidspace.org.uk> <4817b6fc0811300742i210e9a0at834b57803dd2e899@mail.gmail.com> Message-ID: <493405A2.7030508@voidspace.org.uk> Dan Eloff wrote: > On Sun, Nov 30, 2008 at 8:30 AM, Michael Foord > wrote: > >> Hello Dan, >> >> I can't find this assembly to experiment - but when you subclass a .NET type >> in IronPython you override the constructor by overriding '__new__' and not >> '__init__'. Perhaps this is the cause of your problem? (If the default >> constructor takes two arguments then merely supplying an __init__ method >> that only takes one won't stop the default two argument constructor being >> called.) >> >> > > I don't think I've ever subclassed a .NET type that has a default > constructor taking an argument, hopefully the problem here is with me > and not IronPython :) I thought __new__ might be the one to use, but I > got these errors with __new__: > > class MyTheme(Theme): > def __new__(cls): > return Theme.__new__(cls, > Application.GetResourceStream(Uri('theme.xaml', UriKind.Relative))) > > TypeError: default __new__ does not take parameters. > > Looks like the subclassing bug *again*. :-) (i.e. it looks like Theme.__new__(...) is actually being diverted back to MyTheme.__new__(...)) Michael > If I use: > > class MyTheme(Theme): > def __new__(cls): > return Theme.__new__(cls) > > TypeError: MyTheme() takes at least 2 arguments (1 given) > > Back to square one. Do you have some idea what I'm doing wrong here? > The assembly is from the Silverlight Toolkit: > http://www.codeplex.com/Silverlight > > -Dan > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From dan.eloff at gmail.com Mon Dec 1 20:15:02 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Mon, 1 Dec 2008 14:15:02 -0500 Subject: [IronPython] __init__ ignored in favor of base class constructor? - blocker In-Reply-To: <493405A2.7030508@voidspace.org.uk> References: <4817b6fc0811291904v4c284026o3fa7093096a056b@mail.gmail.com> <49329565.8030301@voidspace.org.uk> <4817b6fc0811300742i210e9a0at834b57803dd2e899@mail.gmail.com> <493405A2.7030508@voidspace.org.uk> Message-ID: <4817b6fc0812011115y62037e8bpa8f8cbecd25e71a5@mail.gmail.com> On Mon, Dec 1, 2008 at 10:41 AM, Michael Foord wrote: > > Looks like the subclassing bug *again*. :-) > > (i.e. it looks like Theme.__new__(...) is actually being diverted back to > MyTheme.__new__(...)) > > Michael > I suspect this is the same bug you resolver guys have been reporting recently, but I reported this at http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20021 just to be thorough. -Dan From dinov at microsoft.com Mon Dec 1 20:22:43 2008 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 1 Dec 2008 11:22:43 -0800 Subject: [IronPython] __init__ ignored in favor of base class constructor? - blocker In-Reply-To: <4817b6fc0812011115y62037e8bpa8f8cbecd25e71a5@mail.gmail.com> References: <4817b6fc0811291904v4c284026o3fa7093096a056b@mail.gmail.com> <49329565.8030301@voidspace.org.uk> <4817b6fc0811300742i210e9a0at834b57803dd2e899@mail.gmail.com> <493405A2.7030508@voidspace.org.uk> <4817b6fc0812011115y62037e8bpa8f8cbecd25e71a5@mail.gmail.com> Message-ID: <350E7D38B6D819428718949920EC2355564A33293C@NA-EXMSG-C102.redmond.corp.microsoft.com> Thanks for opening this - I'm going to look at this and the other subclassing issues and see how scary the fix(es) are. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dan Eloff Sent: Monday, December 01, 2008 11:15 AM To: Discussion of IronPython Subject: Re: [IronPython] __init__ ignored in favor of base class constructor? - blocker On Mon, Dec 1, 2008 at 10:41 AM, Michael Foord wrote: > > Looks like the subclassing bug *again*. :-) > > (i.e. it looks like Theme.__new__(...) is actually being diverted back to > MyTheme.__new__(...)) > > Michael > I suspect this is the same bug you resolver guys have been reporting recently, but I reported this at http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20021 just to be thorough. -Dan _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at microsoft.com Mon Dec 1 20:26:22 2008 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 1 Dec 2008 11:26:22 -0800 Subject: [IronPython] [Hosting] Cannot convert callable class to delegate In-Reply-To: References: Message-ID: <350E7D38B6D819428718949920EC2355564A332947@NA-EXMSG-C102.redmond.corp.microsoft.com> Thanks for reporting & opening the bug. The fix for this is likely fairly easy but I don't think we'd spin a new 2.0 build for just this issue because it isn't really blocking anything as you have a work around. That being said it would certainly be something we'd fix for 2.0.1 and we don't expect the time between 2.0 and 2.0.1 to be particularly long. But if we were to spin a new 2.0 build for some other reason (which I'm a little worried we might need to do) we might just include this fix. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Hardy Sent: Saturday, November 22, 2008 10:34 AM To: Discussion of IronPython Subject: [IronPython] [Hosting] Cannot convert callable class to delegate Hi, Attempting to convert a class with a __call__() member to a delagte causes an ArgumentNullException; presumably it should create a delegate, as it is a valid callable object. It can be worked around be using a function that forwards to the class, but it's an annoyance to have to do that. I have opened #19724 (http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=19724); I mention it here because I would really like to see it fixed for 2.0. -Jeff _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at microsoft.com Mon Dec 1 20:43:45 2008 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 1 Dec 2008 11:43:45 -0800 Subject: [IronPython] __init__ ignored in favor of base class constructor? - blocker In-Reply-To: <4817b6fc0811300742i210e9a0at834b57803dd2e899@mail.gmail.com> References: <4817b6fc0811291904v4c284026o3fa7093096a056b@mail.gmail.com> <49329565.8030301@voidspace.org.uk> <4817b6fc0811300742i210e9a0at834b57803dd2e899@mail.gmail.com> Message-ID: <350E7D38B6D819428718949920EC2355564A33296B@NA-EXMSG-C102.redmond.corp.microsoft.com> Ok, I think the problem here is two-fold. First there's no public default constructor - only a private one. So you need to pick between the Stream overload or the StreamResourceInfo, Uri overload. You're apparently trying to choose the Stream overload. Which brings me to the 2nd problem. Quite surprisingly GetResourceStream doesn't seem to return a stream - it returns a StreamResourceInfo. So ultimately there are no applicable methods for us to call. I think you want: class MyTheme(Theme): def __new__(cls): return Theme.__new__(cls, Application.GetResourceStream(Uri('theme.xaml', UriKind.Relative)).Stream) And then we need to continue to work on improving our error messages which remain particularly bad in some spots :). -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dan Eloff Sent: Sunday, November 30, 2008 7:43 AM To: Discussion of IronPython Subject: Re: [IronPython] __init__ ignored in favor of base class constructor? - blocker On Sun, Nov 30, 2008 at 8:30 AM, Michael Foord wrote: > Hello Dan, > > I can't find this assembly to experiment - but when you subclass a .NET type > in IronPython you override the constructor by overriding '__new__' and not > '__init__'. Perhaps this is the cause of your problem? (If the default > constructor takes two arguments then merely supplying an __init__ method > that only takes one won't stop the default two argument constructor being > called.) > I don't think I've ever subclassed a .NET type that has a default constructor taking an argument, hopefully the problem here is with me and not IronPython :) I thought __new__ might be the one to use, but I got these errors with __new__: class MyTheme(Theme): def __new__(cls): return Theme.__new__(cls, Application.GetResourceStream(Uri('theme.xaml', UriKind.Relative))) TypeError: default __new__ does not take parameters. If I use: class MyTheme(Theme): def __new__(cls): return Theme.__new__(cls) TypeError: MyTheme() takes at least 2 arguments (1 given) Back to square one. Do you have some idea what I'm doing wrong here? The assembly is from the Silverlight Toolkit: http://www.codeplex.com/Silverlight -Dan _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From vernondcole at gmail.com Mon Dec 1 21:09:29 2008 From: vernondcole at gmail.com (Vernon Cole) Date: Mon, 1 Dec 2008 13:09:29 -0700 Subject: [IronPython] Announcing IronPython 2.0 RC2 In-Reply-To: References: Message-ID: Congratulations and "Well Done" to the Iron Python team! This release has taken Iron Python from an experimental curiosity to a viable work engine (IMHO). I ran my test suite and found only one remaining restriction -- Binary data cannot be passed as a parameter. (The same error shows up four times in testing because six different environments are used. It passes all tests under mySQL which does not attempt Binary.) I am enclosing an edited copy of the test results to document the result I found most surprising: Iron Python was faster than CPython in each test case! The test was set up as follows: Workstation: A mid-range HP minitower with a dual-core 2.4GHz CPU and 2 GB ram running XP Pro. ACCESS database built on the local C: drive. MS SQL database on a venerable SQL2000 server somewhere over the fiber. mySQL on an old Ubuntu workstation under my desk. Each test is run once with datetime.datetime dates and once with time.gmtime dates. (Unrelated Question: Why is datetime.datetime so *much* slower???) Then a generic test for dbapi 2.0 compliance is run. V v v v v v v v v Begin CPython Tests v v v v v v v v v v v v ...Lib\site-packages\adodbapi\tests>adodbapitest.py 2.6 (r26:66721, Oct 2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)] adodbapi v2.2.4 adodbapitestconfig.py v 2.2.4 ...Creating ACCESS db at c:\docume~1\wnvcole\locals~1\temp\test_odbc.mdb ...Testing MS-SQL login... ...Testing MySql login... Unit tests for adodbapi version 2.2.4 Default Date Converter is ................................................................................ ................... ---------------------------------------------------------------------- Ran 99 tests in 4.344s OK . . . . . . . . . . . . . . . ...Lib\site-packages\adodbapi\tests>test_adodbapi_dbapi20.py This module depends on the dbapi20 compliance tests created by Stuart Bishop (see db-sig mailing list history for info) Tested with dbapi20 1.10 2.6 (r26:66721, Oct 2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)] adodbapi v2.2.4 adodbapitestconfig.py v 2.2.4 ...Creating ACCESS db at c:\docume~1\wnvcole\locals~1\temp\test_odbc.mdb ...Testing MS-SQL login... ...Testing MySql login... .................................... ---------------------------------------------------------------------- Ran 36 tests in 2.203s OK V v v v v v v v v Begin IronPython Tests v v v v v v v v v v v v ...\Lib\site-packages\adodbapi\tests>"C:\Program Files\IronPython 2.0\ipy.exe" adodbapitest.py 2.5.0 (IronPython 2.0 (2.0.0.0) on .NET 2.0.50727.1433) adodbapi v2.2.4 adodbapitestconfig.py v 2.2.4 ...Creating ACCESS db at c:\documents and settings\wnvcole\local settings\temp\test_odbc.mdb ...Testing MS-SQL login... ...Testing MySql login... Unit tests for adodbapi version 2.2.4 Default Date Converter is ............................E......................E............................................... ====================================================================== ERROR: testDataTypeBinary (__main__.TestADOwithAccessDB) ---------------------------------------------------------------------- [...snip...Traceback ...] File "C:\Program Files\IronPython 2.0\Lib\site-packages\adodbapi\adodbapi.py", line 685, in _executeHelper p.AppendChunk(elem) TypeError: Specified cast is not valid. -- on command: "INSERT INTO tblTemp (fldId,fldData) VALUES (?,?)" -- with parameters: (2, ) ====================================================================== ERROR: testDataTypeBinary (__main__.TestADOwithSQLServer) ---------------------------------------------------------------------- [...snip (same error) ...] ---------------------------------------------------------------------- Ran 99 tests in 9.516s FAILED (errors=2) Changed dateconverter to ............................E......................E............................................... ====================================================================== ERROR: testDataTypeBinary (__main__.TestADOwithAccessDB) ---------------------------------------------------------------------- [...snip (same error) ...] ====================================================================== ERROR: testDataTypeBinary (__main__.TestADOwithSQLServer) ---------------------------------------------------------------------- [...snip (same error) ...] ---------------------------------------------------------------------- Ran 99 tests in 2.453s FAILED (errors=2) . . . . . . . ...\Lib\site-packages\adodbapi\tests>"C:\Program Files\IronPython 2.0\ipy.exe" test_adodbapi_dbapi20.py This module depends on the dbapi20 compliance tests created by Stuart Bishop (see db-sig mailing list history for info) Tested with dbapi20 1.10 2.5.0 (IronPython 2.0 (2.0.0.0) on .NET 2.0.50727.1433) adodbapi v2.2.4 adodbapitestconfig.py v 2.2.4 ...Creating ACCESS db at c:\documents and settings\wnvcole\local settings\temp\test_odbc.mdb ...Testing MS-SQL login... ...Testing MySql login... .................................... ---------------------------------------------------------------------- Ran 36 tests in 2.125s OK ^ ^ ^ ^ ^ ^ end of tests ^ ^ ^ ^ ^ ^ Vernon Cole On Wed, Nov 26, 2008 at 5:06 PM, Srivatsn Narayanan wrote: > [...] > > List of bugs fixed for this release:... > - 19130: One hour error in IPY implementation of time.mktime and > time.gmtime > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dan.eloff at gmail.com Mon Dec 1 21:21:33 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Mon, 1 Dec 2008 15:21:33 -0500 Subject: [IronPython] __init__ ignored in favor of base class constructor? - blocker In-Reply-To: <350E7D38B6D819428718949920EC2355564A33296B@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <4817b6fc0811291904v4c284026o3fa7093096a056b@mail.gmail.com> <49329565.8030301@voidspace.org.uk> <4817b6fc0811300742i210e9a0at834b57803dd2e899@mail.gmail.com> <350E7D38B6D819428718949920EC2355564A33296B@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <4817b6fc0812011221j6acad46fjf3a0c28a2c71d736@mail.gmail.com> On Mon, Dec 1, 2008 at 2:43 PM, Dino Viehland wrote: > Ok, I think the problem here is two-fold. First there's no public default constructor - only a private one. So you need to pick between the Stream overload or the StreamResourceInfo, Uri overload. You're apparently trying to choose the Stream overload. > > Which brings me to the 2nd problem. Quite surprisingly GetResourceStream doesn't seem to return a stream - it returns a StreamResourceInfo. So ultimately there are no applicable methods for us to call. That's the second time that method has got me. They should have named it GetResourceStreamInfo But the problem still remains: TypeError: default __new__ does not take parameters Line 7: class MyTheme(Theme): Line 8: def __new__(cls): Line 9: return Theme.__new__(cls, wpf.Application.GetResourceStream(wpf.Uri('theme.xaml', wpf.UriKind.Relative)).Stream) Line 10: Line 11: def demo(): TypeError at __new__ in app.py, line 9 at demo in app.py, line 12 at app.py in app.py, line 21 Thanks, -Dan From dinov at microsoft.com Mon Dec 1 21:35:42 2008 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 1 Dec 2008 12:35:42 -0800 Subject: [IronPython] __init__ ignored in favor of base class constructor? - blocker In-Reply-To: <4817b6fc0812011221j6acad46fjf3a0c28a2c71d736@mail.gmail.com> References: <4817b6fc0811291904v4c284026o3fa7093096a056b@mail.gmail.com> <49329565.8030301@voidspace.org.uk> <4817b6fc0811300742i210e9a0at834b57803dd2e899@mail.gmail.com> <350E7D38B6D819428718949920EC2355564A33296B@NA-EXMSG-C102.redmond.corp.microsoft.com> <4817b6fc0812011221j6acad46fjf3a0c28a2c71d736@mail.gmail.com> Message-ID: <350E7D38B6D819428718949920EC2355564A709B24@NA-EXMSG-C102.redmond.corp.microsoft.com> It looks like protected ctor's are completely broken: import clr clr.AddReference('test') from Xyz import Foo class x(Foo): def __new__(cls): return Foo.__new__(cls, object()) x() TypeError: default __new__ does not take parameters test.cs: using System; namespace Xyz { public class Foo { protected Foo(object x) { } } } -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dan Eloff Sent: Monday, December 01, 2008 12:22 PM To: Discussion of IronPython Subject: Re: [IronPython] __init__ ignored in favor of base class constructor? - blocker On Mon, Dec 1, 2008 at 2:43 PM, Dino Viehland wrote: > Ok, I think the problem here is two-fold. First there's no public default constructor - only a private one. So you need to pick between the Stream overload or the StreamResourceInfo, Uri overload. You're apparently trying to choose the Stream overload. > > Which brings me to the 2nd problem. Quite surprisingly GetResourceStream doesn't seem to return a stream - it returns a StreamResourceInfo. So ultimately there are no applicable methods for us to call. That's the second time that method has got me. They should have named it GetResourceStreamInfo But the problem still remains: TypeError: default __new__ does not take parameters Line 7: class MyTheme(Theme): Line 8: def __new__(cls): Line 9: return Theme.__new__(cls, wpf.Application.GetResourceStream(wpf.Uri('theme.xaml', wpf.UriKind.Relative)).Stream) Line 10: Line 11: def demo(): TypeError at __new__ in app.py, line 9 at demo in app.py, line 12 at app.py in app.py, line 21 Thanks, -Dan _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Mon Dec 1 21:38:02 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 01 Dec 2008 20:38:02 +0000 Subject: [IronPython] __init__ ignored in favor of base class constructor? - blocker In-Reply-To: <350E7D38B6D819428718949920EC2355564A709B24@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <4817b6fc0811291904v4c284026o3fa7093096a056b@mail.gmail.com> <49329565.8030301@voidspace.org.uk> <4817b6fc0811300742i210e9a0at834b57803dd2e899@mail.gmail.com> <350E7D38B6D819428718949920EC2355564A33296B@NA-EXMSG-C102.redmond.corp.microsoft.com> <4817b6fc0812011221j6acad46fjf3a0c28a2c71d736@mail.gmail.com> <350E7D38B6D819428718949920EC2355564A709B24@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <49344B2A.9070501@voidspace.org.uk> Dino Viehland wrote: > It looks like protected ctor's are completely broken: > > We've had issues calling other protected methods as well - see the bug reports we posted on Friday. Michael Foord > import clr > clr.AddReference('test') > from Xyz import Foo > class x(Foo): > def __new__(cls): > return Foo.__new__(cls, object()) > > x() > > TypeError: default __new__ does not take parameters > > test.cs: > > using System; > > namespace Xyz { > public class Foo { > protected Foo(object x) { } > } > } > > > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dan Eloff > Sent: Monday, December 01, 2008 12:22 PM > To: Discussion of IronPython > Subject: Re: [IronPython] __init__ ignored in favor of base class constructor? - blocker > > On Mon, Dec 1, 2008 at 2:43 PM, Dino Viehland wrote: > >> Ok, I think the problem here is two-fold. First there's no public default constructor - only a private one. So you need to pick between the Stream overload or the StreamResourceInfo, Uri overload. You're apparently trying to choose the Stream overload. >> >> Which brings me to the 2nd problem. Quite surprisingly GetResourceStream doesn't seem to return a stream - it returns a StreamResourceInfo. So ultimately there are no applicable methods for us to call. >> > > That's the second time that method has got me. They should have named > it GetResourceStreamInfo > > But the problem still remains: > > TypeError: default __new__ does not take parameters > > Line 7: class MyTheme(Theme): > Line 8: def __new__(cls): > Line 9: return Theme.__new__(cls, > wpf.Application.GetResourceStream(wpf.Uri('theme.xaml', > wpf.UriKind.Relative)).Stream) > Line 10: > Line 11: def demo(): > > TypeError > at __new__ in app.py, line 9 > at demo in app.py, line 12 > at app.py in app.py, line 21 > > Thanks, > -Dan > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From dinov at microsoft.com Mon Dec 1 21:46:04 2008 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 1 Dec 2008 12:46:04 -0800 Subject: [IronPython] __init__ ignored in favor of base class constructor? - blocker In-Reply-To: <49344B2A.9070501@voidspace.org.uk> References: <4817b6fc0811291904v4c284026o3fa7093096a056b@mail.gmail.com> <49329565.8030301@voidspace.org.uk> <4817b6fc0811300742i210e9a0at834b57803dd2e899@mail.gmail.com> <350E7D38B6D819428718949920EC2355564A33296B@NA-EXMSG-C102.redmond.corp.microsoft.com> <4817b6fc0812011221j6acad46fjf3a0c28a2c71d736@mail.gmail.com> <350E7D38B6D819428718949920EC2355564A709B24@NA-EXMSG-C102.redmond.corp.microsoft.com> <49344B2A.9070501@voidspace.org.uk> Message-ID: <350E7D38B6D819428718949920EC2355564A709B34@NA-EXMSG-C102.redmond.corp.microsoft.com> My guess is that's actually a different bug (possibly the same as 19434 & 19218 which might be dups of each other). That's actually what I'm trying to look at fixing right now. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Monday, December 01, 2008 12:38 PM To: Discussion of IronPython Subject: Re: [IronPython] __init__ ignored in favor of base class constructor? - blocker Dino Viehland wrote: > It looks like protected ctor's are completely broken: > > We've had issues calling other protected methods as well - see the bug reports we posted on Friday. Michael Foord > import clr > clr.AddReference('test') > from Xyz import Foo > class x(Foo): > def __new__(cls): > return Foo.__new__(cls, object()) > > x() > > TypeError: default __new__ does not take parameters > > test.cs: > > using System; > > namespace Xyz { > public class Foo { > protected Foo(object x) { } > } > } > > > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dan Eloff > Sent: Monday, December 01, 2008 12:22 PM > To: Discussion of IronPython > Subject: Re: [IronPython] __init__ ignored in favor of base class constructor? - blocker > > On Mon, Dec 1, 2008 at 2:43 PM, Dino Viehland wrote: > >> Ok, I think the problem here is two-fold. First there's no public default constructor - only a private one. So you need to pick between the Stream overload or the StreamResourceInfo, Uri overload. You're apparently trying to choose the Stream overload. >> >> Which brings me to the 2nd problem. Quite surprisingly GetResourceStream doesn't seem to return a stream - it returns a StreamResourceInfo. So ultimately there are no applicable methods for us to call. >> > > That's the second time that method has got me. They should have named > it GetResourceStreamInfo > > But the problem still remains: > > TypeError: default __new__ does not take parameters > > Line 7: class MyTheme(Theme): > Line 8: def __new__(cls): > Line 9: return Theme.__new__(cls, > wpf.Application.GetResourceStream(wpf.Uri('theme.xaml', > wpf.UriKind.Relative)).Stream) > Line 10: > Line 11: def demo(): > > TypeError > at __new__ in app.py, line 9 > at demo in app.py, line 12 > at app.py in app.py, line 21 > > Thanks, > -Dan > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From Jimmy.Schementi at microsoft.com Mon Dec 1 23:21:07 2008 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 1 Dec 2008 14:21:07 -0800 Subject: [IronPython] Some observations about parallel import and Silverlight In-Reply-To: <4817b6fc0811251555y3122a946l480388cd689b6340@mail.gmail.com> References: <4817b6fc0811251555y3122a946l480388cd689b6340@mail.gmail.com> Message-ID: <5283CA0A4168DF4FBBD71AE9ECA5A3284BDA9F45E9@NA-EXMSG-C116.redmond.corp.microsoft.com> This is awesome! Thanks for looking into this. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Dan Eloff > Sent: Tuesday, November 25, 2008 3:55 PM > To: Discussion of IronPython > Subject: [IronPython] Some observations about parallel import and > Silverlight > > Thanks to the excellent work of Kamil > (http://github.com/luntain/ipy-parallel-import/tree/master), and the > help of Jimmy I now have importing being done in parallel in 4 threads > in Silverlight. > > I had to restructure my code a little to reduce circular imports (not > a bad thing to do anyway) and I had to hand-tweak the dependency graph > to deal with conditional imports and other difficult to track > dependencies. > > The result was better than I could have hoped for. I'm seeing 43% > faster loading on my dual-core development pc. I used to have blank > screen at start that made you wonder if the browser has frozen. But > now the browser is responsive and I have a nice working progress bar. > But that's not the best news. > > The kicker is that the benefit is even larger on slow single core > machines with dialup internet. I posted a while back on this list that > IE does not immediately send an asynchronous request. It waits until > it's UI thread is idle (which doesn't happen if your importing modules > like crazy on it.) So the net effect was the application loads (about > 28 seconds on a P4 2ghz) and then it sends the request, waits for the > response (which is big in my case), and processes it - all in order. > So if that takes another 30 seconds, you have nearly 1 minute of load > time. With the UI thread mostly idle now, this happens in parallel to > the importing, and the overall load time drops by a whopping 45%. > > In the words of my generation - w00t! > > -Dan > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From Jimmy.Schementi at microsoft.com Mon Dec 1 23:24:06 2008 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 1 Dec 2008 14:24:06 -0800 Subject: [IronPython] clr assembly reference error in Ipy / Silverlight (but works in ipy) In-Reply-To: <20ab7c020811262207u757ab3cfvd8489282c762e79e@mail.gmail.com> References: <20ab7c020811262135r719b2755j827ee1c821af994d@mail.gmail.com> <20ab7c020811262144r17b9e8e5sb0b7fe5cf2f78667@mail.gmail.com> <20ab7c020811262207u757ab3cfvd8489282c762e79e@mail.gmail.com> Message-ID: <5283CA0A4168DF4FBBD71AE9ECA5A3284BDA9F45F2@NA-EXMSG-C116.redmond.corp.microsoft.com> You would face this issue even if you used the assembly from C#. Silverlight has a subset of the .NET framework, so like Curt said, it might be as simple as recompiling, or as hard as changing the code to not depend on missing APIs. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Nummers Sent: Wednesday, November 26, 2008 10:08 PM To: Discussion of IronPython Subject: Re: [IronPython] clr assembly reference error in Ipy / Silverlight (but works in ipy) ok I think that makes sense, thanks Just so I understand, this is really an issue of different .NET frameworks between the desktop and Silverlight? So, I would face this issue even if I did not use DLR and went with C#? On Thu, Nov 27, 2008 at 12:50 AM, Curt Hagenlocher > wrote: Unfortunately, the Silverlight and desktop CLRs aren't binary-compatible -- you're basically linking against a different set of strongly-named assemblies when you're building a Silverlight version. You'll almost certainly need to contact the vendor and ask them to provide support for Silverlight in order for it to be usable there. This may not require much more work than a simple rebuild, but if they've used any APIs that aren't supported under Silverlight (like .NET serialization or the original collection classes) then they'd need to modify the source code as well. On Wed, Nov 26, 2008 at 9:44 PM, Nummers > wrote: Wow , that was fast... Anyway no I did not / can not, this is a third party dll. From the docs "Technically, it is a .NET 2.0 assembly (DLL library), ..." On Thu, Nov 27, 2008 at 12:37 AM, Curt Hagenlocher > wrote: You've built two different versions of API.dll -- one for the desktop CLR and one for Silverlight -- yes? On Wed, Nov 26, 2008 at 9:35 PM, Nummers > wrote: Just getting going on Ipy / Silverlight and hit a roadblock. This works on ipy but gives an error w/ Ipy in Silverlight (IOError: Could not add reference to assembly API.dll). import clr clr.AddReference('API.dll') from OEC.API import * from OEC.DATA import * same kind of error with: clr.AddReference("API, Version=3.2.0.0, Culture=neutral, PublicKeyToken=b6b45f27e2749b17") and with: clr.LoadAssemblyByName("API, Version=3.2.0.0, Culture=neutral, PublicKeyToken=b6b45f27e2749b17") Now, this gives no error: clr.AddReferenceToFile("API.dll") However the imports fail (ImportError: No module named OEC.API Not too much experience loading assemblies but, as I said, all is well in ipy. Hope I'm just doing something stooopid. Very much appreciate any help! Dano _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jimmy.Schementi at microsoft.com Mon Dec 1 23:26:25 2008 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 1 Dec 2008 14:26:25 -0800 Subject: [IronPython] clr assembly reference error in Ipy / Silverlight (but works in ipy) In-Reply-To: <26756bf60811272307s4dd27572hb1af1066c348c003@mail.gmail.com> References: <20ab7c020811262135r719b2755j827ee1c821af994d@mail.gmail.com> <26756bf60811272307s4dd27572hb1af1066c348c003@mail.gmail.com> Message-ID: <5283CA0A4168DF4FBBD71AE9ECA5A3284BDA9F45F7@NA-EXMSG-C116.redmond.corp.microsoft.com> Correction: the AppManifest.xaml is only for assemblies you want to load when the application starts. Doing clr.AddReference will currently look in the XAP and load the assembly at any time in the program's execution, without needing to have it listed in the AppManifest.xaml. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Neil(???) > Sent: Thursday, November 27, 2008 11:08 PM > To: Discussion of IronPython > Subject: Re: [IronPython] clr assembly reference error in Ipy / > Silverlight (but works in ipy) > > Well, I guess there is another issue which will possibly cause your > error message. > > With chiron, if you need to reference an additional assembly, you also > need to modify the AppManifest.xaml file by hand and add an entry to > it, like this: > > > > > /> > > > > > > > > Best Regards, > Neil Chen > > On Thu, Nov 27, 2008 at 1:35 PM, Nummers wrote: > > Just getting going on Ipy / Silverlight and hit a roadblock. > > > > This works on ipy but gives an error w/ Ipy in Silverlight (IOError: > Could > > not add reference to assembly API.dll). > > > > import clr > > clr.AddReference('API.dll') > > from OEC.API import * > > from OEC.DATA import * > > > > same kind of error with: > > clr.AddReference("API, Version=3.2.0.0, Culture=neutral, > > PublicKeyToken=b6b45f27e2749b17") > > and with: > > clr.LoadAssemblyByName("API, Version=3.2.0.0, Culture=neutral, > > PublicKeyToken=b6b45f27e2749b17") > > > > Now, this gives no error: > > clr.AddReferenceToFile("API.dll") > > However the imports fail (ImportError: No module named OEC.API > > > > Not too much experience loading assemblies but, as I said, all is > well in > > ipy. > > > > Hope I'm just doing something stooopid. > > > > Very much appreciate any help! > > > > Dano > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From jdhardy at gmail.com Tue Dec 2 03:48:52 2008 From: jdhardy at gmail.com (Jeff Hardy) Date: Mon, 1 Dec 2008 19:48:52 -0700 Subject: [IronPython] [Hosting] Cannot convert callable class to delegate In-Reply-To: <350E7D38B6D819428718949920EC2355564A332947@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <350E7D38B6D819428718949920EC2355564A332947@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: On Mon, Dec 1, 2008 at 12:26 PM, Dino Viehland wrote: > Thanks for reporting & opening the bug. The fix for this is likely fairly easy but I don't think we'd spin a new 2.0 build for just this issue because it isn't really blocking anything as you have a work around. > > That being said it would certainly be something we'd fix for 2.0.1 and we don't expect the time between 2.0 and 2.0.1 to be particularly long. But if we were to spin a new 2.0 build for some other reason (which I'm a little worried we might need to do) we might just include this fix. I agree, no need to hold 2.0 just for this little bug. -Jeff From rob.s.oakes at gmail.com Tue Dec 2 05:01:47 2008 From: rob.s.oakes at gmail.com (Rob Oakes) Date: Mon, 1 Dec 2008 21:01:47 -0700 Subject: [IronPython] A Multithreaded Question Message-ID: <4934b348.20038e0a.4384.ffffbfc7@mx.google.com> Dear Group, For the past several weeks, I have been trying to wrap my head around the different classes available in System.Threads. While I feel that I have a good handle on the "BackgroundWorker" class, I without doubt have a very long way to go on the others. With that said, I have a bit of an architectural question. I have been working on a multithreaded download manager for a small podcast player (written primarily to start teaching myself Python). I've written about the details of the download manager at: http://robertsoakes.brinkster.net/blog/?p=222 Very briefly, it uses a C# wrapper to interact with the Background Intelligent Transfer Service (BITS). Details about the C# wrapper code can be found at: http://robertsoakes.brinkster.net/blog/?p=141 While I have a very rough prototype that works, I'm not sure what the best way to have it update a progress bar is. At present, I have created a BackgroundWorker that sets the ProgressBar.Value whenever something changes. As this is nearly constant, it seems as though the thread doing the updates queries the BitsJob hundreds or thousands of times a second. This seems unnecessary and kills the responsiveness of the program. I fixed this (kindof) by putting the thread doing the query to sleep for 200 ms (via Thread.Sleep(200)). While this increases the responsiveness of the program, it feels like a hack. Are there any other strategies that I could pursue? Thanks, Rob Oakes __________ Information from ESET NOD32 Antivirus, version of virus signature database 3655 (20081201) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From yashgt at gmail.com Tue Dec 2 09:34:32 2008 From: yashgt at gmail.com (Yash Ganthe) Date: Tue, 2 Dec 2008 14:04:32 +0530 Subject: [IronPython] Does IronPython 2.0 not recognize packages? Message-ID: <4f428e7b0812020034o40dbb4a4g8cc39f0f764b976c@mail.gmail.com> I am using IronPython 2.0 Release Candidate 2 >ipy Program.py Traceback (most recent call last): File "Program.py", line 22, in Program.py File "mscorlib", line unknown, in get_Item File "mscorlib", line unknown, in ThrowKeyNotFoundException KeyError: The given key was not present in the dictionary. Line 22 where it fails has: from PI import * I expect all modules from the PI folder to be loaded. The PI folder has __init__.py which has the following line: __all__ = ["Authentication"] Authentication.py is in the PI folder. I replaced the erring line with : sys.path.append(r'.\PI') from Authentication import * and it worked. Does IronPython not recognize packages? Thanks, Yash -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Tue Dec 2 11:47:04 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 02 Dec 2008 10:47:04 +0000 Subject: [IronPython] Does IronPython 2.0 not recognize packages? In-Reply-To: <4f428e7b0812020034o40dbb4a4g8cc39f0f764b976c@mail.gmail.com> References: <4f428e7b0812020034o40dbb4a4g8cc39f0f764b976c@mail.gmail.com> Message-ID: <49351228.10100@voidspace.org.uk> Yash Ganthe wrote: > I am using IronPython 2.0 Release Candidate 2 > > Packages work fine with IronPython 2. > >ipy Program.py > Traceback (most recent call last): > File "Program.py", line 22, in Program.py > File "mscorlib", line unknown, in get_Item > File "mscorlib", line unknown, in ThrowKeyNotFoundException > KeyError: The given key was not present in the dictionary. > > Line 22 where it fails has: > from PI import * > I expect all modules from the PI folder to be loaded. The PI folder > has __init__.py which has the following line: > __all__ = ["Authentication"] This will cause Python to expect the name 'Authentication' to exist in the '__init__.py' file itself - which it won't unless that module imports it. > Authentication.py is in the PI folder. > > I replaced the erring line with : > sys.path.append(r'.\PI') > from Authentication import * > This is *very* different to having __all__ = ["Authentication"] in the module. Try it without the sys.path manipulation and I think you will find it still works. All the best, Michael Foord > and it worked. > > Does IronPython not recognize packages? > > Thanks, > Yash > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ From deepali_abhyankar at persistent.co.in Tue Dec 2 12:13:03 2008 From: deepali_abhyankar at persistent.co.in (Deepali Abhyankar) Date: Tue, 2 Dec 2008 16:43:03 +0530 Subject: [IronPython] Logging module error Message-ID: <002c01c9546e$f1d6c610$d5845230$@co.in> Hi I am using Iron Python 2.0 release candidate 2. I am using logging module Code is: Import logging logger = logging.getLogger("Trial") logger.setLevel(logging.INFO) hdlr = logging.FileHandler("data.txt","w") hdlr.setLevel(logging.INFO) formatter = logging.Formatter("%(asctime)s-%(name)s-%(message)s") hdlr.setFormatter(formatter) logger.addHandler(hdlr) logger.info(message) I am facing following error on execution File "C:\Program Files\IronPython 2.0\Lib\logging\__init__.py", line 985, in i nfo File "C:\Program Files\IronPython 2.0\Lib\logging\__init__.py", line 1094, in _log File "C:\Program Files\IronPython 2.0\Lib\logging\__init__.py", line 1063, in findCaller File "C:\Program Files\IronPython 2.0\Lib\logging\__init__.py", line 71, in ValueError: _getframe is not implemented for non-zero depth Please suggest solution to resolve this Deepali Abhyankar | Senior Software Engineer| Persistent Systems deepali_abhyankar at persistent.co.in | Tel: +91 (20) 3023 5040 Innovation in software product design, development and delivery- www.persistentsys.com DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Tue Dec 2 12:59:35 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 02 Dec 2008 11:59:35 +0000 Subject: [IronPython] Logging module error In-Reply-To: <002c01c9546e$f1d6c610$d5845230$@co.in> References: <002c01c9546e$f1d6c610$d5845230$@co.in> Message-ID: <49352327.4070309@voidspace.org.uk> Hello Deepali, sys._getframe is not available in IronPython. If you post the relevant section of code from the logging module we may be able to suggest a patch / workaround (disabling some functionality may be the way forward - but often getframe is used to find a trivial bit of information that can be supplied another way). All the best, Michael Foord Deepali Abhyankar wrote: > > > > Hi > > > > I am using Iron Python 2.0 release candidate 2. > > I am using logging module > > *Code is*: > > Import logging > > logger = logging.getLogger("Trial") > > logger.setLevel(logging.INFO) > > > > hdlr = logging.FileHandler("data.txt","w") > > hdlr.setLevel(logging.INFO) > > formatter = logging.Formatter("%(asctime)s-%(name)s-%(message)s") > > hdlr.setFormatter(formatter) > > logger.addHandler(hdlr) > > logger.info(message) > > > > *I am facing following error on execution * > > * * > > File "C:\Program Files\IronPython 2.0\Lib\logging\__init__.py", line > 985, in i > > nfo > > File "C:\Program Files\IronPython 2.0\Lib\logging\__init__.py", line > 1094, in > > _log > > File "C:\Program Files\IronPython 2.0\Lib\logging\__init__.py", line > 1063, in > > findCaller > > File "C:\Program Files\IronPython 2.0\Lib\logging\__init__.py", line > 71, in > ambda$1> > > ValueError: _getframe is not implemented for non-zero depth > > > > Please suggest solution to resolve this > > > > > > *Deepali Abhyankar **|** Senior Software Engineer**|** Persistent Systems* > > *deepali_abhyankar at persistent.co.in* > * **| **Tel: +91 (20) 3023 5040* > > *Innovation in software product design, development and delivery- > **www.persistentsys.com* ** > > > > DISCLAIMER ========== This e-mail may contain privileged and > confidential information which is the property of Persistent Systems > Ltd. It is intended only for the use of the individual or entity to > which it is addressed. If you are not the intended recipient, you are > not authorized to read, retain, copy, print, distribute or use this > message. If you have received this communication in error, please > notify the sender and delete all copies of this message. Persistent > Systems Ltd. does not accept any liability for virus infected mails. > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ From fuzzyman at voidspace.org.uk Tue Dec 2 13:19:48 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 02 Dec 2008 12:19:48 +0000 Subject: [IronPython] Logging module error In-Reply-To: <000301c95477$4329bce0$c97d36a0$@co.in> References: <002c01c9546e$f1d6c610$d5845230$@co.in> <49352327.4070309@voidspace.org.uk> <000301c95477$4329bce0$c97d36a0$@co.in> Message-ID: <493527E4.1030200@voidspace.org.uk> Deepali Abhyankar wrote: > Hi Michael, > > This is the only code am writing in ipy.exe > and getting error > I am using inbuilt logging module provided by Iron Python. > The logging module is not inbuilt to IronPython - it is part of the Python standard library. As you can see from the traceback the Python file the error is occurring in is located at: "C:\Program Files\IronPython 2.0\Lib\logging\__init__.py" The traceback also gives the line numbers of the errors. All the best, Michael Foord > Deepali > > > > -----Original Message----- > From: Michael Foord [mailto:fuzzyman at voidspace.org.uk] > Sent: Tuesday, December 02, 2008 5:30 PM > To: deepali_abhyankar at persistent.co.in; Discussion of IronPython > Subject: Re: [IronPython] Logging module error > > Hello Deepali, > > sys._getframe is not available in IronPython. If you post the relevant > section of code from the logging module we may be able to suggest a > patch / workaround (disabling some functionality may be the way forward > - but often getframe is used to find a trivial bit of information that > can be supplied another way). > > All the best, > > Michael Foord > > Deepali Abhyankar wrote: > >> >> >> Hi >> >> >> >> I am using Iron Python 2.0 release candidate 2. >> >> I am using logging module >> >> *Code is*: >> >> Import logging >> >> logger = logging.getLogger("Trial") >> >> logger.setLevel(logging.INFO) >> >> >> >> hdlr = logging.FileHandler("data.txt","w") >> >> hdlr.setLevel(logging.INFO) >> >> formatter = logging.Formatter("%(asctime)s-%(name)s-%(message)s") >> >> hdlr.setFormatter(formatter) >> >> logger.addHandler(hdlr) >> >> logger.info(message) >> >> >> >> *I am facing following error on execution * >> >> * * >> >> File "C:\Program Files\IronPython 2.0\Lib\logging\__init__.py", line >> 985, in i >> >> nfo >> >> File "C:\Program Files\IronPython 2.0\Lib\logging\__init__.py", line >> 1094, in >> >> _log >> >> File "C:\Program Files\IronPython 2.0\Lib\logging\__init__.py", line >> 1063, in >> >> findCaller >> >> File "C:\Program Files\IronPython 2.0\Lib\logging\__init__.py", line >> 71, in > >> ambda$1> >> >> ValueError: _getframe is not implemented for non-zero depth >> >> >> >> Please suggest solution to resolve this >> >> >> >> >> DISCLAIMER ========== This e-mail may contain privileged and >> confidential information which is the property of Persistent Systems >> Ltd. It is intended only for the use of the individual or entity to >> which it is addressed. If you are not the intended recipient, you are >> not authorized to read, retain, copy, print, distribute or use this >> message. If you have received this communication in error, please >> notify the sender and delete all copies of this message. Persistent >> Systems Ltd. does not accept any liability for virus infected mails. >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > > -- http://www.ironpythoninaction.com/ From sanxiyn at gmail.com Tue Dec 2 13:57:02 2008 From: sanxiyn at gmail.com (Seo Sanghyeon) Date: Tue, 2 Dec 2008 21:57:02 +0900 Subject: [IronPython] Logging module error In-Reply-To: <002c01c9546e$f1d6c610$d5845230$@co.in> References: <002c01c9546e$f1d6c610$d5845230$@co.in> Message-ID: <5b0248170812020457n42ef8564kc6c00f02aa0b3137@mail.gmail.com> 2008/12/2 Deepali Abhyankar : > (logging and _getframe) > Please suggest solution to resolve this https://fepy.svn.sourceforge.net/svnroot/fepy/trunk/patches/stdlib/2.4.4/patch-stdlib-logging-getframe -- Seo Sanghyeon From fuzzyman at voidspace.org.uk Tue Dec 2 14:01:56 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 02 Dec 2008 13:01:56 +0000 Subject: [IronPython] Logging module error In-Reply-To: <5b0248170812020457n42ef8564kc6c00f02aa0b3137@mail.gmail.com> References: <002c01c9546e$f1d6c610$d5845230$@co.in> <5b0248170812020457n42ef8564kc6c00f02aa0b3137@mail.gmail.com> Message-ID: <493531C4.7050505@voidspace.org.uk> Seo Sanghyeon wrote: > 2008/12/2 Deepali Abhyankar : > >> (logging and _getframe) >> Please suggest solution to resolve this >> > > https://fepy.svn.sourceforge.net/svnroot/fepy/trunk/patches/stdlib/2.4.4/patch-stdlib-logging-getframe > > Seo - you're still alive! How about an updated release of FePy? :-) Michael -- http://www.ironpythoninaction.com/ From muwem at web.de Tue Dec 2 14:09:14 2008 From: muwem at web.de (Uwe Mueller) Date: Tue, 02 Dec 2008 14:09:14 +0100 Subject: [IronPython] Status ctypes and IronPython or Alternative? Message-ID: <1445779584@web.de> Does anybody know about the status of ctypes for IronPython? It would be very helpful to have a version that supports function calls to unmanaged code with parameter being a pointer to modifiable byte buffer. I have tried the version from FEPY on sourceforge. It implements only some numeric types and does not have byte or byte buffer types. Also, it does not run on IPY2.0 because IronPython.Runtime.Calls was removed in IPY2.0 Is there some alternative to ctypes without need to get the feet wet (write non-Python code)? thx, Uwe Mueller ____________________________________________________________________ Psssst! Schon vom neuen WEB.DE MultiMessenger geh?rt? Der kann`s mit allen: http://www.produkte.web.de/messenger/?did=3123 From oripel at gmail.com Tue Dec 2 14:16:18 2008 From: oripel at gmail.com (orip) Date: Tue, 2 Dec 2008 05:16:18 -0800 (PST) Subject: [IronPython] Does IronPython 2.0 not recognize packages? In-Reply-To: <4f428e7b0812020034o40dbb4a4g8cc39f0f764b976c@mail.gmail.com> References: <4f428e7b0812020034o40dbb4a4g8cc39f0f764b976c@mail.gmail.com> Message-ID: <5eb62ad5-96e1-49d4-89d5-a995526d80c5@n10g2000yqm.googlegroups.com> If you have the following structure: Program.py PI /__init__.py /Authentication.py an empty __init__.py will allow you to do: import PI.Authentication from PI import Authentication If your __init__.py contains: import Authentication Then you can do: from PI import * and import PI PI.Authentication '__all__' only works with symbols already defined in __init__.py itself On Dec 2, 10:34?am, "Yash Ganthe" wrote: > I am using IronPython 2.0 Release Candidate 2 > > >ipy Program.py > > Traceback (most recent call last): > File "Program.py", line 22, in Program.py > File "mscorlib", line unknown, in get_Item > File "mscorlib", line unknown, in ThrowKeyNotFoundException > KeyError: The given key was not present in the dictionary. > > Line 22 where it fails has: > from PI import * > I expect all modules from the PI folder to be loaded. The PI folder has > __init__.py which has the following line: > __all__ = ["Authentication"] > Authentication.py is in the PI folder. > > I replaced the erring line with : > sys.path.append(r'.\PI') > from Authentication import * > > and it worked. > > Does IronPython not recognize packages? > > Thanks, > Yash > > _______________________________________________ > Users mailing list > Us... at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dan.eloff at gmail.com Tue Dec 2 14:22:44 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Tue, 2 Dec 2008 08:22:44 -0500 Subject: [IronPython] Status ctypes and IronPython or Alternative? In-Reply-To: <1445779584@web.de> References: <1445779584@web.de> Message-ID: <4817b6fc0812020522i4b60df10xb0f8d923868333df@mail.gmail.com> On Tue, Dec 2, 2008 at 8:09 AM, Uwe Mueller wrote: > Does anybody know about the status of ctypes for IronPython? Best we have is in FEPY right now. > It would be very helpful to have a version that supports function calls to unmanaged code with parameter being a pointer to modifiable byte buffer. > > I have tried the version from FEPY on sourceforge. > > It implements only some numeric types and does not have byte or byte buffer types. > > Also, it does not run on IPY2.0 because IronPython.Runtime.Calls was removed in IPY2.0 > > Is there some alternative to ctypes without need to get the feet wet (write non-Python code)? > No, sorry. PyPy has a pure python ctypes implementation, which would be the easiest way to get ctypes in IronPython, but it requires implementing the _rawffi module, which nobody has done yet. -Dan From yashgt at gmail.com Tue Dec 2 14:26:04 2008 From: yashgt at gmail.com (Yash Ganthe) Date: Tue, 2 Dec 2008 18:56:04 +0530 Subject: [IronPython] Does IronPython 2.0 not recognize packages? In-Reply-To: <4f428e7b0812020034o40dbb4a4g8cc39f0f764b976c@mail.gmail.com> References: <4f428e7b0812020034o40dbb4a4g8cc39f0f764b976c@mail.gmail.com> Message-ID: <4f428e7b0812020526i57123d5ct2e00ef41ccda1974@mail.gmail.com> >>>>>Michael Foord wrote This will cause Python to expect the name 'Authentication' to exist in the '__init__.py' file itself - which it won't unless that module imports it. >>>>> I am pretty new to Python. I put the following in __init__.py import Authentication __all__ = ["Authentication"] I still get the error: > Traceback (most recent call last): > File "Program.py", line 22, in Program.py > File "mscorlib", line unknown, in get_Item > File "mscorlib", line unknown, in ThrowKeyNotFoundException > KeyError: The given key was not present in the dictionary. Thanks, Yash ----------------------------------------- Yash Ganthe wrote: > I am using IronPython 2.0 Release Candidate 2 > > Packages work fine with IronPython 2. > >ipy Program.py > Traceback (most recent call last): > File "Program.py", line 22, in Program.py > File "mscorlib", line unknown, in get_Item > File "mscorlib", line unknown, in ThrowKeyNotFoundException > KeyError: The given key was not present in the dictionary. > > Line 22 where it fails has: > from PI import * > I expect all modules from the PI folder to be loaded. The PI folder > has __init__.py which has the following line: > __all__ = ["Authentication"] This will cause Python to expect the name 'Authentication' to exist in the '__init__.py' file itself - which it won't unless that module imports it. > Authentication.py is in the PI folder. > > I replaced the erring line with : > sys.path.append(r'.\PI') > from Authentication import * > This is *very* different to having __all__ = ["Authentication"] in the module. Try it without the sys.path manipulation and I think you will find it still works. All the best, Michael Foord -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Tue Dec 2 18:40:56 2008 From: vernondcole at gmail.com (Vernon Cole) Date: Tue, 2 Dec 2008 10:40:56 -0700 Subject: [IronPython] Logging module error In-Reply-To: <493531C4.7050505@voidspace.org.uk> References: <002c01c9546e$f1d6c610$d5845230$@co.in> <5b0248170812020457n42ef8564kc6c00f02aa0b3137@mail.gmail.com> <493531C4.7050505@voidspace.org.uk> Message-ID: Seo: Yes, please, make a new release as soon as you can. I have uploaded the IPy-compatible version of adodbapi to the trunk, and it needs 2.0 to work correctly. The 2.0 installer from MS is nice, but the "batteries included" version from FePy will be nicer. -- Vernon On Tue, Dec 2, 2008 at 6:01 AM, Michael Foord wrote: > Seo Sanghyeon wrote: > >> >> Seo - you're still alive! How about an updated release of FePy? :-) > > Michael > > -- > http://www.ironpythoninaction.com/ > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Marty.Nelson at symyx.com Tue Dec 2 20:11:13 2008 From: Marty.Nelson at symyx.com (Marty Nelson) Date: Tue, 2 Dec 2008 11:11:13 -0800 Subject: [IronPython] Event unhooking and IPy2 In-Reply-To: <93fc29d60811291315r17da962avc82789baabc75029@mail.gmail.com> References: <2679f6510811280336t2aaca6b7pcdce1b206aa8f4a9@mail.gmail.com><492FD877.2040108@voidspace.org.uk> <93fc29d60811291315r17da962avc82789baabc75029@mail.gmail.com> Message-ID: <515335F32AA04440B3DE6FEA1993E9AD03269FB3@srv-be-101.Symyx-IC.symyx.com> We've had probably with memory leaks on Windows Form subscribed menu item clicks, just with plain vanilla C#. Check out this link http://www.bobpowell.net/eventsubscribers.htm (There are some additional steps for System.Windows.Forms.Component), and here's some sample code I wrote in C# that you could leverage: [TestClass] public class UnhookEventsTests { private class Item { public event EventHandler Clicked; public void FireEvent() { if(Clicked != null) { Clicked(this, EventArgs.Empty); } } } [TestMethod] public void UnhookEvents() { Item item = new Item(); item.Clicked += Clicked; item.Clicked += Clicked2; item.FireEvent(); Assert.AreEqual(2, callCount_); FieldInfo field = typeof (Item).GetField("Clicked", BindingFlags.NonPublic | BindingFlags.Instance); Delegate del = (Delegate) field.GetValue(item); Delegate[] list = del.GetInvocationList(); Assert.AreEqual(2, list.Length); //This works: //foreach (Delegate d in list) //{ // item.Clicked -= (EventHandler) d; //} //This is more generic and avoids the cast to the specific handler type EventInfo eventInfo = typeof (Item).GetEvent("Clicked"); foreach (Delegate d in list) { eventInfo.RemoveEventHandler(item, d); } item.FireEvent(); Assert.AreEqual(2, callCount_); } private int callCount_; private void Clicked(object sender, EventArgs e) { callCount_++; } private void Clicked2(object sender, EventArgs e) { callCount_++; } } -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kamil Dworakowski Sent: Saturday, November 29, 2008 1:16 PM To: Discussion of IronPython Subject: Re: [IronPython] Event unhooking and IPy2 On Fri, Nov 28, 2008 at 11:39 AM, Michael Foord wrote: > Just as a follow up to this - the reason for the hack below is that > subscribing to events from IronPython is still causing our UI objects (and > their whole object graphs) to not be garbage collected. To be fair, we have no reason to belive it is IronPython's fault. The bug that event handlers would prevent garbage collection was fixed, and we were able to remove *some* of the event nuking. _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ======= Notice: This e-mail message, together with any attachments, contains information of Symyx Technologies, Inc. or any of its affiliates or subsidiaries that may be confidential, proprietary, copyrighted, privileged and/or protected work product, and is meant solely for the intended recipient. If you are not the intended recipient, and have received this message in error, please contact the sender immediately, permanently delete the original and any copies of this email and any attachments thereto. From fuzzyman at voidspace.org.uk Tue Dec 2 20:48:52 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 02 Dec 2008 19:48:52 +0000 Subject: [IronPython] Event unhooking and IPy2 In-Reply-To: <515335F32AA04440B3DE6FEA1993E9AD03269FB3@srv-be-101.Symyx-IC.symyx.com> References: <2679f6510811280336t2aaca6b7pcdce1b206aa8f4a9@mail.gmail.com><492FD877.2040108@voidspace.org.uk> <93fc29d60811291315r17da962avc82789baabc75029@mail.gmail.com> <515335F32AA04440B3DE6FEA1993E9AD03269FB3@srv-be-101.Symyx-IC.symyx.com> Message-ID: <49359124.90808@voidspace.org.uk> Marty Nelson wrote: > We've had probably with memory leaks on Windows Form subscribed menu > item clicks, just with plain vanilla C#. > > Ok - it may well not be the fault of IronPython. (Certainly some event handlers don't cause us problems whilst others do). On the other hand, as IronPython *is* keeping track of all the handlers we add, an easy interface to unhook them all would be extremely useful. Michael Foord > Check out this link http://www.bobpowell.net/eventsubscribers.htm (There > are some additional steps for System.Windows.Forms.Component), and > here's some sample code I wrote in C# that you could leverage: > > [TestClass] > public class UnhookEventsTests > { > private class Item > { > public event EventHandler Clicked; > > public void FireEvent() > { > if(Clicked != null) > { > Clicked(this, EventArgs.Empty); > } > } > } > > [TestMethod] > public void UnhookEvents() > { > Item item = new Item(); > item.Clicked += Clicked; > item.Clicked += Clicked2; > > item.FireEvent(); > > Assert.AreEqual(2, callCount_); > > FieldInfo field = typeof (Item).GetField("Clicked", > BindingFlags.NonPublic | BindingFlags.Instance); > Delegate del = (Delegate) field.GetValue(item); > Delegate[] list = del.GetInvocationList(); > > Assert.AreEqual(2, list.Length); > > //This works: > //foreach (Delegate d in list) > //{ > // item.Clicked -= (EventHandler) d; > //} > > //This is more generic and avoids the cast to the specific > handler type > EventInfo eventInfo = typeof (Item).GetEvent("Clicked"); > foreach (Delegate d in list) > { > eventInfo.RemoveEventHandler(item, d); > } > > item.FireEvent(); > > Assert.AreEqual(2, callCount_); > } > private int callCount_; > private void Clicked(object sender, EventArgs e) > { > callCount_++; > } > > private void Clicked2(object sender, EventArgs e) > { > callCount_++; > } > } > > -----Original Message----- > From: users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kamil > Dworakowski > Sent: Saturday, November 29, 2008 1:16 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Event unhooking and IPy2 > > On Fri, Nov 28, 2008 at 11:39 AM, Michael Foord > wrote: > >> Just as a follow up to this - the reason for the hack below is that >> subscribing to events from IronPython is still causing our UI objects >> > (and > >> their whole object graphs) to not be garbage collected. >> > > To be fair, we have no reason to belive it is IronPython's fault. The > bug that event handlers would prevent garbage collection was fixed, > and we were able to remove *some* of the event nuking. > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > ======= > Notice: This e-mail message, together with any attachments, contains > information of Symyx Technologies, Inc. or any of its affiliates or > subsidiaries that may be confidential, proprietary, copyrighted, > privileged and/or protected work product, and is meant solely for > the intended recipient. If you are not the intended recipient, and > have received this message in error, please contact the sender > immediately, permanently delete the original and any copies of this > email and any attachments thereto. > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From dinov at microsoft.com Tue Dec 2 21:01:29 2008 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 2 Dec 2008 12:01:29 -0800 Subject: [IronPython] Event unhooking and IPy2 In-Reply-To: <49359124.90808@voidspace.org.uk> References: <2679f6510811280336t2aaca6b7pcdce1b206aa8f4a9@mail.gmail.com><492FD877.2040108@voidspace.org.uk> <93fc29d60811291315r17da962avc82789baabc75029@mail.gmail.com> <515335F32AA04440B3DE6FEA1993E9AD03269FB3@srv-be-101.Symyx-IC.symyx.com> <49359124.90808@voidspace.org.uk> Message-ID: <350E7D38B6D819428718949920EC2355564A70A140@NA-EXMSG-C102.redmond.corp.microsoft.com> We don't always remember what we've wired up though. If you give us a delegate which matches the type exactly we'll just go ahead and hook it up (to avoid adding an extra level of indirection). Only if you give us some random callable object will we remember it. It'd be easy enough for us to remember but I wonder if this is really a good idea. What if someone else has subscribed to the event? If you have the ability to clear the events then you could cause someone elses subscription to go away. Maybe you "know" that no one else will have subscribed but it does seem like this breaks the encapsulation of events. I do think we have the event leaks fixed (we hold no strong references at all now). To trackl down leaks here I'd suggest using windbg & SOS to track down the remaining references. You can !DumpHeap to list the entire heap, find the object type you think is keeping everything alive, and then do !GCRoot on its address and see who's keeping it alive. Alternately you could use the weak event pattern. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Tuesday, December 02, 2008 11:49 AM > To: Discussion of IronPython > Subject: Re: [IronPython] Event unhooking and IPy2 > > Marty Nelson wrote: > > We've had probably with memory leaks on Windows Form subscribed menu > > item clicks, just with plain vanilla C#. > > > > > Ok - it may well not be the fault of IronPython. (Certainly some event > handlers don't cause us problems whilst others do). On the other hand, > as IronPython *is* keeping track of all the handlers we add, an easy > interface to unhook them all would be extremely useful. > > Michael Foord > > > Check out this link http://www.bobpowell.net/eventsubscribers.htm > (There > > are some additional steps for System.Windows.Forms.Component), and > > here's some sample code I wrote in C# that you could leverage: > > > > [TestClass] > > public class UnhookEventsTests > > { > > private class Item > > { > > public event EventHandler Clicked; > > > > public void FireEvent() > > { > > if(Clicked != null) > > { > > Clicked(this, EventArgs.Empty); > > } > > } > > } > > > > [TestMethod] > > public void UnhookEvents() > > { > > Item item = new Item(); > > item.Clicked += Clicked; > > item.Clicked += Clicked2; > > > > item.FireEvent(); > > > > Assert.AreEqual(2, callCount_); > > > > FieldInfo field = typeof (Item).GetField("Clicked", > > BindingFlags.NonPublic | BindingFlags.Instance); > > Delegate del = (Delegate) field.GetValue(item); > > Delegate[] list = del.GetInvocationList(); > > > > Assert.AreEqual(2, list.Length); > > > > //This works: > > //foreach (Delegate d in list) > > //{ > > // item.Clicked -= (EventHandler) d; > > //} > > > > //This is more generic and avoids the cast to the > specific > > handler type > > EventInfo eventInfo = typeof (Item).GetEvent("Clicked"); > > foreach (Delegate d in list) > > { > > eventInfo.RemoveEventHandler(item, d); > > } > > > > item.FireEvent(); > > > > Assert.AreEqual(2, callCount_); > > } > > private int callCount_; > > private void Clicked(object sender, EventArgs e) > > { > > callCount_++; > > } > > > > private void Clicked2(object sender, EventArgs e) > > { > > callCount_++; > > } > > } > > > > -----Original Message----- > > From: users-bounces at lists.ironpython.com > > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kamil > > Dworakowski > > Sent: Saturday, November 29, 2008 1:16 PM > > To: Discussion of IronPython > > Subject: Re: [IronPython] Event unhooking and IPy2 > > > > On Fri, Nov 28, 2008 at 11:39 AM, Michael Foord > > wrote: > > > >> Just as a follow up to this - the reason for the hack below is that > >> subscribing to events from IronPython is still causing our UI > objects > >> > > (and > > > >> their whole object graphs) to not be garbage collected. > >> > > > > To be fair, we have no reason to belive it is IronPython's fault. The > > bug that event handlers would prevent garbage collection was fixed, > > and we were able to remove *some* of the event nuking. > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > ======= > > Notice: This e-mail message, together with any attachments, contains > > information of Symyx Technologies, Inc. or any of its affiliates or > > subsidiaries that may be confidential, proprietary, copyrighted, > > privileged and/or protected work product, and is meant solely for > > the intended recipient. If you are not the intended recipient, and > > have received this message in error, please contact the sender > > immediately, permanently delete the original and any copies of this > > email and any attachments thereto. > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Tue Dec 2 21:14:29 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 02 Dec 2008 20:14:29 +0000 Subject: [IronPython] Event unhooking and IPy2 In-Reply-To: <350E7D38B6D819428718949920EC2355564A70A140@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <2679f6510811280336t2aaca6b7pcdce1b206aa8f4a9@mail.gmail.com><492FD877.2040108@voidspace.org.uk> <93fc29d60811291315r17da962avc82789baabc75029@mail.gmail.com> <515335F32AA04440B3DE6FEA1993E9AD03269FB3@srv-be-101.Symyx-IC.symyx.com> <49359124.90808@voidspace.org.uk> <350E7D38B6D819428718949920EC2355564A70A140@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <49359725.40605@voidspace.org.uk> Dino Viehland wrote: > We don't always remember what we've wired up though. If you give us a delegate which matches the type exactly we'll just go ahead and hook it up (to avoid adding an extra level of indirection). Only if you give us some random callable object will we remember it. It'd be easy enough for us to remember but I wonder if this is really a good idea. > > That sounds fair enough. > What if someone else has subscribed to the event? If you have the ability to clear the events then you could cause someone elses subscription to go away. Maybe you "know" that no one else will have subscribed but it does seem like this breaks the encapsulation of events. > > Well, in our case it is when we want to dispose of UI elements - so anything listening *must* unsubscribe. > I do think we have the event leaks fixed (we hold no strong references at all now). To trackl down leaks here I'd suggest using windbg & SOS to track down the remaining references. You can !DumpHeap to list the entire heap, find the object type you think is keeping everything alive, and then do !GCRoot on its address and see who's keeping it alive. > > This is what we do - and great fun it is too. :-) Michael > Alternately you could use the weak event pattern. > > >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users- >> bounces at lists.ironpython.com] On Behalf Of Michael Foord >> Sent: Tuesday, December 02, 2008 11:49 AM >> To: Discussion of IronPython >> Subject: Re: [IronPython] Event unhooking and IPy2 >> >> Marty Nelson wrote: >> >>> We've had probably with memory leaks on Windows Form subscribed menu >>> item clicks, just with plain vanilla C#. >>> >>> >>> >> Ok - it may well not be the fault of IronPython. (Certainly some event >> handlers don't cause us problems whilst others do). On the other hand, >> as IronPython *is* keeping track of all the handlers we add, an easy >> interface to unhook them all would be extremely useful. >> >> Michael Foord >> >> >>> Check out this link http://www.bobpowell.net/eventsubscribers.htm >>> >> (There >> >>> are some additional steps for System.Windows.Forms.Component), and >>> here's some sample code I wrote in C# that you could leverage: >>> >>> [TestClass] >>> public class UnhookEventsTests >>> { >>> private class Item >>> { >>> public event EventHandler Clicked; >>> >>> public void FireEvent() >>> { >>> if(Clicked != null) >>> { >>> Clicked(this, EventArgs.Empty); >>> } >>> } >>> } >>> >>> [TestMethod] >>> public void UnhookEvents() >>> { >>> Item item = new Item(); >>> item.Clicked += Clicked; >>> item.Clicked += Clicked2; >>> >>> item.FireEvent(); >>> >>> Assert.AreEqual(2, callCount_); >>> >>> FieldInfo field = typeof (Item).GetField("Clicked", >>> BindingFlags.NonPublic | BindingFlags.Instance); >>> Delegate del = (Delegate) field.GetValue(item); >>> Delegate[] list = del.GetInvocationList(); >>> >>> Assert.AreEqual(2, list.Length); >>> >>> //This works: >>> //foreach (Delegate d in list) >>> //{ >>> // item.Clicked -= (EventHandler) d; >>> //} >>> >>> //This is more generic and avoids the cast to the >>> >> specific >> >>> handler type >>> EventInfo eventInfo = typeof (Item).GetEvent("Clicked"); >>> foreach (Delegate d in list) >>> { >>> eventInfo.RemoveEventHandler(item, d); >>> } >>> >>> item.FireEvent(); >>> >>> Assert.AreEqual(2, callCount_); >>> } >>> private int callCount_; >>> private void Clicked(object sender, EventArgs e) >>> { >>> callCount_++; >>> } >>> >>> private void Clicked2(object sender, EventArgs e) >>> { >>> callCount_++; >>> } >>> } >>> >>> -----Original Message----- >>> From: users-bounces at lists.ironpython.com >>> [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kamil >>> Dworakowski >>> Sent: Saturday, November 29, 2008 1:16 PM >>> To: Discussion of IronPython >>> Subject: Re: [IronPython] Event unhooking and IPy2 >>> >>> On Fri, Nov 28, 2008 at 11:39 AM, Michael Foord >>> wrote: >>> >>> >>>> Just as a follow up to this - the reason for the hack below is that >>>> subscribing to events from IronPython is still causing our UI >>>> >> objects >> >>> (and >>> >>> >>>> their whole object graphs) to not be garbage collected. >>>> >>>> >>> To be fair, we have no reason to belive it is IronPython's fault. The >>> bug that event handlers would prevent garbage collection was fixed, >>> and we were able to remove *some* of the event nuking. >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> ======= >>> Notice: This e-mail message, together with any attachments, contains >>> information of Symyx Technologies, Inc. or any of its affiliates or >>> subsidiaries that may be confidential, proprietary, copyrighted, >>> privileged and/or protected work product, and is meant solely for >>> the intended recipient. If you are not the intended recipient, and >>> have received this message in error, please contact the sender >>> immediately, permanently delete the original and any copies of this >>> email and any attachments thereto. >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >> -- >> http://www.ironpythoninaction.com/ >> http://www.voidspace.org.uk/blog >> >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From dan.eloff at gmail.com Wed Dec 3 00:09:48 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Tue, 2 Dec 2008 18:09:48 -0500 Subject: [IronPython] Does IronPython 2.0 not recognize packages? In-Reply-To: <4f428e7b0812020526i57123d5ct2e00ef41ccda1974@mail.gmail.com> References: <4f428e7b0812020034o40dbb4a4g8cc39f0f764b976c@mail.gmail.com> <4f428e7b0812020526i57123d5ct2e00ef41ccda1974@mail.gmail.com> Message-ID: <4817b6fc0812021509g181c6177o81678ee1fc79c71e@mail.gmail.com> On Tue, Dec 2, 2008 at 8:26 AM, Yash Ganthe wrote: > I still get the error: >> Traceback (most recent call last): >> File "Program.py", line 22, in Program.py >> File "mscorlib", line unknown, in get_Item >> File "mscorlib", line unknown, in ThrowKeyNotFoundException >> KeyError: The given key was not present in the dictionary. > That's not an ImportError. What's happening on line 22 of Program.py ? -Dan From dan.eloff at gmail.com Wed Dec 3 02:35:00 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Tue, 2 Dec 2008 20:35:00 -0500 Subject: [IronPython] Data Binding with DLR Languages Message-ID: <4817b6fc0812021735r18f57a0as3b516fe0ec7d8b69@mail.gmail.com> I'm posting this here, for lack of a better place, but anyone using dynamic languages on silverlight, really feels the lack of support for ICustomTypeDescriptor in data binding (i.e. there isn't any) Just trying to raise awareness of this *cough* Jimmy *cough* -Dan P.S. Harry Pierson wrote a great blog entry on data binding with IronPython here: http://devhawk.net/2008/11/18/IronPython+And+WPF+Part+3+Data+Binding.aspx From deepali_abhyankar at persistent.co.in Wed Dec 3 05:12:48 2008 From: deepali_abhyankar at persistent.co.in (Deepali Abhyankar) Date: Wed, 3 Dec 2008 09:42:48 +0530 Subject: [IronPython] Logging module error In-Reply-To: <5b0248170812020457n42ef8564kc6c00f02aa0b3137@mail.gmail.com> References: <002c01c9546e$f1d6c610$d5845230$@co.in> <5b0248170812020457n42ef8564kc6c00f02aa0b3137@mail.gmail.com> Message-ID: <002c01c954fd$6718d6f0$354a84d0$@co.in> Thanks Seo For Logging Module to work, I added the code in '__Init__.py', suggested at URL, given by you Code added in __Init__.py file of Logging module if not hasattr(sys, "_getframe"): _srcfile = None if sys.platform == 'cli': _srcfile = None Thanks and Regards Deepali -----Original Message----- From: Seo Sanghyeon [mailto:sanxiyn at gmail.com] Sent: Tuesday, December 02, 2008 6:27 PM To: deepali_abhyankar at persistent.co.in; Discussion of IronPython Subject: Re: [IronPython] Logging module error 2008/12/2 Deepali Abhyankar : > (logging and _getframe) > Please suggest solution to resolve this https://fepy.svn.sourceforge.net/svnroot/fepy/trunk/patches/stdlib/2.4.4/patch-stdlib-logging-getframe -- Seo Sanghyeon DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. From Jimmy.Schementi at microsoft.com Wed Dec 3 20:27:40 2008 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Wed, 3 Dec 2008 11:27:40 -0800 Subject: [IronPython] Data Binding with DLR Languages In-Reply-To: <4817b6fc0812021735r18f57a0as3b516fe0ec7d8b69@mail.gmail.com> References: <4817b6fc0812021735r18f57a0as3b516fe0ec7d8b69@mail.gmail.com> Message-ID: <5283CA0A4168DF4FBBD71AE9ECA5A3284BDAE88C2E@NA-EXMSG-C116.redmond.corp.microsoft.com> http://www.codeplex.com/sdlsdk/WorkItem/View.aspx?WorkItemId=11844 Agreed that it needs to be done. Feel free to make the first couple stabs at it, but it is a hard problem, so not sure if you have time for it. I'm organizing the project a bit more to have a set of tangible projects people can start working on, and I'll make sure that data binding is on that list, and make sure someone is tackling it. ~js > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Dan Eloff > Sent: Tuesday, December 02, 2008 5:35 PM > To: Discussion of IronPython > Subject: [IronPython] Data Binding with DLR Languages > > I'm posting this here, for lack of a better place, but anyone using > dynamic languages on silverlight, really feels the lack of support for > ICustomTypeDescriptor in data binding (i.e. there isn't any) Just > trying to raise awareness of this *cough* Jimmy *cough* > > -Dan > > P.S. Harry Pierson wrote a great blog entry on data binding with > IronPython here: > http://devhawk.net/2008/11/18/IronPython+And+WPF+Part+3+Data+Binding.as > px > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dan.eloff at gmail.com Wed Dec 3 21:24:41 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Wed, 3 Dec 2008 15:24:41 -0500 Subject: [IronPython] Data Binding with DLR Languages In-Reply-To: <5283CA0A4168DF4FBBD71AE9ECA5A3284BDAE88C2E@NA-EXMSG-C116.redmond.corp.microsoft.com> References: <4817b6fc0812021735r18f57a0as3b516fe0ec7d8b69@mail.gmail.com> <5283CA0A4168DF4FBBD71AE9ECA5A3284BDAE88C2E@NA-EXMSG-C116.redmond.corp.microsoft.com> Message-ID: <4817b6fc0812031224y12326d39nd9c70fe271b11c47@mail.gmail.com> On Wed, Dec 3, 2008 at 2:27 PM, Jimmy Schementi wrote: > http://www.codeplex.com/sdlsdk/WorkItem/View.aspx?WorkItemId=11844 > > Agreed that it needs to be done. Feel free to make the first couple stabs at it, but it is a hard problem, so not sure if you have time for it. I'm organizing the project a bit more to have a set of tangible projects people can start working on, and I'll make sure that data binding is on that list, and make sure someone is tackling it. > I wish I did, but I'm unable to keep up with my current commitments. By the time that changes, this will hopefully no longer be an issue. But I'm sure there will be plenty of other things in dynamic silverlight for me to contribute to. I am encouraged by your response, thank you for taking this issue seriously. -Dan From steve at mcneel.com Thu Dec 4 01:46:07 2008 From: steve at mcneel.com (Steve Baer) Date: Wed, 3 Dec 2008 16:46:07 -0800 Subject: [IronPython] Parsing scripts Message-ID: <1ACE609827CC4A139000F3923F9846F2@mcneel.com> I would like to be able to add some sort of "intellisense" to a text editor for IronPython scripts. Something along the lines of reporting the available functions in a module after hitting a period. import clr clr. <- (show something here) Are there utilities available in IronPython for analyzing a partial script to figure this out and if so could you point me in the right direction? Thanks, -Steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Thu Dec 4 01:49:55 2008 From: dinov at microsoft.com (Dino Viehland) Date: Wed, 3 Dec 2008 16:49:55 -0800 Subject: [IronPython] Parsing scripts In-Reply-To: <1ACE609827CC4A139000F3923F9846F2@mcneel.com> References: <1ACE609827CC4A139000F3923F9846F2@mcneel.com> Message-ID: <350E7D38B6D819428718949920EC2355564A70AA07@NA-EXMSG-C102.redmond.corp.microsoft.com> The closest we have to this currently is what the console does w/ live objects. I think you could also find some examples of this in IronPython Studio (http://www.codeplex.com/IronPythonStudio) but there's nothing that's too sophisticated right now. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Steve Baer Sent: Wednesday, December 03, 2008 4:46 PM To: Discussion of IronPython Subject: [IronPython] Parsing scripts I would like to be able to add some sort of "intellisense" to a text editor for IronPython scripts. Something along the lines of reporting the available functions in a module after hitting a period. import clr clr. <- (show something here) Are there utilities available in IronPython for analyzing a partial script to figure this out and if so could you point me in the right direction? Thanks, -Steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From dfugate at microsoft.com Thu Dec 4 02:12:13 2008 From: dfugate at microsoft.com (Dave Fugate) Date: Wed, 3 Dec 2008 17:12:13 -0800 Subject: [IronPython] Blocker: ProcessDialogKey on TextBox subclass In-Reply-To: <2679f6510811280500s55133e6fv7156b5f04aaac8af@mail.gmail.com> References: <2679f6510811280500s55133e6fv7156b5f04aaac8af@mail.gmail.com> Message-ID: I think the following might be a workaround for this: import clr clr.AddReference('System.Windows.Forms') clr.AddReference('IronPython') from System.Windows.Forms import Form, Application, TextBox class MyTextBox(TextBox): ProcessDialogKeyCopy = TextBox.ProcessDialogKey def ProcessDialogKey(s, key): print key return MyTextBox.ProcessDialogKeyCopy(s, key) MyTextBox.ProcessDialogKey = ProcessDialogKey class ThisApp(Form): def __init__(self): Form.__init__(self) tb = MyTextBox() self.Controls.Add(tb) Application.Run(self) def main(): f = ThisApp() if __name__ == '__main__': main() From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Glenn Jones Sent: Friday, November 28, 2008 5:01 AM To: Discussion of IronPython Subject: [IronPython] Blocker: ProcessDialogKey on TextBox subclass Hi All, Here is a little app that illustrates an issue that we've just discovered: --------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------- import clr clr.AddReference('System.Windows.Forms') clr.AddReference('IronPython') from System.Windows.Forms import Form, Application, TextBox class MyTextBox(TextBox): def ProcessDialogKey(self, key): print key #super(MyTextBox, self).ProcessDialogKey(key) # Fails with a stack overflow #TextBox.ProcessDialogKey(self, key) # Fails with: Microsoft.Scripting.ArgumentTypeException: cannot access protected member ProcessDialogKey without a python subclass of TextBoxBase class ThisApp(Form): def __init__(self): Form.__init__(self) tb = MyTextBox() self.Controls.Add(tb) Application.Run(self) def main(): f = ThisApp() if __name__ == '__main__': main() --------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------- Uncommenting either of the two commented lines produces the results on that line when a key is pressed in the text box. The second method of calling ProcessDialogKey worked in IPy 1. This is likely to block our progress on porting Resolver One to IPy2 unless there is a different way of accomplishing the same thing. Thanks Glenn & Will -------------- next part -------------- An HTML attachment was scrubbed... URL: From mtraudt at alum.mit.edu Thu Dec 4 02:48:50 2008 From: mtraudt at alum.mit.edu (Mark Traudt) Date: Wed, 3 Dec 2008 17:48:50 -0800 (PST) Subject: [IronPython] Problem inheriting from C# abstract base class with overloaded constructors Message-ID: <20804327.post@talk.nabble.com> If I create an abstract base class in C# that has overloaded constructors, and then subclass from this in IronPython, then I am unable to call the non-default base class constructor from the __new__ method in the subclass. If I try, I get the result shown after the code sample. Interestingly, if I change the base class to not be abstract and to have public constructors (both changes are required) then my IronPython script works fine. Is this a bug? If not, then am I doing something wrong, or is this not supported for some reason? I reproduced this with IronPython-1.1.2 and IronPython-2.0B5. *** OneOff.cs *** namespace Test { public abstract class Foo { protected Foo() {} protected Foo(int a) { a_ = a; } public override string ToString() { return "Foo: " + a_; } private int a_; } } *** OneOff.py *** import clr clr.AddReferenceToFile("OneOff.dll") from Test import * class Bar(Foo): def __new__ (cls, a=0): return Foo.__new__(cls, a) print Bar() print Bar(42) *** Results *** Traceback (most recent call last): File C:\dev\OneOff\IronPython\OneOff.py, line 10, in File C:\dev\OneOff\IronPython\OneOff.py, line 8, in File , line 0, in DefaultNew##15 TypeError: default __new__ does not take parameters -- View this message in context: http://www.nabble.com/Problem-inheriting-from-C--abstract-base-class-with-overloaded-constructors-tp20804327p20804327.html Sent from the IronPython mailing list archive at Nabble.com. From dan.eloff at gmail.com Thu Dec 4 03:07:36 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Wed, 3 Dec 2008 21:07:36 -0500 Subject: [IronPython] SilverShell 0.6 Released Message-ID: <4817b6fc0812031807k2e75ba82i3fcec27dc7231137@mail.gmail.com> A blatant plug for my own software here, but I just uploaded SilverShell 0.6.0: http://code.google.com/p/silvershell/ New in this release is the ability to run on the desktop with WPF, execution of code in background threads, and a scratchpad canvas for playing with UI controls. There are still some bugs lurking in the intellisense code, and I'll be following soon with a bugfix release. But it works, and you can try it out. I find it more user friendly than the command prompt. -Dan From dinov at microsoft.com Thu Dec 4 03:19:38 2008 From: dinov at microsoft.com (Dino Viehland) Date: Wed, 3 Dec 2008 18:19:38 -0800 Subject: [IronPython] Problem inheriting from C# abstract base class with overloaded constructors In-Reply-To: <20804327.post@talk.nabble.com> References: <20804327.post@talk.nabble.com> Message-ID: <350E7D38B6D819428718949920EC2355564A70AA3E@NA-EXMSG-C102.redmond.corp.microsoft.com> This is bug #20021 - http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20021 You should be able to declare the ctor public. It shouldn't be an error to do that but you'll get an FxCop warning if you run FxCop. I checked a fix for this in today into the Main branch (which is 2.1). I think that should show up on CodePlex tonight or tomorrow if you're willing to build IronPython from source. If not we'll definitely fix this in 2.0.1 if we don't spin a new build for 2.0 which would also likely include the fix. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Mark Traudt > Sent: Wednesday, December 03, 2008 5:49 PM > To: users at lists.ironpython.com > Subject: [IronPython] Problem inheriting from C# abstract base class > with overloaded constructors > > > If I create an abstract base class in C# that has overloaded > constructors, > and then subclass from this in IronPython, then I am unable to call the > non-default base class constructor from the __new__ method in the > subclass. > If I try, I get the result shown after the code sample. > > Interestingly, if I change the base class to not be abstract and to > have > public constructors (both changes are required) then my IronPython > script > works fine. > > Is this a bug? If not, then am I doing something wrong, or is this not > supported for some reason? > > I reproduced this with IronPython-1.1.2 and IronPython-2.0B5. > > > *** OneOff.cs *** > > namespace Test > { > public abstract class Foo > { > protected Foo() > {} > > protected Foo(int a) > { > a_ = a; > } > > public override string ToString() > { > return "Foo: " + a_; > } > > private int a_; > } > } > > > *** OneOff.py *** > > import clr > clr.AddReferenceToFile("OneOff.dll") > from Test import * > > class Bar(Foo): > def __new__ (cls, a=0): > return Foo.__new__(cls, a) > > print Bar() > print Bar(42) > > > *** Results *** > > Traceback (most recent call last): > File C:\dev\OneOff\IronPython\OneOff.py, line 10, in > File C:\dev\OneOff\IronPython\OneOff.py, line 8, in > File , line 0, in DefaultNew##15 > TypeError: default __new__ does not take parameters > > > -- > View this message in context: http://www.nabble.com/Problem-inheriting- > from-C--abstract-base-class-with-overloaded-constructors- > tp20804327p20804327.html > Sent from the IronPython mailing list archive at Nabble.com. > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dan.eloff at gmail.com Thu Dec 4 04:00:01 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Wed, 3 Dec 2008 22:00:01 -0500 Subject: [IronPython] Problem inheriting from C# abstract base class with overloaded constructors In-Reply-To: <350E7D38B6D819428718949920EC2355564A70AA3E@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <20804327.post@talk.nabble.com> <350E7D38B6D819428718949920EC2355564A70AA3E@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <4817b6fc0812031900o41935f9akb34a2d52752e4417@mail.gmail.com> On Wed, Dec 3, 2008 at 9:19 PM, Dino Viehland wrote: > This is bug #20021 - http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20021 > > I checked a fix for this in today into the Main branch (which is 2.1). I think that should show up on CodePlex tonight or tomorrow if you're willing to build IronPython from source. Sweet. Will definitely grab those bits. Thanks for fixing it. -Dan From kfarmer at thuban.org Thu Dec 4 05:17:43 2008 From: kfarmer at thuban.org (Keith J. Farmer) Date: Wed, 3 Dec 2008 20:17:43 -0800 Subject: [IronPython] SilverShell 0.6 Released In-Reply-To: <4817b6fc0812031807k2e75ba82i3fcec27dc7231137@mail.gmail.com> References: <4817b6fc0812031807k2e75ba82i3fcec27dc7231137@mail.gmail.com> Message-ID: Neat.. I wonder how difficult it would be to be able to host IP, PS, etc, much like the Silverlight/DLR demo from last year. I imagine for DLR languages that's probably not terribly difficult, but I don't know how hard it would be to wrap a wrapper around the Powershell interpreter to make it behave similarly. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dan Eloff Sent: Wednesday, December 03, 2008 6:08 PM To: Discussion of IronPython Subject: [IronPython] SilverShell 0.6 Released A blatant plug for my own software here, but I just uploaded SilverShell 0.6.0: http://code.google.com/p/silvershell/ New in this release is the ability to run on the desktop with WPF, execution of code in background threads, and a scratchpad canvas for playing with UI controls. There are still some bugs lurking in the intellisense code, and I'll be following soon with a bugfix release. But it works, and you can try it out. I find it more user friendly than the command prompt. -Dan _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From oripel at gmail.com Thu Dec 4 07:57:18 2008 From: oripel at gmail.com (orip) Date: Wed, 3 Dec 2008 22:57:18 -0800 (PST) Subject: [IronPython] Parsing scripts In-Reply-To: <350E7D38B6D819428718949920EC2355564A70AA07@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <1ACE609827CC4A139000F3923F9846F2@mcneel.com> <350E7D38B6D819428718949920EC2355564A70AA07@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <94036fb2-94ca-4256-bf93-7531fbfdcaeb@3g2000yqs.googlegroups.com> PySmell by Orestis Markou does completion through static analysis of Python code. I haven't tried it with IronPython but it could work, and from what I gather Orestis is happy to help. http://code.google.com/p/pysmell/ On Dec 4, 2:49?am, Dino Viehland wrote: > The closest we have to this currently is what the console does w/ live objects. ?I think you could also find some examples of this in IronPython Studio (http://www.codeplex.com/IronPythonStudio) but there's nothing that's too sophisticated right now. > > From: users-boun... at lists.ironpython.com [mailto:users-boun... at lists.ironpython.com] On Behalf Of Steve Baer > Sent: Wednesday, December 03, 2008 4:46 PM > To: Discussion of IronPython > Subject: [IronPython] Parsing scripts > > I would like to be able to add some sort of "intellisense" to a text editor for IronPython scripts. Something along the lines of reporting the available functions in a module after hitting a period. > > import clr > clr. <- (show something here) > > Are there utilities available in IronPython for analyzing a partial script to figure this out and if so could you point me in the right direction? > > Thanks, > -Steve > > _______________________________________________ > Users mailing list > Us... at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com From orestis at resolversystems.com Thu Dec 4 11:45:17 2008 From: orestis at resolversystems.com (Orestis Markou) Date: Thu, 04 Dec 2008 10:45:17 +0000 Subject: [IronPython] Parsing scripts In-Reply-To: <350E7D38B6D819428718949920EC2355564A70AA07@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <1ACE609827CC4A139000F3923F9846F2@mcneel.com> <350E7D38B6D819428718949920EC2355564A70AA07@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <4937B4BD.9080301@resolversystems.com> I've written PySmell, but it does static analysis rather than dynamic. That means that it won't handle code that lives in dlls, but it will handle any scripts of your own. I'll add support for dynamic analysis soon, though - it's easy to do. Have a look at http://pypi.python.org/pypi/pysmell Dino Viehland wrote: > The closest we have to this currently is what the console does w/ live > objects. I think you could also find some examples of this in > IronPython Studio (http://www.codeplex.com/IronPythonStudio) but there?s > nothing that?s too sophisticated right now. > > > > *From:* users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Steve Baer > *Sent:* Wednesday, December 03, 2008 4:46 PM > *To:* Discussion of IronPython > *Subject:* [IronPython] Parsing scripts > > > > I would like to be able to add some sort of "intellisense" to a text > editor for IronPython scripts. Something along the lines of reporting > the available functions in a module after hitting a period. > > > > import clr > > clr. <- (show something here) > > > > Are there utilities available in IronPython for analyzing a partial > script to figure this out and if so could you point me in the right > direction? > > > > Thanks, > > -Steve > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- Orestis Markou Software Engineer, Resolver Systems Ltd. orestis at resolversystems.com +44 (0) 20 7253 6372 From fuzzyman at voidspace.org.uk Thu Dec 4 12:36:37 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 04 Dec 2008 11:36:37 +0000 Subject: [IronPython] SilverShell 0.6 Released In-Reply-To: <4817b6fc0812031807k2e75ba82i3fcec27dc7231137@mail.gmail.com> References: <4817b6fc0812031807k2e75ba82i3fcec27dc7231137@mail.gmail.com> Message-ID: <4937C0C5.50801@voidspace.org.uk> Dan Eloff wrote: > A blatant plug for my own software here, but I just uploaded > SilverShell 0.6.0: http://code.google.com/p/silvershell/ > > New in this release is the ability to run on the desktop with WPF, > execution of code in background threads, and a scratchpad canvas for > playing with UI controls. > > There are still some bugs lurking in the intellisense code, and I'll > be following soon with a bugfix release. But it works, and you can try > it out. I find it more user friendly than the command prompt. > Very nice - congratulations. Michael > -Dan > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ From sh at defuze.org Thu Dec 4 20:17:53 2008 From: sh at defuze.org (Sylvain Hellegouarch) Date: Thu, 04 Dec 2008 20:17:53 +0100 Subject: [IronPython] Don't let the IronPython IRC channel die Message-ID: <49382CE1.4080208@defuze.org> Hi folks, There's been a IRC channel about IronPython for some time now but it's usually really quiet. I've seen friendly people and interesting discussions but too sparse to make them a lively channel. Maybe you're not aware of that channel but everyone is welcome. I think it'd be quite important if IronPython developers could popup sometimes too. IRC channels can be a great way to build a community as well as a good resource for casual developers. So please come and say hi at: Network: freenode Channel: #ironpython Thanks, - Sylvain More information on IRC if you need: http://en.wikipedia.org/wiki/IRC From jslutter at reactorzero.com Thu Dec 4 22:13:45 2008 From: jslutter at reactorzero.com (Jeff Slutter) Date: Thu, 04 Dec 2008 16:13:45 -0500 Subject: [IronPython] Calling functions in IronPython that don't really exist Message-ID: <49384809.6030709@reactorzero.com> I'm writing an application that I want to provide runtime scripting via IronPython for. This application loads "plug-ins" from assemblies to add functionality. Each plug-in is a class with, for the sake of simplicity, a "Do" function. What I'm trying to figure out is that if I have a class like: class AddNumbers { public string Do( params object[] args ) { ..check args.. ..add the two arguments.. ..return the result as a string.. } } That I could call it from IronPython like: AddNumbers( 3, 4 ) When that happens a new instance of the AddNumbers class is created, the arguments are then passed to the Do member function, the result is returned back to Python. This may seem like a weird way for scripting. But, doing it this way I can do some other important things, such as keeping a history of the commands. If, along with Do, the commands have Undo and Redo functions, then I can keep the instances of the commands stored and should the user need to undo their command, I can internally run the Undo function. Any ideas on how I should approach this? I don't mind having to do a good chunk of backend work so that to add new command plugins, I just have to write a class with a Do function and possibly provide some Attributes if necessary. If I have to make some concessions that is fine, but I need to stick with the concept of creating an instance of a class and executing a function to perform the operation. I assume I'm either going to have to generate some sort of thunk function (I have no idea where to start) or provide some sort of 'command runner' that really gets called. Any help or guidance is mighty appreciated, Jeff From nytrokiss at gmail.com Thu Dec 4 22:17:23 2008 From: nytrokiss at gmail.com (James Matthews) Date: Thu, 4 Dec 2008 23:17:23 +0200 Subject: [IronPython] Calling functions in IronPython that don't really exist In-Reply-To: <49384809.6030709@reactorzero.com> References: <49384809.6030709@reactorzero.com> Message-ID: <8a6b8e350812041317m59120aa6mb9de91ac27d671f7@mail.gmail.com> You can just create the function name and do nothing with it. In Cpython i would use meta classes but idk if they are in IronPython On Thu, Dec 4, 2008 at 11:13 PM, Jeff Slutter wrote: > I'm writing an application that I want to provide runtime scripting via > IronPython for. This application loads "plug-ins" from assemblies to add > functionality. > > Each plug-in is a class with, for the sake of simplicity, a "Do" function. > > What I'm trying to figure out is that if I have a class like: > > class AddNumbers > { > public string Do( params object[] args ) > { > ..check args.. > ..add the two arguments.. > ..return the result as a string.. > } > } > > > That I could call it from IronPython like: > > AddNumbers( 3, 4 ) > > When that happens a new instance of the AddNumbers class is created, the > arguments are then passed to the Do member function, the result is > returned back to Python. > > This may seem like a weird way for scripting. But, doing it this way I > can do some other important things, such as keeping a history of the > commands. If, along with Do, the commands have Undo and Redo functions, > then I can keep the instances of the commands stored and should the user > need to undo their command, I can internally run the Undo function. > > Any ideas on how I should approach this? I don't mind having to do a > good chunk of backend work so that to add new command plugins, I just > have to write a class with a Do function and possibly provide some > Attributes if necessary. If I have to make some concessions that is > fine, but I need to stick with the concept of creating an instance of a > class and executing a function to perform the operation. > > I assume I'm either going to have to generate some sort of thunk > function (I have no idea where to start) or provide some sort of > 'command runner' that really gets called. > > Any help or guidance is mighty appreciated, > Jeff > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.astorandblack.com/ http://www.thewatcherys.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Thu Dec 4 22:20:07 2008 From: dinov at microsoft.com (Dino Viehland) Date: Thu, 4 Dec 2008 13:20:07 -0800 Subject: [IronPython] Calling functions in IronPython that don't really exist In-Reply-To: <49384809.6030709@reactorzero.com> References: <49384809.6030709@reactorzero.com> Message-ID: <350E7D38B6D819428718949920EC2355564A7FAEA8@NA-EXMSG-C102.redmond.corp.microsoft.com> Do you mean you'd call it like "AddNumbers().Do(3, 4)"? This is really easy. Make AddNumbers public, then do: import clr clr.AddReference('MyAssembly') import AddNumbers AddNumbers().Do(3, 4) If you really want to do AddNumbers(3, 4) then you'd just write it as: public class AddNumbers { public AddNumbers(params object[] args) { Do(args); } public string Do( params object[] args ) { ..check args.. ..add the two arguments.. ..return the result as a string.. } } And do the same: import clr clr.AddReference('MyAssembly') import AddNumbers AddNumbers(3, 4) > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Jeff Slutter > Sent: Thursday, December 04, 2008 1:14 PM > To: Discussion of IronPython > Subject: [IronPython] Calling functions in IronPython that don't really > exist > > I'm writing an application that I want to provide runtime scripting via > IronPython for. This application loads "plug-ins" from assemblies to > add > functionality. > > Each plug-in is a class with, for the sake of simplicity, a "Do" > function. > > What I'm trying to figure out is that if I have a class like: > > class AddNumbers > { > public string Do( params object[] args ) > { > ..check args.. > ..add the two arguments.. > ..return the result as a string.. > } > } > > > That I could call it from IronPython like: > > AddNumbers( 3, 4 ) > > When that happens a new instance of the AddNumbers class is created, > the > arguments are then passed to the Do member function, the result is > returned back to Python. > > This may seem like a weird way for scripting. But, doing it this way I > can do some other important things, such as keeping a history of the > commands. If, along with Do, the commands have Undo and Redo functions, > then I can keep the instances of the commands stored and should the > user > need to undo their command, I can internally run the Undo function. > > Any ideas on how I should approach this? I don't mind having to do a > good chunk of backend work so that to add new command plugins, I just > have to write a class with a Do function and possibly provide some > Attributes if necessary. If I have to make some concessions that is > fine, but I need to stick with the concept of creating an instance of a > class and executing a function to perform the operation. > > I assume I'm either going to have to generate some sort of thunk > function (I have no idea where to start) or provide some sort of > 'command runner' that really gets called. > > Any help or guidance is mighty appreciated, > Jeff > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From jslutter at reactorzero.com Thu Dec 4 22:30:24 2008 From: jslutter at reactorzero.com (Jeff Slutter) Date: Thu, 04 Dec 2008 16:30:24 -0500 Subject: [IronPython] Calling functions in IronPython that don't really exist In-Reply-To: <350E7D38B6D819428718949920EC2355564A7FAEA8@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <49384809.6030709@reactorzero.com> <350E7D38B6D819428718949920EC2355564A7FAEA8@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <49384BF0.4080001@reactorzero.com> Ok, now I feel a little stupid. Thanks :) I think it would be wise to drop the "params object[] args" and go with just actually specifying the parameters to the constructor so I can take advantage of type checking, etc. from Python. In the constructor I'll have to save the instance of the class created to my internal History list (for the undo, redo). Thanks again! Dino Viehland wrote: > Do you mean you'd call it like "AddNumbers().Do(3, 4)"? > > This is really easy. Make AddNumbers public, then do: > > import clr > clr.AddReference('MyAssembly') > import AddNumbers > AddNumbers().Do(3, 4) > > If you really want to do AddNumbers(3, 4) then you'd just write it as: > > public class AddNumbers > { > public AddNumbers(params object[] args) { > Do(args); > } > public string Do( params object[] args ) > { > ..check args.. > ..add the two arguments.. > ..return the result as a string.. > } > } > > And do the same: > > import clr > clr.AddReference('MyAssembly') > import AddNumbers > AddNumbers(3, 4) > > > From jslutter at reactorzero.com Thu Dec 4 22:59:24 2008 From: jslutter at reactorzero.com (Jeff Slutter) Date: Thu, 04 Dec 2008 16:59:24 -0500 Subject: [IronPython] Calling functions in IronPython that don't really exist In-Reply-To: <350E7D38B6D819428718949920EC2355564A7FAEA8@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <49384809.6030709@reactorzero.com> <350E7D38B6D819428718949920EC2355564A7FAEA8@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <493852BC.5030705@reactorzero.com> Actually this doesn't exactly work. If I want the command to be able to return a value, I can't go with the constructor route: res = AddNumbers( 3, 5 ); you want res equal to "8", but really it is an instance of my AddNumbers class. I don't want the script writers to be able to save this class instance, and it would be 'ugly' if they had to call ".GetReturn()" to get the return value of the command. And I don't want the call to "Do" to be explicit. I sound really picky... Dino Viehland wrote: > Do you mean you'd call it like "AddNumbers().Do(3, 4)"? > > This is really easy. Make AddNumbers public, then do: > > import clr > clr.AddReference('MyAssembly') > import AddNumbers > AddNumbers().Do(3, 4) > > If you really want to do AddNumbers(3, 4) then you'd just write it as: > > public class AddNumbers > { > public AddNumbers(params object[] args) { > Do(args); > } > public string Do( params object[] args ) > { > ..check args.. > ..add the two arguments.. > ..return the result as a string.. > } > } > > And do the same: > > import clr > clr.AddReference('MyAssembly') > import AddNumbers > AddNumbers(3, 4) > From dinov at microsoft.com Thu Dec 4 23:12:38 2008 From: dinov at microsoft.com (Dino Viehland) Date: Thu, 4 Dec 2008 14:12:38 -0800 Subject: [IronPython] Calling functions in IronPython that don't really exist In-Reply-To: <493852BC.5030705@reactorzero.com> References: <49384809.6030709@reactorzero.com> <350E7D38B6D819428718949920EC2355564A7FAEA8@NA-EXMSG-C102.redmond.corp.microsoft.com> <493852BC.5030705@reactorzero.com> Message-ID: <350E7D38B6D819428718949920EC2355564A7FAF2C@NA-EXMSG-C102.redmond.corp.microsoft.com> You can just import static functions instead. Something like: public static class ScriptHelpers { public static object AddNumbers(params object[] args) { return 42; } } Add the reference and then: from ScriptHelpers import * If you really need to construct an instance for some reason you could do it inside of AddNumbers and do the .GetReturn there as well. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Jeff Slutter > Sent: Thursday, December 04, 2008 1:59 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Calling functions in IronPython that don't > really exist > > Actually this doesn't exactly work. If I want the command to be able to > return a value, I can't go with the constructor route: > > res = AddNumbers( 3, 5 ); > > you want res equal to "8", but really it is an instance of my > AddNumbers > class. I don't want the script writers to be able to save this class > instance, and it would be 'ugly' if they had to call ".GetReturn()" to > get the return value of the command. > > And I don't want the call to "Do" to be explicit. > > I sound really picky... > > > Dino Viehland wrote: > > Do you mean you'd call it like "AddNumbers().Do(3, 4)"? > > > > This is really easy. Make AddNumbers public, then do: > > > > import clr > > clr.AddReference('MyAssembly') > > import AddNumbers > > AddNumbers().Do(3, 4) > > > > If you really want to do AddNumbers(3, 4) then you'd just write it > as: > > > > public class AddNumbers > > { > > public AddNumbers(params object[] args) { > > Do(args); > > } > > public string Do( params object[] args ) > > { > > ..check args.. > > ..add the two arguments.. > > ..return the result as a string.. > > } > > } > > > > And do the same: > > > > import clr > > clr.AddReference('MyAssembly') > > import AddNumbers > > AddNumbers(3, 4) > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From jdhardy at gmail.com Fri Dec 5 02:57:12 2008 From: jdhardy at gmail.com (Jeff Hardy) Date: Thu, 4 Dec 2008 18:57:12 -0700 Subject: [IronPython] NWSGI 0.7 released Message-ID: NWSGI 0.7 is now available. This version adds support for ASP.NET sessions, fixes Unicode handling, and adds support for wildcard mappings. It is available at http://www.codeplex.com/NWSGI/Release/ProjectReleases.aspx?ReleaseId=20189. What is NWSGI? NWSGI is an ASP.NET HttpHandler that implements the Python WSGI spec (PEP 333 - http://www.python.org/dev/peps/pep-0333/) for interfacing web servers and web frameworks using IronPython. There are still some IronPYthon bugs that prevent everything from working, but some things do. For more details on this release, see http://jdhardy.blogspot.com/2008/12/nwsgi-07-released.html. - Jeff From dr.addn at gmail.com Fri Dec 5 04:26:36 2008 From: dr.addn at gmail.com (Ph.T) Date: Thu, 4 Dec 2008 20:26:36 -0700 Subject: [IronPython] SilverShell 0.6 Released In-Reply-To: <4817b6fc0812031807k2e75ba82i3fcec27dc7231137@mail.gmail.com> References: <4817b6fc0812031807k2e75ba82i3fcec27dc7231137@mail.gmail.com> Message-ID: <8fd4a2fe0812041926w6aa3c735g3d01a2c7c836c88c@mail.gmail.com> . I was disappointed to find on code.google something that could be holding off on submitting source code to some time in the indefinite future . gmail put this in the spam bucket . . dll's and other microsoft magic should be confined to vmware or some other virtual mach . On Wed, Dec 3, 2008 at 7:07 PM, Dan Eloff wrote: > A blatant plug for my own software here, but I just uploaded > SilverShell 0.6.0: http://code.google.com/p/silvershell/ > -- Americium Dream Documents "(real opportunity starts with real documentation) http://amerdreamdocs.tripod.com/ http://www.angelfire.com/psy/dr.addn/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From dan.eloff at gmail.com Fri Dec 5 05:37:52 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Thu, 4 Dec 2008 23:37:52 -0500 Subject: [IronPython] SilverShell 0.6 Released In-Reply-To: <8fd4a2fe0812041926w6aa3c735g3d01a2c7c836c88c@mail.gmail.com> References: <4817b6fc0812031807k2e75ba82i3fcec27dc7231137@mail.gmail.com> <8fd4a2fe0812041926w6aa3c735g3d01a2c7c836c88c@mail.gmail.com> Message-ID: <4817b6fc0812042037h137d5badmbdb4596cb6e6b565@mail.gmail.com> On Thu, Dec 4, 2008 at 10:26 PM, Ph. T wrote: > . I was disappointed to find on code.google > something that could be holding off on submitting source code > to some time in the indefinite future . gmail put this in the spam bucket . > . dll's and other microsoft magic should be confined to vmware or some other > virtual mach . > I'm sorry for that, I just wanted to get the release out there, it only occurred to me later that the .dll will restrict people from running on versions of IronPython different from the one I packaged with it. I will include the source for the _wpf.dll in the 0.6.1 bug fix release which will be available within a week. -Dan From jslutter at reactorzero.com Fri Dec 5 06:32:20 2008 From: jslutter at reactorzero.com (Jeff Slutter) Date: Fri, 05 Dec 2008 00:32:20 -0500 Subject: [IronPython] Calling functions in IronPython that don't really exist In-Reply-To: <350E7D38B6D819428718949920EC2355564A7FAF2C@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <49384809.6030709@reactorzero.com> <350E7D38B6D819428718949920EC2355564A7FAEA8@NA-EXMSG-C102.redmond.corp.microsoft.com> <493852BC.5030705@reactorzero.com> <350E7D38B6D819428718949920EC2355564A7FAF2C@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <4938BCE4.7090705@reactorzero.com> I have found another way that better suits what I'm trying to do (and control). In a nutshell, I just add the function to the builtins. Here is the code: // some member function, etc. delegate int DoDelegate(); private int DoFunc() { return 10; } //... in the IronPython initialization, after the scripting engine has been created ... ScriptScope builtins = Python.GetBuiltinModule(m_engine); builtins.SetVariable("SomeTestFunction", new DoDelegate(DoFunc)); now, in the Python scripts I can call: SomeTestFunction(); Simple problem and solution, but I just wanted a way to dynamically add new functions to Python with names that I control. From deepali_abhyankar at persistent.co.in Fri Dec 5 07:08:17 2008 From: deepali_abhyankar at persistent.co.in (Deepali Abhyankar) Date: Fri, 5 Dec 2008 11:38:17 +0530 Subject: [IronPython] About Python TextTestRunner In-Reply-To: References: Message-ID: <002201c9569f$ddff61a0$99fe24e0$@co.in> Hi I used following code to write result on different media. unittest.TextTestRunner(verbosity=2).run(suite) : Writes result to StdOutput unittest.TextTestRunner(file,verbosity=2).run(suite) : Writes result to file But what should I do to write test result on file as well as StdOutput, on single go? Is there any other method to do this? Regards Deepali -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Hardy Sent: Friday, December 05, 2008 7:27 AM To: Discussion of IronPython; web-sig at python.org Subject: [IronPython] NWSGI 0.7 released NWSGI 0.7 is now available. This version adds support for ASP.NET sessions, fixes Unicode handling, and adds support for wildcard mappings. It is available at http://www.codeplex.com/NWSGI/Release/ProjectReleases.aspx?ReleaseId=20189. What is NWSGI? NWSGI is an ASP.NET HttpHandler that implements the Python WSGI spec (PEP 333 - http://www.python.org/dev/peps/pep-0333/) for interfacing web servers and web frameworks using IronPython. There are still some IronPYthon bugs that prevent everything from working, but some things do. For more details on this release, see http://jdhardy.blogspot.com/2008/12/nwsgi-07-released.html. - Jeff _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. From miha.valencic at gmail.com Fri Dec 5 09:11:24 2008 From: miha.valencic at gmail.com (Miha Valencic) Date: Fri, 5 Dec 2008 09:11:24 +0100 Subject: [IronPython] NWSGI 0.7 released In-Reply-To: References: Message-ID: <233dfa1d0812050011v1ac776a8q72f82853f18ea353@mail.gmail.com> Jeff, do you have any info on whether Django works with this setup? Thanks, Miha. 2008/12/5 Jeff Hardy > NWSGI 0.7 is now available. This version adds support for ASP.NET > sessions, fixes Unicode handling, and adds support for wildcard > mappings. It is available at > http://www.codeplex.com/NWSGI/Release/ProjectReleases.aspx?ReleaseId=20189 > . > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From orestis at resolversystems.com Fri Dec 5 14:22:51 2008 From: orestis at resolversystems.com (Orestis Markou) Date: Fri, 05 Dec 2008 13:22:51 +0000 Subject: [IronPython] About Python TextTestRunner In-Reply-To: <002201c9569f$ddff61a0$99fe24e0$@co.in> References: <002201c9569f$ddff61a0$99fe24e0$@co.in> Message-ID: <49392B2B.3070107@resolversystems.com> You can either use pipe the stdout through tee to save it in a file too, or in a more pythonic way define a file-like object that prints to stdout as you write to it: import sys class PrintStream(object): def __init__(self, file): self.out = file def write(self, b): self.out.write(b) sys.stdout.write(b) unittest.TextTestRunner(PrintStream(file),verbosity=2).run(suite) Hope that helped, Orestis Deepali Abhyankar wrote: > Hi > > I used following code to write result on different media. > > unittest.TextTestRunner(verbosity=2).run(suite) : Writes result to StdOutput > unittest.TextTestRunner(file,verbosity=2).run(suite) : Writes result to file > > > But what should I do to write test result on file as well as StdOutput, on > single go? > Is there any other method to do this? > > Regards > Deepali > > > -----Original Message----- > From: users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Hardy > Sent: Friday, December 05, 2008 7:27 AM > To: Discussion of IronPython; web-sig at python.org > Subject: [IronPython] NWSGI 0.7 released > > NWSGI 0.7 is now available. This version adds support for ASP.NET > sessions, fixes Unicode handling, and adds support for wildcard > mappings. It is available at > http://www.codeplex.com/NWSGI/Release/ProjectReleases.aspx?ReleaseId=20189. > > What is NWSGI? > NWSGI is an ASP.NET HttpHandler that implements the Python WSGI spec > (PEP 333 - http://www.python.org/dev/peps/pep-0333/) for interfacing > web servers and web frameworks using IronPython. There are still some > IronPYthon bugs that prevent everything from working, but some things > do. > > For more details on this release, see > http://jdhardy.blogspot.com/2008/12/nwsgi-07-released.html. > > - Jeff > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > DISCLAIMER > ========== > This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- Orestis Markou Software Engineer, Resolver Systems Ltd. orestis at resolversystems.com +44 (0) 20 7253 6372 From giulio.petrucci at gmail.com Fri Dec 5 15:11:55 2008 From: giulio.petrucci at gmail.com (Giulio Petrucci) Date: Fri, 5 Dec 2008 15:11:55 +0100 Subject: [IronPython] Newbie Questions Message-ID: Hi there, I've just started playing with IronPython and I have two (maybe) simple questions: 1) I have a .NET library with an enum E and a class C. The class C expose a method accepting E as an argument. How can I do this (I mean: using enums) in IronPython? 2) I have a .NET library which reads some settings from the .config file. I'd like to test it interactively using the IronPython interactive console. How can I "load" the right .config file? Thanks in advance and... see you here or on the #ironpython freenode channel!!! -- Ciao, Giulio -- OnAir: http://www.giuliopetrucci.it http://www.fujikomonamour.com From dinov at microsoft.com Fri Dec 5 18:47:26 2008 From: dinov at microsoft.com (Dino Viehland) Date: Fri, 5 Dec 2008 09:47:26 -0800 Subject: [IronPython] Newbie Questions In-Reply-To: References: Message-ID: <350E7D38B6D819428718949920EC2355564A7FB258@NA-EXMSG-C102.redmond.corp.microsoft.com> You can add a reference to the assembly and then import both the class and the enum. For example: import clr clr.AddReference('MyLibrary') from MyLibrary import MyClass, MyEnum MyClass().SomeMethod(MyEnum.SomeValue) The 2nd question... is this an app.exe.config file that you're reading? If so this might be helpful: http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.windowsforms/topic64732.aspx -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Giulio Petrucci Sent: Friday, December 05, 2008 6:12 AM To: users at lists.ironpython.com Subject: [IronPython] Newbie Questions Hi there, I've just started playing with IronPython and I have two (maybe) simple questions: 1) I have a .NET library with an enum E and a class C. The class C expose a method accepting E as an argument. How can I do this (I mean: using enums) in IronPython? 2) I have a .NET library which reads some settings from the .config file. I'd like to test it interactively using the IronPython interactive console. How can I "load" the right .config file? Thanks in advance and... see you here or on the #ironpython freenode channel!!! -- Ciao, Giulio -- OnAir: http://www.giuliopetrucci.it http://www.fujikomonamour.com _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dan.eloff at gmail.com Fri Dec 5 20:53:49 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Fri, 5 Dec 2008 14:53:49 -0500 Subject: [IronPython] NWSGI 0.7 released In-Reply-To: <233dfa1d0812050011v1ac776a8q72f82853f18ea353@mail.gmail.com> References: <233dfa1d0812050011v1ac776a8q72f82853f18ea353@mail.gmail.com> Message-ID: <4817b6fc0812051153r2d607e86k4941db8e87f3892f@mail.gmail.com> Django depends on unicode and str being two different creatures, so I imagine not so well on IronPython. However once we have bytes objects and Django is updated for python 3, then I think the story will improve. -Dan On Fri, Dec 5, 2008 at 3:11 AM, Miha Valencic wrote: > Jeff, do you have any info on whether Django works with this setup? > > Thanks, > Miha. > > 2008/12/5 Jeff Hardy >> >> NWSGI 0.7 is now available. This version adds support for ASP.NET >> sessions, fixes Unicode handling, and adds support for wildcard >> mappings. It is available at >> >> http://www.codeplex.com/NWSGI/Release/ProjectReleases.aspx?ReleaseId=20189. >> > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From carolj at microsoft.com Sat Dec 6 00:02:10 2008 From: carolj at microsoft.com (Carolyn Johnston (MSNAR)) Date: Fri, 5 Dec 2008 15:02:10 -0800 Subject: [IronPython] can't import namespace from assembly Message-ID: <387DA5F5806B6A49A69468E4EA24DB2A7225C75918@NA-EXMSG-C125.redmond.corp.microsoft.com> I have a dll that I've built in VS2008, C# (and I even strongly named it): Normalizer.dll. It contains a namespace (StringUtilities) which contains a single class (MaxNormalizer). I can't import the StringUtilities namespace: >>> ass = Assembly.Load("Normalizer.dll") >>> ass >>> clr.AddReference(ass) >>> import StringUtilities Traceback (most recent call last): File , line 0, in ##229 File , line 0, in __import__##7 ImportError: No module named StringUtilities However you can see that "ass" does contain the StringUtilities namespace (I've included the listNamespaces code at bottom of this email): >>> ass.GetTypes() System.Type[]() I also found a help page from Dino here (http://lists.ironpython.com/pipermail/users-ironpython.com/2007-April/004792.html) that implied StringUtilities ought to be an attribute of the assembly itself, so I tried that too: >>> ass.StringUtilities Traceback (most recent call last): File , line 0, in ##231 AttributeError: assembly Normalizer has no type StringUtilities And then I made one last desperate shot at it: >>> from Normalizer import StringUtilities Traceback (most recent call last): File , line 0, in ##232 File , line 0, in __import__##7 ImportError: No module named Normalizer >>> Any clues as to why this namespace can't be imported? I'm stumped. Thanks, Carolyn --- Carolyn Johnston (carolj) Lead Researcher, Local Search, Virtual Earth Bldg 116/2276 | MIcrosoft Corporation 425-706-2153 -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Sat Dec 6 00:05:00 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 05 Dec 2008 23:05:00 +0000 Subject: [IronPython] can't import namespace from assembly In-Reply-To: <387DA5F5806B6A49A69468E4EA24DB2A7225C75918@NA-EXMSG-C125.redmond.corp.microsoft.com> References: <387DA5F5806B6A49A69468E4EA24DB2A7225C75918@NA-EXMSG-C125.redmond.corp.microsoft.com> Message-ID: <4939B39C.6070105@voidspace.org.uk> In the past I've had this error when I've forgotten to make the class public. Possibly not the problem, but you never know. :-) Michael Foord Carolyn Johnston (MSNAR) wrote: > > I have a dll that I?ve built in VS2008, C# (and I even strongly named > it): Normalizer.dll. It contains a namespace (StringUtilities) which > contains a single class (MaxNormalizer). > > I can?t import the StringUtilities namespace: > > >>> ass = Assembly.Load("Normalizer.dll") > > >>> ass > > PublicKeyToken=0707cddf2bb66849> > > >>> clr.AddReference(ass) > > >>> import StringUtilities > > Traceback (most recent call last): > > File , line 0, in ##229 > > File , line 0, in __import__##7 > > ImportError: No module named StringUtilities > > However you can see that ?ass? does contain the StringUtilities > namespace (I?ve included the listNamespaces code at bottom of this email): > > >>> ass.GetTypes() > > System.Type[]( [StringUtilities.MaxNormalizer]>) > > I also found a help page from Dino here > (http://lists.ironpython.com/pipermail/users-ironpython.com/2007-April/004792.html) > that implied StringUtilities ought to be an attribute of the assembly > itself, so I tried that too: > > >>> ass.StringUtilities > > Traceback (most recent call last): > > File , line 0, in ##231 > > AttributeError: assembly Normalizer has no type StringUtilities > > And then I made one last desperate shot at it: > > >>> from Normalizer import StringUtilities > > Traceback (most recent call last): > > File , line 0, in ##232 > > File , line 0, in __import__##7 > > ImportError: No module named Normalizer > > >>> > > Any clues as to why this namespace can?t be imported? I?m stumped. > > Thanks, > > Carolyn > > *--- > Carolyn Johnston (carolj)* > Lead Researcher, Local Search, Virtual Earth > Bldg 116/2276 | MIcrosoft Corporation > 425-706-2153** > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From Rodney.Howeedy at Sun.COM Sat Dec 6 00:11:03 2008 From: Rodney.Howeedy at Sun.COM (Rodney Howeedy) Date: Fri, 05 Dec 2008 16:11:03 -0700 Subject: [IronPython] 'DispPropertyGet' error returned from read-write COM interop property Message-ID: <4939B507.4050104@sun.com> Hi everyone, I encounter an error with 2.0 RC2 that didn't occur in the same IronPython code on 2.0 Beta 3. I use a factory object from a COM interop assembly that has a read-write property named "Field". I get a TypeError when I assign a value to this property (read-write): >>> mytestRun.Field['RN_USER_01'] = 'abc' Traceback (most recent call last): File "", line 1, in TypeError: 'DispPropertyGet' object is unsubscriptable >>> print mytestRun.Field['RN_USER_01'] None I imported the same COM interop assembly that worked with 2.0 Beta3. The interop was converted with tlbimp.exe from a COM API .dll. Here's the 2.0 Beta3 output: >>> mytestRun.Field['RN_USER_01'] = 'abc' >>> print mytestRun.Field['RN_USER_01'] abc My best guess is that IronPython 2.0 RC2 interprets the property as read-only even though the COM interop assembly defines the property read-write. The error occurs in IronPython 2.0 RC2 with every COM interop object with the read-write "Field" property. I can read the default assigned value but cannot assign anything. Any ideas? I'm fresh out of them after trying many permutations of the syntax. Thank you, Rodney Howeedy Staff Engineer, Sun Microsystems From carolj at microsoft.com Sat Dec 6 00:11:06 2008 From: carolj at microsoft.com (Carolyn Johnston (MSNAR)) Date: Fri, 5 Dec 2008 15:11:06 -0800 Subject: [IronPython] can't import namespace from assembly In-Reply-To: <4939B39C.6070105@voidspace.org.uk> References: <387DA5F5806B6A49A69468E4EA24DB2A7225C75918@NA-EXMSG-C125.redmond.corp.microsoft.com> <4939B39C.6070105@voidspace.org.uk> Message-ID: <387DA5F5806B6A49A69468E4EA24DB2A7225C75934@NA-EXMSG-C125.redmond.corp.microsoft.com> Thank you, that was the problem. :) Carolyn -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Friday, December 05, 2008 3:05 PM To: Discussion of IronPython Subject: Re: [IronPython] can't import namespace from assembly In the past I've had this error when I've forgotten to make the class public. Possibly not the problem, but you never know. :-) Michael Foord Carolyn Johnston (MSNAR) wrote: > > I have a dll that I've built in VS2008, C# (and I even strongly named > it): Normalizer.dll. It contains a namespace (StringUtilities) which > contains a single class (MaxNormalizer). > > I can't import the StringUtilities namespace: > > >>> ass = Assembly.Load("Normalizer.dll") > > >>> ass > > PublicKeyToken=0707cddf2bb66849> > > >>> clr.AddReference(ass) > > >>> import StringUtilities > > Traceback (most recent call last): > > File , line 0, in ##229 > > File , line 0, in __import__##7 > > ImportError: No module named StringUtilities > > However you can see that "ass" does contain the StringUtilities > namespace (I've included the listNamespaces code at bottom of this email): > > >>> ass.GetTypes() > > System.Type[]( [StringUtilities.MaxNormalizer]>) > > I also found a help page from Dino here > (http://lists.ironpython.com/pipermail/users-ironpython.com/2007-April/004792.html) > that implied StringUtilities ought to be an attribute of the assembly > itself, so I tried that too: > > >>> ass.StringUtilities > > Traceback (most recent call last): > > File , line 0, in ##231 > > AttributeError: assembly Normalizer has no type StringUtilities > > And then I made one last desperate shot at it: > > >>> from Normalizer import StringUtilities > > Traceback (most recent call last): > > File , line 0, in ##232 > > File , line 0, in __import__##7 > > ImportError: No module named Normalizer > > >>> > > Any clues as to why this namespace can't be imported? I'm stumped. > > Thanks, > > Carolyn > > *--- > Carolyn Johnston (carolj)* > Lead Researcher, Local Search, Virtual Earth > Bldg 116/2276 | MIcrosoft Corporation > 425-706-2153** > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at microsoft.com Sat Dec 6 00:12:12 2008 From: dinov at microsoft.com (Dino Viehland) Date: Fri, 5 Dec 2008 15:12:12 -0800 Subject: [IronPython] 'DispPropertyGet' error returned from read-write COM interop property In-Reply-To: <4939B507.4050104@sun.com> References: <4939B507.4050104@sun.com> Message-ID: <350E7D38B6D819428718949920EC2355564A7FB4CC@NA-EXMSG-C102.redmond.corp.microsoft.com> Does: mytestRun.Field.Item['RN_USER_01'] = 'abc' work? -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Rodney Howeedy Sent: Friday, December 05, 2008 3:11 PM To: users at lists.ironpython.com Subject: [IronPython] 'DispPropertyGet' error returned from read-write COM interop property Hi everyone, I encounter an error with 2.0 RC2 that didn't occur in the same IronPython code on 2.0 Beta 3. I use a factory object from a COM interop assembly that has a read-write property named "Field". I get a TypeError when I assign a value to this property (read-write): >>> mytestRun.Field['RN_USER_01'] = 'abc' Traceback (most recent call last): File "", line 1, in TypeError: 'DispPropertyGet' object is unsubscriptable >>> print mytestRun.Field['RN_USER_01'] None I imported the same COM interop assembly that worked with 2.0 Beta3. The interop was converted with tlbimp.exe from a COM API .dll. Here's the 2.0 Beta3 output: >>> mytestRun.Field['RN_USER_01'] = 'abc' >>> print mytestRun.Field['RN_USER_01'] abc My best guess is that IronPython 2.0 RC2 interprets the property as read-only even though the COM interop assembly defines the property read-write. The error occurs in IronPython 2.0 RC2 with every COM interop object with the read-write "Field" property. I can read the default assigned value but cannot assign anything. Any ideas? I'm fresh out of them after trying many permutations of the syntax. Thank you, Rodney Howeedy Staff Engineer, Sun Microsystems _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From Rodney.Howeedy at Sun.COM Sat Dec 6 00:21:32 2008 From: Rodney.Howeedy at Sun.COM (Rodney Howeedy) Date: Fri, 05 Dec 2008 16:21:32 -0700 Subject: [IronPython] 'DispPropertyGet' error returned from read-write COM interop property In-Reply-To: <350E7D38B6D819428718949920EC2355564A7FB4CC@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <4939B507.4050104@sun.com> <350E7D38B6D819428718949920EC2355564A7FB4CC@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <4939B77C.2060603@sun.com> I found that one and tried before. I didn't have any luck: >>> mytestRun.Field.Item['RN_USER_01'] = 'abc' Traceback (most recent call last): File "", line 1, in SystemError: Object reference not set to an instance of an object. >>> print mytestRun.Field.Item['RN_USER_01'] None I couldn't decipher the error so I couldn't figure out what I'm doing wrong. I suspect the folks on this list can. =) Dino Viehland wrote: > Does: > > mytestRun.Field.Item['RN_USER_01'] = 'abc' > > work? > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Rodney Howeedy > Sent: Friday, December 05, 2008 3:11 PM > To: users at lists.ironpython.com > Subject: [IronPython] 'DispPropertyGet' error returned from read-write COM interop property > > Hi everyone, > > I encounter an error with 2.0 RC2 that didn't occur in the same > IronPython code on 2.0 Beta 3. > > I use a factory object from a COM interop assembly that has a read-write > property named "Field". I get a TypeError when I assign a value to this > property (read-write): > >>> mytestRun.Field['RN_USER_01'] = 'abc' > Traceback (most recent call last): > File "", line 1, in > TypeError: 'DispPropertyGet' object is unsubscriptable > > >>> print mytestRun.Field['RN_USER_01'] > None > > I imported the same COM interop assembly that worked with 2.0 Beta3. > The interop was converted with tlbimp.exe from a COM API .dll. Here's > the 2.0 Beta3 output: > >>> mytestRun.Field['RN_USER_01'] = 'abc' > >>> print mytestRun.Field['RN_USER_01'] > abc > > My best guess is that IronPython 2.0 RC2 interprets the property as > read-only even though the COM interop assembly defines the property > read-write. The error occurs in IronPython 2.0 RC2 with every COM > interop object with the read-write "Field" property. > > I can read the default assigned value but cannot assign anything. Any > ideas? I'm fresh out of them after trying many permutations of the syntax. > > Thank you, > Rodney Howeedy > Staff Engineer, Sun Microsystems > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dinov at microsoft.com Sat Dec 6 00:28:49 2008 From: dinov at microsoft.com (Dino Viehland) Date: Fri, 5 Dec 2008 15:28:49 -0800 Subject: [IronPython] 'DispPropertyGet' error returned from read-write COM interop property In-Reply-To: <4939B77C.2060603@sun.com> References: <4939B507.4050104@sun.com> <350E7D38B6D819428718949920EC2355564A7FB4CC@NA-EXMSG-C102.redmond.corp.microsoft.com> <4939B77C.2060603@sun.com> Message-ID: <350E7D38B6D819428718949920EC2355564A7FB4DD@NA-EXMSG-C102.redmond.corp.microsoft.com> What's the stack trace for the object reference exception if you run with the -X:ExceptionDetail option? -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Rodney Howeedy Sent: Friday, December 05, 2008 3:22 PM To: Discussion of IronPython Subject: Re: [IronPython] 'DispPropertyGet' error returned from read-write COM interop property I found that one and tried before. I didn't have any luck: >>> mytestRun.Field.Item['RN_USER_01'] = 'abc' Traceback (most recent call last): File "", line 1, in SystemError: Object reference not set to an instance of an object. >>> print mytestRun.Field.Item['RN_USER_01'] None I couldn't decipher the error so I couldn't figure out what I'm doing wrong. I suspect the folks on this list can. =) Dino Viehland wrote: > Does: > > mytestRun.Field.Item['RN_USER_01'] = 'abc' > > work? > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Rodney Howeedy > Sent: Friday, December 05, 2008 3:11 PM > To: users at lists.ironpython.com > Subject: [IronPython] 'DispPropertyGet' error returned from read-write COM interop property > > Hi everyone, > > I encounter an error with 2.0 RC2 that didn't occur in the same > IronPython code on 2.0 Beta 3. > > I use a factory object from a COM interop assembly that has a read-write > property named "Field". I get a TypeError when I assign a value to this > property (read-write): > >>> mytestRun.Field['RN_USER_01'] = 'abc' > Traceback (most recent call last): > File "", line 1, in > TypeError: 'DispPropertyGet' object is unsubscriptable > > >>> print mytestRun.Field['RN_USER_01'] > None > > I imported the same COM interop assembly that worked with 2.0 Beta3. > The interop was converted with tlbimp.exe from a COM API .dll. Here's > the 2.0 Beta3 output: > >>> mytestRun.Field['RN_USER_01'] = 'abc' > >>> print mytestRun.Field['RN_USER_01'] > abc > > My best guess is that IronPython 2.0 RC2 interprets the property as > read-only even though the COM interop assembly defines the property > read-write. The error occurs in IronPython 2.0 RC2 with every COM > interop object with the read-write "Field" property. > > I can read the default assigned value but cannot assign anything. Any > ideas? I'm fresh out of them after trying many permutations of the syntax. > > Thank you, > Rodney Howeedy > Staff Engineer, Sun Microsystems > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From Rodney.Howeedy at Sun.COM Sat Dec 6 00:34:51 2008 From: Rodney.Howeedy at Sun.COM (Rodney Howeedy) Date: Fri, 05 Dec 2008 16:34:51 -0700 Subject: [IronPython] 'DispPropertyGet' error returned from read-write COM interop property In-Reply-To: <350E7D38B6D819428718949920EC2355564A7FB4DD@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <4939B507.4050104@sun.com> <350E7D38B6D819428718949920EC2355564A7FB4CC@NA-EXMSG-C102.redmond.corp.microsoft.com> <4939B77C.2060603@sun.com> <350E7D38B6D819428718949920EC2355564A7FB4DD@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <4939BA9B.3070701@sun.com> Stack trace for the statement that raises the SytemError: >>> mytestRun.Field.Item['RN_USER_01'] = 'abc' Object reference not set to an instance of an object. at IronPython.Runtime.Types.ReflectedGetterSetter.CallTarget(CodeContext context, SiteLocalStorage`1 storage, MethodInfo[] targets, Object instance, Object[] args) at IronPython.Runtime.Types.ReflectedGetterSetter.CallSetter(CodeContext context, SiteLocalStorage`1 storage, Objectinstance, Object[] args, Object value) at IronPython.Runtime.Types.ReflectedIndexer.SetValue(CodeContext context, SiteLocalStorage`1 storage, Object[] keys, Object value) at IronPython.Runtime.Types.ReflectedIndexer.set_Item(SiteLocalStorage`1 storage, Object[] key, Object value) at _stub_$1209##669(Closure , CallSite , Object , String , String ) at Microsoft.Scripting.Actions.MatchCaller.Call3[T0,T1,T2,TRet](Func`5 target, CallSite site, Object[] args) at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args) at Microsoft.Scripting.Actions.UpdateDelegates.Update3[T,T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) at $1203##663(Closure , Scope , LanguageContext ) at Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpression code, Scope scope) at Microsoft.Scripting.ScriptCode.Run(Scope scope) at IronPython.Hosting.PythonCommandLine.<>c__DisplayClass1.b__0() SystemError: Object reference not set to an instance of an object. Dino Viehland wrote: > What's the stack trace for the object reference exception if you run with the -X:ExceptionDetail option? > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Rodney Howeedy > Sent: Friday, December 05, 2008 3:22 PM > To: Discussion of IronPython > Subject: Re: [IronPython] 'DispPropertyGet' error returned from read-write COM interop property > > I found that one and tried before. I didn't have any luck: > >>> mytestRun.Field.Item['RN_USER_01'] = 'abc' > Traceback (most recent call last): > File "", line 1, in > SystemError: Object reference not set to an instance of an object. > > >>> print mytestRun.Field.Item['RN_USER_01'] > None > > I couldn't decipher the error so I couldn't figure out what I'm doing > wrong. > I suspect the folks on this list can. =) > > Dino Viehland wrote: > >> Does: >> >> mytestRun.Field.Item['RN_USER_01'] = 'abc' >> >> work? >> >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Rodney Howeedy >> Sent: Friday, December 05, 2008 3:11 PM >> To: users at lists.ironpython.com >> Subject: [IronPython] 'DispPropertyGet' error returned from read-write COM interop property >> >> Hi everyone, >> >> I encounter an error with 2.0 RC2 that didn't occur in the same >> IronPython code on 2.0 Beta 3. >> >> I use a factory object from a COM interop assembly that has a read-write >> property named "Field". I get a TypeError when I assign a value to this >> property (read-write): >> >>> mytestRun.Field['RN_USER_01'] = 'abc' >> Traceback (most recent call last): >> File "", line 1, in >> TypeError: 'DispPropertyGet' object is unsubscriptable >> >> >>> print mytestRun.Field['RN_USER_01'] >> None >> >> I imported the same COM interop assembly that worked with 2.0 Beta3. >> The interop was converted with tlbimp.exe from a COM API .dll. Here's >> the 2.0 Beta3 output: >> >>> mytestRun.Field['RN_USER_01'] = 'abc' >> >>> print mytestRun.Field['RN_USER_01'] >> abc >> >> My best guess is that IronPython 2.0 RC2 interprets the property as >> read-only even though the COM interop assembly defines the property >> read-write. The error occurs in IronPython 2.0 RC2 with every COM >> interop object with the read-write "Field" property. >> >> I can read the default assigned value but cannot assign anything. Any >> ideas? I'm fresh out of them after trying many permutations of the syntax. >> >> Thank you, >> Rodney Howeedy >> Staff Engineer, Sun Microsystems >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dinov at microsoft.com Sat Dec 6 01:05:05 2008 From: dinov at microsoft.com (Dino Viehland) Date: Fri, 5 Dec 2008 16:05:05 -0800 Subject: [IronPython] 'DispPropertyGet' error returned from read-write COM interop property In-Reply-To: <4939BA9B.3070701@sun.com> References: <4939B507.4050104@sun.com> <350E7D38B6D819428718949920EC2355564A7FB4CC@NA-EXMSG-C102.redmond.corp.microsoft.com> <4939B77C.2060603@sun.com> <350E7D38B6D819428718949920EC2355564A7FB4DD@NA-EXMSG-C102.redmond.corp.microsoft.com> <4939BA9B.3070701@sun.com> Message-ID: <350E7D38B6D819428718949920EC2355564A7FB506@NA-EXMSG-C102.redmond.corp.microsoft.com> This might be broken but the output of dir(mytestRun) might be helpful as well to make sure (e.g. maybe there'll be some set_Field method or something). But I suspect you might want to pass the -X:PreferComInteropAssembly command line option and I think that'll restore the beta 3 behavior for you. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Rodney Howeedy Sent: Friday, December 05, 2008 3:35 PM To: Discussion of IronPython Subject: Re: [IronPython] 'DispPropertyGet' error returned from read-write COM interop property Stack trace for the statement that raises the SytemError: >>> mytestRun.Field.Item['RN_USER_01'] = 'abc' Object reference not set to an instance of an object. at IronPython.Runtime.Types.ReflectedGetterSetter.CallTarget(CodeContext context, SiteLocalStorage`1 storage, MethodInfo[] targets, Object instance, Object[] args) at IronPython.Runtime.Types.ReflectedGetterSetter.CallSetter(CodeContext context, SiteLocalStorage`1 storage, Objectinstance, Object[] args, Object value) at IronPython.Runtime.Types.ReflectedIndexer.SetValue(CodeContext context, SiteLocalStorage`1 storage, Object[] keys, Object value) at IronPython.Runtime.Types.ReflectedIndexer.set_Item(SiteLocalStorage`1 storage, Object[] key, Object value) at _stub_$1209##669(Closure , CallSite , Object , String , String ) at Microsoft.Scripting.Actions.MatchCaller.Call3[T0,T1,T2,TRet](Func`5 target, CallSite site, Object[] args) at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args) at Microsoft.Scripting.Actions.UpdateDelegates.Update3[T,T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) at $1203##663(Closure , Scope , LanguageContext ) at Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpression code, Scope scope) at Microsoft.Scripting.ScriptCode.Run(Scope scope) at IronPython.Hosting.PythonCommandLine.<>c__DisplayClass1.b__0() SystemError: Object reference not set to an instance of an object. Dino Viehland wrote: > What's the stack trace for the object reference exception if you run with the -X:ExceptionDetail option? > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Rodney Howeedy > Sent: Friday, December 05, 2008 3:22 PM > To: Discussion of IronPython > Subject: Re: [IronPython] 'DispPropertyGet' error returned from read-write COM interop property > > I found that one and tried before. I didn't have any luck: > >>> mytestRun.Field.Item['RN_USER_01'] = 'abc' > Traceback (most recent call last): > File "", line 1, in > SystemError: Object reference not set to an instance of an object. > > >>> print mytestRun.Field.Item['RN_USER_01'] > None > > I couldn't decipher the error so I couldn't figure out what I'm doing > wrong. > I suspect the folks on this list can. =) > > Dino Viehland wrote: > >> Does: >> >> mytestRun.Field.Item['RN_USER_01'] = 'abc' >> >> work? >> >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Rodney Howeedy >> Sent: Friday, December 05, 2008 3:11 PM >> To: users at lists.ironpython.com >> Subject: [IronPython] 'DispPropertyGet' error returned from read-write COM interop property >> >> Hi everyone, >> >> I encounter an error with 2.0 RC2 that didn't occur in the same >> IronPython code on 2.0 Beta 3. >> >> I use a factory object from a COM interop assembly that has a read-write >> property named "Field". I get a TypeError when I assign a value to this >> property (read-write): >> >>> mytestRun.Field['RN_USER_01'] = 'abc' >> Traceback (most recent call last): >> File "", line 1, in >> TypeError: 'DispPropertyGet' object is unsubscriptable >> >> >>> print mytestRun.Field['RN_USER_01'] >> None >> >> I imported the same COM interop assembly that worked with 2.0 Beta3. >> The interop was converted with tlbimp.exe from a COM API .dll. Here's >> the 2.0 Beta3 output: >> >>> mytestRun.Field['RN_USER_01'] = 'abc' >> >>> print mytestRun.Field['RN_USER_01'] >> abc >> >> My best guess is that IronPython 2.0 RC2 interprets the property as >> read-only even though the COM interop assembly defines the property >> read-write. The error occurs in IronPython 2.0 RC2 with every COM >> interop object with the read-write "Field" property. >> >> I can read the default assigned value but cannot assign anything. Any >> ideas? I'm fresh out of them after trying many permutations of the syntax. >> >> Thank you, >> Rodney Howeedy >> Staff Engineer, Sun Microsystems >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From Shri.Borde at microsoft.com Sat Dec 6 01:06:30 2008 From: Shri.Borde at microsoft.com (Shri Borde) Date: Fri, 5 Dec 2008 16:06:30 -0800 Subject: [IronPython] Welcome David DiCato Message-ID: <710DF26F214D2B4BB94287123FFE980A2DCBD82311@NA-EXMSG-C104.redmond.corp.microsoft.com> Please welcome David DiCato to the IronPython team. He has his first shelveset in the Snap queue (queue.__init__ calls clear) already. You should hopefully hear more from him in the mailing list. Here is his intro in his own words. Hi everyone, I'm David DiCato, the new Dev on the IronPython team. I grew up in Surf City (i.e. Huntington Beach, CA) and moved just 50 miles north to go to school in Pasadena. At Caltech, I earned my BS in Computer Science, applied to Microsoft after a short break, and the rest is history. Although I have never touched a surf board, I like to dabble in snowboarding, as well as piano, guitar and biking, although I'm good at none of these things. I'm also a big fan of music, incl. classic rock, punk and electronic, and film, incl. Kubrick, Hitchcock and Scorsese. Thanks, Shri -------------- next part -------------- An HTML attachment was scrubbed... URL: From Rodney.Howeedy at Sun.COM Sat Dec 6 01:38:57 2008 From: Rodney.Howeedy at Sun.COM (Rodney Howeedy) Date: Fri, 05 Dec 2008 17:38:57 -0700 Subject: [IronPython] 'DispPropertyGet' error returned from read-write COM interop property In-Reply-To: <350E7D38B6D819428718949920EC2355564A7FB506@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <4939B507.4050104@sun.com> <350E7D38B6D819428718949920EC2355564A7FB4CC@NA-EXMSG-C102.redmond.corp.microsoft.com> <4939B77C.2060603@sun.com> <350E7D38B6D819428718949920EC2355564A7FB4DD@NA-EXMSG-C102.redmond.corp.microsoft.com> <4939BA9B.3070701@sun.com> <350E7D38B6D819428718949920EC2355564A7FB506@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <4939C9A1.9080909@sun.com> Thank you for that work around... now I can start the weekend. :-D There used to be a mytestRun.Field.SetValue in the dir() listing in Beta3: >>> dir(mytestRun.Field) ['Equals', 'GetHashCode', 'GetType', 'GetValue', 'Item', 'ReferenceEquals', 'SetValue', 'ToString', '__class__', '__delattr__', '__delete__', '__doc__', '__get_ _', '__getattribute__', '__getitem__', '__hash__', '__init__', '__name__', '__new__', '__objclass__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__str__'] But Field.SetValue disappeared in RC2: >>> dir(mytestRun.Field) ['ComMethodDesc', 'DispatchObject', 'Equals', 'GetHashCode', 'GetMetaObject', 'GetType', 'Item', 'MemberwiseClone', 'Ref erenceEquals', 'ToString', '__class__', '__delattr__', '__doc__', '__eq__', '__getattribute__', '__getitem__', '__hash__ ', '__init__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__'] I didn't know what the Dev team had in mind. Some things became more straightforward but I couldn't get this critical piece to work. Additional dir() output on RC2: >>> dir(mytestRun.Field.Item) ['Equals', 'GetHashCode', 'GetType', 'GetValue', 'Item', 'MemberwiseClone', 'ReferenceEquals', 'SetValue', 'ToString', ' __class__', '__delattr__', '__delete__', '__doc__', '__get__', '__getattribute__', '__getitem__', '__hash__', '__init__' , '__name__', '__new__', '__objclass__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__str __'] I already found and tried Item's SetValue but encountered the same SystemError. I tried to find the expected inputs: >>> print mytestRun.Field.Item.SetValue.__doc__ bool SetValue(self, CodeContext context, SiteLocalStorage[CallSite[Func[CallSite, CodeContext, object, Array[object], ob ject]]] storage, Array[object] keys, object value) I may have gotten close, but no cigar: >>> mytestRun.Field.Item.SetValue(Array[object](["RN_DURATION"]),"10") Traceback (most recent call last): File "", line 1, in SystemError: Object reference not set to an instance of an object. The requested 2.0 RC2 output: >>> dir(mytestRun) ['Attachments', 'AutoPost', 'BPStepParamFactory', 'CancelRun', 'CopyDesignSteps', 'CopyStepsToTest', 'CreateObjRef', 'Eq uals', 'ExtendedStorage', 'Field', 'GetHashCode', 'GetLifetimeService', 'GetType', 'HasAttachment', 'History', 'ID', 'In itializeLifetimeService', 'IsLocked', 'LockObject', 'MemberwiseClone', 'Modified', 'Name', 'Params', 'Post', 'ReferenceE quals', 'Refresh', 'ResolveStepsParameters', 'ResultLocation', 'Status', 'StepFactory', 'TestId', 'TestInstance', 'TestI nstanceID', 'TestSetID', 'ToString', 'UnLockObject', 'Undo', 'Virtual', '__class__', '__delattr__', '__doc__', '__getatt ribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__'] Thank you, Rodney Howeedy Staff Engineer, Sun Microsystems Dino Viehland wrote: > This might be broken but the output of dir(mytestRun) might be helpful as well to make sure (e.g. maybe there'll be some set_Field method or something). > > But I suspect you might want to pass the -X:PreferComInteropAssembly command line option and I think that'll restore the beta 3 behavior for you. > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Rodney Howeedy > Sent: Friday, December 05, 2008 3:35 PM > To: Discussion of IronPython > Subject: Re: [IronPython] 'DispPropertyGet' error returned from read-write COM interop property > > Stack trace for the statement that raises the SytemError: > >>> mytestRun.Field.Item['RN_USER_01'] = 'abc' > Object reference not set to an instance of an object. > at > IronPython.Runtime.Types.ReflectedGetterSetter.CallTarget(CodeContext > context, SiteLocalStorage`1 storage, MethodInfo[] targets, Object > instance, Object[] args) > at > IronPython.Runtime.Types.ReflectedGetterSetter.CallSetter(CodeContext > context, SiteLocalStorage`1 storage, Objectinstance, Object[] args, > Object value) > at IronPython.Runtime.Types.ReflectedIndexer.SetValue(CodeContext > context, SiteLocalStorage`1 storage, Object[] keys, Object value) > at > IronPython.Runtime.Types.ReflectedIndexer.set_Item(SiteLocalStorage`1 > storage, Object[] key, Object value) > at _stub_$1209##669(Closure , CallSite , Object , String , String ) > at > Microsoft.Scripting.Actions.MatchCaller.Call3[T0,T1,T2,TRet](Func`5 > target, CallSite site, Object[] args) > at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args) > at > Microsoft.Scripting.Actions.UpdateDelegates.Update3[T,T0,T1,T2,TRet](CallSite > site, T0 arg0, T1 arg1, T2 arg2) > at $1203##663(Closure , Scope , LanguageContext ) > at > Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpression > code, Scope scope) > at Microsoft.Scripting.ScriptCode.Run(Scope scope) > at > IronPython.Hosting.PythonCommandLine.<>c__DisplayClass1.b__0() > SystemError: Object reference not set to an instance of an object. > > Dino Viehland wrote: > >> What's the stack trace for the object reference exception if you run with the -X:ExceptionDetail option? >> >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Rodney Howeedy >> Sent: Friday, December 05, 2008 3:22 PM >> To: Discussion of IronPython >> Subject: Re: [IronPython] 'DispPropertyGet' error returned from read-write COM interop property >> >> I found that one and tried before. I didn't have any luck: >> >>> mytestRun.Field.Item['RN_USER_01'] = 'abc' >> Traceback (most recent call last): >> File "", line 1, in >> SystemError: Object reference not set to an instance of an object. >> >> >>> print mytestRun.Field.Item['RN_USER_01'] >> None >> >> I couldn't decipher the error so I couldn't figure out what I'm doing >> wrong. >> I suspect the folks on this list can. =) >> >> Dino Viehland wrote: >> >> >>> Does: >>> >>> mytestRun.Field.Item['RN_USER_01'] = 'abc' >>> >>> work? >>> >>> -----Original Message----- >>> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Rodney Howeedy >>> Sent: Friday, December 05, 2008 3:11 PM >>> To: users at lists.ironpython.com >>> Subject: [IronPython] 'DispPropertyGet' error returned from read-write COM interop property >>> >>> Hi everyone, >>> >>> I encounter an error with 2.0 RC2 that didn't occur in the same >>> IronPython code on 2.0 Beta 3. >>> >>> I use a factory object from a COM interop assembly that has a read-write >>> property named "Field". I get a TypeError when I assign a value to this >>> property (read-write): >>> >>> mytestRun.Field['RN_USER_01'] = 'abc' >>> Traceback (most recent call last): >>> File "", line 1, in >>> TypeError: 'DispPropertyGet' object is unsubscriptable >>> >>> >>> print mytestRun.Field['RN_USER_01'] >>> None >>> >>> I imported the same COM interop assembly that worked with 2.0 Beta3. >>> The interop was converted with tlbimp.exe from a COM API .dll. Here's >>> the 2.0 Beta3 output: >>> >>> mytestRun.Field['RN_USER_01'] = 'abc' >>> >>> print mytestRun.Field['RN_USER_01'] >>> abc >>> >>> My best guess is that IronPython 2.0 RC2 interprets the property as >>> read-only even though the COM interop assembly defines the property >>> read-write. The error occurs in IronPython 2.0 RC2 with every COM >>> interop object with the read-write "Field" property. >>> >>> I can read the default assigned value but cannot assign anything. Any >>> ideas? I'm fresh out of them after trying many permutations of the syntax. >>> >>> Thank you, >>> Rodney Howeedy >>> Staff Engineer, Sun Microsystems >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >>> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From fuzzyman at voidspace.org.uk Sat Dec 6 02:06:32 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 06 Dec 2008 01:06:32 +0000 Subject: [IronPython] Welcome David DiCato In-Reply-To: <710DF26F214D2B4BB94287123FFE980A2DCBD82311@NA-EXMSG-C104.redmond.corp.microsoft.com> References: <710DF26F214D2B4BB94287123FFE980A2DCBD82311@NA-EXMSG-C104.redmond.corp.microsoft.com> Message-ID: <4939D018.6020103@voidspace.org.uk> Welcome David - and congratulations. Of course you realise that having a blog is a compulsory part of being on the dynamic languages team... Michael Foord Shri Borde wrote: > > Please welcome David DiCato to the IronPython team. He has his first > shelveset in the Snap queue (queue.__init__ calls clear) already. You > should hopefully hear more from him in the mailing list. Here is his > intro in his own words. > > Hi everyone, I?m David DiCato, the new Dev on the IronPython team. I > grew up in Surf City (i.e. Huntington Beach, CA) and moved just 50 > miles north to go to school in Pasadena. At Caltech, I earned my BS in > Computer Science, applied to Microsoft after a short break, and the > rest is history. Although I have never touched a surf board, I like to > dabble in snowboarding, as well as piano, guitar and biking, although > I?m good at none of these things. I?m also a big fan of music, incl. > classic rock, punk and electronic, and film, incl. Kubrick, Hitchcock > and Scorsese. > > Thanks, > > Shri > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From dan.eloff at gmail.com Sat Dec 6 03:42:20 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Fri, 5 Dec 2008 21:42:20 -0500 Subject: [IronPython] Welcome David DiCato In-Reply-To: <710DF26F214D2B4BB94287123FFE980A2DCBD82311@NA-EXMSG-C104.redmond.corp.microsoft.com> References: <710DF26F214D2B4BB94287123FFE980A2DCBD82311@NA-EXMSG-C104.redmond.corp.microsoft.com> Message-ID: <4817b6fc0812051842reff208dk7312c0ec4f6131fa@mail.gmail.com> Welcome David. It is heartening to see that even in these difficult economic times Microsoft is allocating more resources to dynamic languages. Best wishes to you in your new job. -Dan From dan.eloff at gmail.com Sat Dec 6 14:38:59 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Sat, 6 Dec 2008 08:38:59 -0500 Subject: [IronPython] Last source drop was Nov 30. Is something broken? Message-ID: <4817b6fc0812060538u4c89864apb4a945da5fbd1695@mail.gmail.com> Just eager to get my hands on the latest code. -Dan From jdhardy at gmail.com Sat Dec 6 17:07:51 2008 From: jdhardy at gmail.com (Jeff Hardy) Date: Sat, 6 Dec 2008 09:07:51 -0700 Subject: [IronPython] NWSGI 0.7 released In-Reply-To: <233dfa1d0812050011v1ac776a8q72f82853f18ea353@mail.gmail.com> References: <233dfa1d0812050011v1ac776a8q72f82853f18ea353@mail.gmail.com> Message-ID: Hi Miha, As Dan said, there are issues with str == unicode (although there is a Jython branch of Django that I should look into). There are also some other issues that seem to shift - trying to hit two moving targets makes tracking them difficult. For very simple stuff, Django might work, but I wouldn't expect it to do too much. It is on my list of things to get working (along with Trac, which will be much harder), but it's that pesky time thing, as always :). - Jeff On Fri, Dec 5, 2008 at 1:11 AM, Miha Valencic wrote: > Jeff, do you have any info on whether Django works with this setup? > > Thanks, > Miha. > > 2008/12/5 Jeff Hardy >> >> NWSGI 0.7 is now available. This version adds support for ASP.NET >> sessions, fixes Unicode handling, and adds support for wildcard >> mappings. It is available at >> >> http://www.codeplex.com/NWSGI/Release/ProjectReleases.aspx?ReleaseId=20189. >> > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From ctrachte at gmail.com Sat Dec 6 17:09:51 2008 From: ctrachte at gmail.com (Carl Trachte) Date: Sat, 6 Dec 2008 09:09:51 -0700 Subject: [IronPython] Welcome David DiCato In-Reply-To: <4817b6fc0812051842reff208dk7312c0ec4f6131fa@mail.gmail.com> References: <710DF26F214D2B4BB94287123FFE980A2DCBD82311@NA-EXMSG-C104.redmond.corp.microsoft.com> <4817b6fc0812051842reff208dk7312c0ec4f6131fa@mail.gmail.com> Message-ID: <426ada670812060809n7899cb84jb7c8ee2ef4a46f5d@mail.gmail.com> Samo Arigato, David DiCato (and Dino and Curt and Jim H. too) On Fri, Dec 5, 2008 at 7:42 PM, Dan Eloff wrote: > Welcome David. It is heartening to see that even in these difficult > economic times Microsoft is allocating more resources to dynamic > languages. > > Best wishes to you in your new job. > > -Dan > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From fuzzyman at voidspace.org.uk Sat Dec 6 18:20:48 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 06 Dec 2008 17:20:48 +0000 Subject: [IronPython] NWSGI 0.7 released In-Reply-To: References: <233dfa1d0812050011v1ac776a8q72f82853f18ea353@mail.gmail.com> Message-ID: <493AB470.4010705@voidspace.org.uk> Jeff Hardy wrote: > Hi Miha, > As Dan said, there are issues with str == unicode (although there is a > Jython branch of Django that I should look into). There are also some > other issues that seem to shift - trying to hit two moving targets > makes tracking them difficult. For very simple stuff, Django might > work, but I wouldn't expect it to do too much. > The Django guys are very interested in getting it to work on IronPython and would be open to discussion as to ways round problem. For example - how to resolve the str / unicode issue (perhaps patching in a compatible 'bytes' like implementation rather than fixing on str as a way of deciding to serve binary data). All the best, Michael Foord > It is on my list of things to get working (along with Trac, which will > be much harder), but it's that pesky time thing, as always :). > > - Jeff > > On Fri, Dec 5, 2008 at 1:11 AM, Miha Valencic wrote: > >> Jeff, do you have any info on whether Django works with this setup? >> >> Thanks, >> Miha. >> >> 2008/12/5 Jeff Hardy >> >>> NWSGI 0.7 is now available. This version adds support for ASP.NET >>> sessions, fixes Unicode handling, and adds support for wildcard >>> mappings. It is available at >>> >>> http://www.codeplex.com/NWSGI/Release/ProjectReleases.aspx?ReleaseId=20189. >>> >>> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> >> > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From jdhardy at gmail.com Sat Dec 6 21:52:40 2008 From: jdhardy at gmail.com (Jeff Hardy) Date: Sat, 6 Dec 2008 13:52:40 -0700 Subject: [IronPython] NWSGI 0.7 released In-Reply-To: <493AB470.4010705@voidspace.org.uk> References: <233dfa1d0812050011v1ac776a8q72f82853f18ea353@mail.gmail.com> <493AB470.4010705@voidspace.org.uk> Message-ID: On Sat, Dec 6, 2008 at 10:20 AM, Michael Foord wrote: > The Django guys are very interested in getting it to work on IronPython and > would be open to discussion as to ways round problem. For example - how to > resolve the str / unicode issue (perhaps patching in a compatible 'bytes' > like implementation rather than fixing on str as a way of deciding to serve > binary data). While that's great to hear, there's a long way to go before that becomes the biggest issue. There are still some annoying IPy bugs that break more fundamental things (i.e. MultiValueDict is currently broken). I haven't even run into the str/unicode problem yet, but it's certainly good to keep in mind. - Jeff > > All the best, > > Michael Foord > >> It is on my list of things to get working (along with Trac, which will >> be much harder), but it's that pesky time thing, as always :). >> >> - Jeff >> >> On Fri, Dec 5, 2008 at 1:11 AM, Miha Valencic >> wrote: >> >>> >>> Jeff, do you have any info on whether Django works with this setup? >>> >>> Thanks, >>> Miha. >>> >>> 2008/12/5 Jeff Hardy >>> >>>> >>>> NWSGI 0.7 is now available. This version adds support for ASP.NET >>>> sessions, fixes Unicode handling, and adds support for wildcard >>>> mappings. It is available at >>>> >>>> >>>> http://www.codeplex.com/NWSGI/Release/ProjectReleases.aspx?ReleaseId=20189. >>>> >>>> >>> >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >>> >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From jdhardy at gmail.com Sat Dec 6 21:57:28 2008 From: jdhardy at gmail.com (Jeff Hardy) Date: Sat, 6 Dec 2008 13:57:28 -0700 Subject: [IronPython] CP #20099: Stack Overflow using super() in dict subclass Message-ID: Hi, Django's MultiValueDict is a key piece of its URL routing, and it appears to be broken on IronPython 2.0RC2 (and RC1) when using a key of None. See http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20099 for details. I hate to be needy with a release so close, but is there any chance of fixing this for 2.0? - Jeff From fuzzyman at voidspace.org.uk Sat Dec 6 22:01:21 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 06 Dec 2008 21:01:21 +0000 Subject: [IronPython] NWSGI 0.7 released In-Reply-To: References: <233dfa1d0812050011v1ac776a8q72f82853f18ea353@mail.gmail.com> <493AB470.4010705@voidspace.org.uk> Message-ID: <493AE821.5080402@voidspace.org.uk> Jeff Hardy wrote: > On Sat, Dec 6, 2008 at 10:20 AM, Michael Foord > wrote: > >> The Django guys are very interested in getting it to work on IronPython and >> would be open to discussion as to ways round problem. For example - how to >> resolve the str / unicode issue (perhaps patching in a compatible 'bytes' >> like implementation rather than fixing on str as a way of deciding to serve >> binary data). >> > > While that's great to hear, there's a long way to go before that > becomes the biggest issue. There are still some annoying IPy bugs that > break more fundamental things (i.e. MultiValueDict is currently > broken). I haven't even run into the str/unicode problem yet, but it's > certainly good to keep in mind. > Cool. Would be great to have a reprise of what the current blockers are. Michael > - Jeff > > > >> All the best, >> >> Michael Foord >> >> >>> It is on my list of things to get working (along with Trac, which will >>> be much harder), but it's that pesky time thing, as always :). >>> >>> - Jeff >>> >>> On Fri, Dec 5, 2008 at 1:11 AM, Miha Valencic >>> wrote: >>> >>> >>>> Jeff, do you have any info on whether Django works with this setup? >>>> >>>> Thanks, >>>> Miha. >>>> >>>> 2008/12/5 Jeff Hardy >>>> >>>> >>>>> NWSGI 0.7 is now available. This version adds support for ASP.NET >>>>> sessions, fixes Unicode handling, and adds support for wildcard >>>>> mappings. It is available at >>>>> >>>>> >>>>> http://www.codeplex.com/NWSGI/Release/ProjectReleases.aspx?ReleaseId=20189. >>>>> >>>>> >>>>> >>>> _______________________________________________ >>>> Users mailing list >>>> Users at lists.ironpython.com >>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>>> >>>> >>>> >>>> >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >> -- >> http://www.ironpythoninaction.com/ >> http://www.voidspace.org.uk/blog >> >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From dinov at microsoft.com Sat Dec 6 22:16:42 2008 From: dinov at microsoft.com (Dino Viehland) Date: Sat, 6 Dec 2008 13:16:42 -0800 Subject: [IronPython] CP #20099: Stack Overflow using super() in dict subclass In-Reply-To: References: Message-ID: <350E7D38B6D819428718949920EC2355564B31B088@NA-EXMSG-C102.redmond.corp.microsoft.com> The immediate question would be does fixing this unblock all other Django issues? If there's going to be a long tail of other bugs then it'd be better to just fix them all for 2.0.1. If you want to try this out the fix is easy, in PythonDictionary.cs replace the line: this[(object)null] = value; with: _storage.Add(null, value); You'll probably find that alone isn't sufficient - the getter probably needs a similar change where it does the same thing as this[object key]. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Jeff Hardy > Sent: Saturday, December 06, 2008 12:57 PM > To: Discussion of IronPython > Subject: [IronPython] CP #20099: Stack Overflow using super() in dict > subclass > > Hi, > Django's MultiValueDict is a key piece of its URL routing, and it > appears to be broken on IronPython 2.0RC2 (and RC1) when using a key > of None. See > http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20099 > for details. > > I hate to be needy with a release so close, but is there any chance of > fixing this for 2.0? > > - Jeff > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From mbw.05 at multiparadigm.com Sat Dec 6 23:55:04 2008 From: mbw.05 at multiparadigm.com (M. Whitener) Date: Sat, 06 Dec 2008 15:55:04 -0700 Subject: [IronPython] =?utf-8?q?Examples_for_calling_IronPython_from_?= =?utf-8?b?wqBDIw==?= Message-ID: <20081206155504.0e377ce7397666338d3aeed6efde40f2.7e1cc2525a.wbe@email.secureserver.net> Is there a good source of documentation on how to use functions and classes in an IronPython program from C#? I need info on how to do this using C# 3.0 or lower - in other words _not_ using C# 4.0 dynamic types. The only example I have found is a very incomplete one from Alex Turner given at PDC 2008. Thanks in advance. From seshapv at microsoft.com Sun Dec 7 00:02:09 2008 From: seshapv at microsoft.com (Seshadri Pillailokam Vijayaraghavan) Date: Sat, 6 Dec 2008 15:02:09 -0800 Subject: [IronPython] =?iso-8859-1?q?Examples_for_calling_IronPython_from_?= =?iso-8859-1?q?=A0C=23?= In-Reply-To: <20081206155504.0e377ce7397666338d3aeed6efde40f2.7e1cc2525a.wbe@email.secureserver.net> References: <20081206155504.0e377ce7397666338d3aeed6efde40f2.7e1cc2525a.wbe@email.secureserver.net> Message-ID: <4F06AAB8EC03C349A5D6D0A797C4881C697E968274@NA-EXMSG-C112.redmond.corp.microsoft.com> See if this helps - http://blogs.msdn.com/seshadripv/archive/2008/06/30/how-to-invoke-a-python-function-from-c-using-the-dlr-hosting-api.aspx However, the sample will not compile as some of the runtime initialization APIs have changed since that sample was posted. To fix this replace the 'ScriptRuntime.Create()' in this line line - 'ScriptEngine pyEng = ScriptRuntime.Create().GetEngine("python");' with 'IronPython.Hosting.Python.CreateRuntime();'. The new line should look like ' ScriptEngine pyEng = IronPython.Hosting.Python.CreateRuntime().GetEngine("python");' Let me know if you have any questions or need some information on this. Thanks Sesh -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of M. Whitener Sent: Saturday, December 06, 2008 2:55 PM To: Users at lists.ironpython.com Subject: [IronPython] Examples for calling IronPython from C# Is there a good source of documentation on how to use functions and classes in an IronPython program from C#? I need info on how to do this using C# 3.0 or lower - in other words _not_ using C# 4.0 dynamic types. The only example I have found is a very incomplete one from Alex Turner given at PDC 2008. Thanks in advance. _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From jslutter at reactorzero.com Sun Dec 7 00:33:09 2008 From: jslutter at reactorzero.com (Jeff Slutter) Date: Sat, 06 Dec 2008 18:33:09 -0500 Subject: [IronPython] SourceCodeKind.Statements versus SourceCodeKind.InteractiveCode Message-ID: <493B0BB5.9040408@reactorzero.com> I'm working on getting an interactive script console into my application. Information on how to do this is a bit hard to find but I came across an app.py by Jim Hugunin showing how to do it with Silverlight. I based my C# app around that and have something working pretty well. I'm always using SourceCodeKind.InteractiveCode when compiling the source snippets and it works great. But there is a situation where it doesn't do what I expect. If I pass in the following string: a = 10 + 3; print(a); (note: two statements, separated with a newline) It will give me an error saying that the 'print' is an unexpected token. If I pass in the following string: a = 10 + 3; print(a); It works as expected (printing out 13). It works fine if there are multiple lines for a statement like: if( a > 10 ): print(a); If I use SourceCodeKind.Statements then all of the above works just fine, but I don't get the nice things like the automatic print of the returned value of the statement or the "_" variable. Is there a reason why InteractiveCode does things different like that? I want to give a consistent interface to my users and I think they would expect that they can give two statements at once (especially if they can do it on the same line). I can work around this to get what I want by building up my buffer one line at a time and testing to see if it is a "complete" statement and executing that, then continuing to feed in the next line, etc. But, if I don't have to, I don't want to do that. Any ideas? Thanks Jeff From dinov at microsoft.com Sun Dec 7 00:44:53 2008 From: dinov at microsoft.com (Dino Viehland) Date: Sat, 6 Dec 2008 15:44:53 -0800 Subject: [IronPython] SourceCodeKind.Statements versus SourceCodeKind.InteractiveCode In-Reply-To: <493B0BB5.9040408@reactorzero.com> References: <493B0BB5.9040408@reactorzero.com> Message-ID: <350E7D38B6D819428718949920EC2355564B31B08A@NA-EXMSG-C102.redmond.corp.microsoft.com> This behavior is actually defined by CPython which specs interactive input as being: interactive_input ::= [stmt_list] NEWLINE | compound_stmt NEWLINE The stmt_list allows the semi-colon delinated lines and the compound_stmt allows a single statement. The idea here is that this is for a console input and that there really should be only one statement being entered at a time. We could de-couple the relationship between interactive code & printing expression statements though. Internally they're not really that related so it wouldn't be that hard to do. If that sounds like it'd help you (or if there's others that would like to see it) you could open a feature request on CodePlex. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Jeff Slutter > Sent: Saturday, December 06, 2008 3:33 PM > To: Discussion of IronPython > Subject: [IronPython] SourceCodeKind.Statements versus > SourceCodeKind.InteractiveCode > > I'm working on getting an interactive script console into my > application. Information on how to do this is a bit hard to find but I > came across an app.py by Jim Hugunin showing how to do it with > Silverlight. > > I based my C# app around that and have something working pretty well. > I'm always using SourceCodeKind.InteractiveCode when compiling the > source snippets and it works great. But there is a situation where it > doesn't do what I expect. > > If I pass in the following string: > > a = 10 + 3; > print(a); > > (note: two statements, separated with a newline) > > It will give me an error saying that the 'print' is an unexpected > token. > > If I pass in the following string: > > a = 10 + 3; print(a); > > It works as expected (printing out 13). > > It works fine if there are multiple lines for a statement like: > > if( a > 10 ): > print(a); > > If I use SourceCodeKind.Statements then all of the above works just > fine, but I don't get the nice things like the automatic print of the > returned value of the statement or the "_" variable. > > Is there a reason why InteractiveCode does things different like that? > I > want to give a consistent interface to my users and I think they would > expect that they can give two statements at once (especially if they > can > do it on the same line). > > I can work around this to get what I want by building up my buffer one > line at a time and testing to see if it is a "complete" statement and > executing that, then continuing to feed in the next line, etc. But, if > I > don't have to, I don't want to do that. > > Any ideas? > > Thanks > Jeff > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From mbw.05 at multiparadigm.com Sun Dec 7 03:40:12 2008 From: mbw.05 at multiparadigm.com (M. Whitener) Date: Sat, 06 Dec 2008 19:40:12 -0700 Subject: [IronPython] =?utf-8?q?Examples=5Ffor=5Fcalling=5FIronPython=5Ffr?= =?utf-8?b?b21fIEMj?= Message-ID: <20081206194012.0e377ce7397666338d3aeed6efde40f2.0c6673c3ea.wbe@email.secureserver.net> Sesh, after your changes (below), and replacing using System.Scripting with using Microsoft.Scripting it works! This is great. Thank you. You mentioned that planned to post some code showing how to call python class instance methods. Did you have a chance to do that? Thanks again! -------- Original Message -------- Subject: Re: [IronPython] Examples_for_calling_IronPython_from_ C# From: Seshadri Pillailokam Vijayaraghavan Date: Sat, December 06, 2008 5:02 pm To: Discussion of IronPython See if this helps - http://blogs.msdn.com/seshadripv/archive/2008/06/30/how-to-invoke-a-python-function-from-c-using-the-dlr-hosting-api.aspx However, the sample will not compile as some of the runtime initialization APIs have changed since that sample was posted. To fix this replace the 'ScriptRuntime.Create()' in this line line - 'ScriptEngine pyEng = ScriptRuntime.Create().GetEngine("python");' with 'IronPython.Hosting.Python.CreateRuntime();'. The new line should look like ' ScriptEngine pyEng = IronPython.Hosting.Python.CreateRuntime().GetEngine("python");' Let me know if you have any questions or need some information on this. Thanks Sesh -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of M. Whitener Sent: Saturday, December 06, 2008 2:55 PM To: Users at lists.ironpython.com Subject: [IronPython] Examples for calling IronPython from C# Is there a good source of documentation on how to use functions and classes in an IronPython program from C#? I need info on how to do this using C# 3.0 or lower - in other words _not_ using C# 4.0 dynamic types. The only example I have found is a very incomplete one from Alex Turner given at PDC 2008. Thanks in advance. _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From seshapv at microsoft.com Sun Dec 7 04:41:03 2008 From: seshapv at microsoft.com (Seshadri Pillailokam Vijayaraghavan) Date: Sat, 6 Dec 2008 19:41:03 -0800 Subject: [IronPython] Examples_for_calling_IronPython_from_ C# In-Reply-To: <20081206194012.0e377ce7397666338d3aeed6efde40f2.0c6673c3ea.wbe@email.secureserver.net> References: <20081206194012.0e377ce7397666338d3aeed6efde40f2.0c6673c3ea.wbe@email.secureserver.net> Message-ID: <4F06AAB8EC03C349A5D6D0A797C4881C697E968292@NA-EXMSG-C112.redmond.corp.microsoft.com> >>>Did you have a chance to do that? Not in terms of a blog post... But this example should demonstrate that public void InvokeInstance_Example() { ScriptEngine engine = _runtime.GetEngine("py"); ScriptScope scope = engine.CreateScope(); ObjectOperations operation = engine.CreateOperations(scope); string pyCode = @"class Foo(object): i = -1 def Bar(self): return i"; ScriptSource src = engine.CreateScriptSourceFromString(pyCode, SourceCodeKind.Statements); src.Execute(scope); object FooClass = scope.GetVariable("Foo"); object newObjectInstance = engine.Operations.CreateInstance(FooClass, new object[] { }); // create new FooClass var bar = engine.Operations.GetMember>(newObjectInstance, "Bar"); int n = bar(); Assert.AreEqual(-1, n); } Thanks Sesh -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of M. Whitener Sent: Saturday, December 06, 2008 6:40 PM To: Discussion of IronPython Subject: Re: [IronPython] Examples_for_calling_IronPython_from_ C# Sesh, after your changes (below), and replacing using System.Scripting with using Microsoft.Scripting it works! This is great. Thank you. You mentioned that planned to post some code showing how to call python class instance methods. Did you have a chance to do that? Thanks again! -------- Original Message -------- Subject: Re: [IronPython] Examples_for_calling_IronPython_from_ C# From: Seshadri Pillailokam Vijayaraghavan Date: Sat, December 06, 2008 5:02 pm To: Discussion of IronPython See if this helps - http://blogs.msdn.com/seshadripv/archive/2008/06/30/how-to-invoke-a-python-function-from-c-using-the-dlr-hosting-api.aspx However, the sample will not compile as some of the runtime initialization APIs have changed since that sample was posted. To fix this replace the 'ScriptRuntime.Create()' in this line line - 'ScriptEngine pyEng = ScriptRuntime.Create().GetEngine("python");' with 'IronPython.Hosting.Python.CreateRuntime();'. The new line should look like ' ScriptEngine pyEng = IronPython.Hosting.Python.CreateRuntime().GetEngine("python");' Let me know if you have any questions or need some information on this. Thanks Sesh -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of M. Whitener Sent: Saturday, December 06, 2008 2:55 PM To: Users at lists.ironpython.com Subject: [IronPython] Examples for calling IronPython from C# Is there a good source of documentation on how to use functions and classes in an IronPython program from C#? I need info on how to do this using C# 3.0 or lower - in other words _not_ using C# 4.0 dynamic types. The only example I have found is a very incomplete one from Alex Turner given at PDC 2008. Thanks in advance. _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dan.eloff at gmail.com Sun Dec 7 05:30:01 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Sat, 6 Dec 2008 23:30:01 -0500 Subject: [IronPython] SourceCodeKind.Statements versus SourceCodeKind.InteractiveCode In-Reply-To: <493B0BB5.9040408@reactorzero.com> References: <493B0BB5.9040408@reactorzero.com> Message-ID: <4817b6fc0812062030w4582d862yca74e7f35ec7a8c8@mail.gmail.com> On Sat, Dec 6, 2008 at 6:33 PM, Jeff Slutter wrote: > I'm working on getting an interactive script console into my > application. Information on how to do this is a bit hard to find but I > came across an app.py by Jim Hugunin showing how to do it with Silverlight. You may find http://code.google.com/p/silvershell/ to be of some value, specifically the code in engine.py -Dan From dan.eloff at gmail.com Sun Dec 7 05:51:50 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Sat, 6 Dec 2008 23:51:50 -0500 Subject: [IronPython] SilverShell 0.6.1 Released - many "intellisense" fixes + all source Message-ID: <4817b6fc0812062051j6b13d923teb6a79a8fcdce8a0@mail.gmail.com> I'm trying to walk a fine line between spamming this list, and alerting the 200+ people who downloaded SilverShell 0.6.0 that there's an important new bugfix release. I put a lot of irritating flaws in the "intellisense" to rest, including a major issue with member completion that crept into 0.6.0 at the last minute. Had I known there was going to be such a response I think I would have tested it more thoroughly. As promised all source code is in this release. Please notify me of remaining bugs, either via email, or via the issue tracker on Google Code. Patches are most welcome. Thanks for downloading SilverShell! -Dan From jdhardy at gmail.com Sun Dec 7 15:21:48 2008 From: jdhardy at gmail.com (Jeff Hardy) Date: Sun, 7 Dec 2008 07:21:48 -0700 Subject: [IronPython] CP #20099: Stack Overflow using super() in dict subclass In-Reply-To: <350E7D38B6D819428718949920EC2355564B31B088@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <350E7D38B6D819428718949920EC2355564B31B088@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: On Sat, Dec 6, 2008 at 2:16 PM, Dino Viehland wrote: > The immediate question would be does fixing this unblock all other Django issues? If there's going to be a long tail of other bugs then it'd be better to just fix them all for 2.0.1. I doubt it, if past experience is anything to go by. I'll see what happens when I apply the fix, but there are probably more bugs like this lurking in there. > > If you want to try this out the fix is easy, in PythonDictionary.cs replace the line: > > this[(object)null] = value; > > with: > > _storage.Add(null, value); > > > You'll probably find that alone isn't sufficient - the getter probably needs a similar change where it does the same thing as this[object key]. If the fix is that simple, I'm fine using a custom build for testing. I was afraid the fix was going to be much more involved. Thanks for looking into this so quickly! - Jeff From miha.valencic at gmail.com Sun Dec 7 18:02:22 2008 From: miha.valencic at gmail.com (Miha Valencic) Date: Sun, 7 Dec 2008 18:02:22 +0100 Subject: [IronPython] NWSGI 0.7 released In-Reply-To: References: <233dfa1d0812050011v1ac776a8q72f82853f18ea353@mail.gmail.com> Message-ID: <233dfa1d0812070902q7e1bbf2bxa936b7cfefe317ad@mail.gmail.com> Thanks for the info. Miha 2008/12/6 Jeff Hardy > Hi Miha, > As Dan said, there are issues with str == unicode (although there is a > [...] -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Sun Dec 7 20:02:10 2008 From: dinov at microsoft.com (Dino Viehland) Date: Sun, 7 Dec 2008 11:02:10 -0800 Subject: [IronPython] Last source drop was Nov 30. Is something broken? In-Reply-To: <4817b6fc0812060538u4c89864apb4a945da5fbd1695@mail.gmail.com> References: <4817b6fc0812060538u4c89864apb4a945da5fbd1695@mail.gmail.com> Message-ID: <350E7D38B6D819428718949920EC2355564B31B0CC@NA-EXMSG-C102.redmond.corp.microsoft.com> Something went wrong on the machine that pushes the source code out and then there were some changes that required the script to be updated. It's working now and pushed out an update yesterday. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Dan Eloff > Sent: Saturday, December 06, 2008 5:39 AM > To: Discussion of IronPython > Subject: [IronPython] Last source drop was Nov 30. Is something broken? > > Just eager to get my hands on the latest code. > > -Dan > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From sanxiyn at gmail.com Sun Dec 7 22:52:15 2008 From: sanxiyn at gmail.com (Seo Sanghyeon) Date: Mon, 8 Dec 2008 06:52:15 +0900 Subject: [IronPython] Unused files Message-ID: <5b0248170812071352t4221ce3at75c7b57f79bbc1fa@mail.gmail.com> Following files seem to be unused but are included in 2.0 RC2 source. Please remove them before the final release... Microsoft.Scripting.Core/Actions/RestrictedMetaObject.cs Microsoft.Scripting.Core/Ast/ExpressionTreeVisitor.Generated.cs Microsoft.Scripting.Core/Ast/LabeledStatement.cs Microsoft.Scripting.Core/Com/MetaUnwrappedComObject.cs IronPython/Runtime/Binding/IPythonCallable.cs IronPython/Runtime/ThreadLocal.cs Thanks, -- Seo Sanghyeon From dan.eloff at gmail.com Mon Dec 8 00:00:19 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Sun, 7 Dec 2008 18:00:19 -0500 Subject: [IronPython] Last source drop was Nov 30. Is something broken? In-Reply-To: <350E7D38B6D819428718949920EC2355564B31B0CC@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <4817b6fc0812060538u4c89864apb4a945da5fbd1695@mail.gmail.com> <350E7D38B6D819428718949920EC2355564B31B0CC@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <4817b6fc0812071500k7d5588aejd74da1ac10eee614@mail.gmail.com> On Sun, Dec 7, 2008 at 2:02 PM, Dino Viehland wrote: > Something went wrong on the machine that pushes the source code out and then there were some changes that required the script to be updated. It's working now and pushed out an update yesterday. > Excellent. *rubs hands together gleefully* It's almost like Christmas when I get a new source drop. -Dan From sanxiyn at gmail.com Mon Dec 8 06:10:03 2008 From: sanxiyn at gmail.com (Seo Sanghyeon) Date: Mon, 8 Dec 2008 14:10:03 +0900 Subject: [IronPython] IronPython 2.0 RC 2 on Mono Message-ID: <5b0248170812072110j6a2694c8v8f221a9575cf1f22@mail.gmail.com> Currently you need Mono SVN (both to run and to compile). Using SVN r120972 below. The binary runs fine. IronPython includes its own copy of ExtensionAttribute, but this doesn't seem to work with Mono C# compiler: that is, extension methods don't get recognized as extension methods. This causes trouble where MetaObject is defined in Microsoft.Scripting.Core.dll, and its extensions are defined in MetaObjectExtensions in Microsoft.Scripting.dll. My hack below copies MetaObjectExtensions and its dependencies to Microsoft.Scripting.Core and patch it to be a partial class instead of a static class housing extension methods. Any better idea? Also there are some unused files in the source distribution. Below are steps I used to compile the source on Mono. Download source from http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=19841 $ unzip IronPython-2.0-Src.zip $ cd IronPython-2.0 Some hacks... $ svn co -r 597 https://fepy.svn.sourceforge.net/svnroot/fepy/trunk/patches/latest build This deletes unused files and does copying mentioned above $ sh build/pre.sh Copies NAnt build file: it uses noconfig to avoid pulling System.Core.dll $ cp build/IronPython.build Src Patches $ patch -p1 < build/patch-exthack $ patch -p1 < build/patch-console Build $ cd Src $ nant -- Seo Sanghyeon From glenn.k.jones+ipy at gmail.com Mon Dec 8 12:40:25 2008 From: glenn.k.jones+ipy at gmail.com (Glenn Jones) Date: Mon, 8 Dec 2008 11:40:25 +0000 Subject: [IronPython] Compiled IronPython mixed with source files Message-ID: <2679f6510812080340v5ef072f3td5b638fc516ffb8a@mail.gmail.com> Hi all, In our work to get Resolver One working on IronPython 2, we've noticed this interesting behaviour and would like to know whether it's defined behaviour that we can rely on or just happenstance. Create a package with the following structure: + foo |----__init__.py |----foo.py where foo.py contains print "foo (compiled)" and compile it to foo.dll. Now change foo.py to print "foo (not compiled)" and add a bar package: + foo |----__init__.py |----foo.py |---+ bar |--- __init__.py |--- bar.py where bar contains: print "bar (not compiled)" then, the following code: import clr clr.AddReference('foo') from foo import foo from foo.bar import bar outputs: foo(compiled) bar (not compiled) and removing the AddReference line outputs: foo (not compiled) bar (not compiled) This makes it clear that we can have a package that is split between compiled dll and source and that they work together. Can we rely on this behaviour? Is there a specified order in which imports from different sources are resolved? How is the multiple identity of the foo module (compiled and not compiled) handled? Thanks Glenn & Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Mon Dec 8 18:50:56 2008 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 8 Dec 2008 09:50:56 -0800 Subject: [IronPython] Compiled IronPython mixed with source files In-Reply-To: <2679f6510812080340v5ef072f3td5b638fc516ffb8a@mail.gmail.com> References: <2679f6510812080340v5ef072f3td5b638fc516ffb8a@mail.gmail.com> Message-ID: <350E7D38B6D819428718949920EC2355564B31B25C@NA-EXMSG-C102.redmond.corp.microsoft.com> I think you can depend upon this behavior. Compiled loader support is implemented as a meta path hook and therefore the pure Python version of this looks like: import sys class my_loader(object): def find_module(self, fullname, path): print 'find', fullname if fullname == 'foo': return module_loader() class module_loader(object): def load_module(self, fullname): print 'load', fullname if fullname == 'foo': res = __import__('x') sys.modules['foo'] = res res.__name__ = 'foo' res.__path__ = ['foo'] return res sys.meta_path.append(my_loader()) from foo import foo from foo.bar import bar On disk x is a package which has your 1st package structure, foo is a package which has your 2nd package structure. The loader hook in this case is importing x, renaming it to foo, and then it doesn't resolve foo.bar. That turns into a full lookup and the importer rules dictate that we'll happily look on disk because foo appears to be a parent package. This outputs the same on CPython and IronPython so I'm pretty sure we're correct here :) As to the identity of the modules - the compiled modules always win because the meta path hooks get to execute first. So you'll only ever successfully import compiled modules if they exist. So while you can augment an existing package you cannot replace files from it. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Glenn Jones Sent: Monday, December 08, 2008 3:40 AM To: Discussion of IronPython Subject: [IronPython] Compiled IronPython mixed with source files Hi all, In our work to get Resolver One working on IronPython 2, we've noticed this interesting behaviour and would like to know whether it's defined behaviour that we can rely on or just happenstance. Create a package with the following structure: + foo |----__init__.py |----foo.py where foo.py contains print "foo (compiled)" and compile it to foo.dll. Now change foo.py to print "foo (not compiled)" and add a bar package: + foo |----__init__.py |----foo.py |---+ bar |--- __init__.py |--- bar.py where bar contains: print "bar (not compiled)" then, the following code: import clr clr.AddReference('foo') from foo import foo from foo.bar import bar outputs: foo(compiled) bar (not compiled) and removing the AddReference line outputs: foo (not compiled) bar (not compiled) This makes it clear that we can have a package that is split between compiled dll and source and that they work together. Can we rely on this behaviour? Is there a specified order in which imports from different sources are resolved? How is the multiple identity of the foo module (compiled and not compiled) handled? Thanks Glenn & Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Mon Dec 8 18:54:03 2008 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 8 Dec 2008 09:54:03 -0800 Subject: [IronPython] IronPython 2.0 RC 2 on Mono In-Reply-To: <5b0248170812072110j6a2694c8v8f221a9575cf1f22@mail.gmail.com> References: <5b0248170812072110j6a2694c8v8f221a9575cf1f22@mail.gmail.com> Message-ID: <350E7D38B6D819428718949920EC2355564B31B262@NA-EXMSG-C102.redmond.corp.microsoft.com> Thanks for doing this Seo! I think we'll remove the extra source files before we release 2.0 final. If you haven't already I would suggest reporting a bug to Mono about the extension attribute. Both MS's VB & C# compilers support recognizing it from an arbitrary assembly so it seems like a common pattern. Unfortunately I don't have any better suggestions. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Seo Sanghyeon Sent: Sunday, December 07, 2008 9:10 PM To: Discussion of IronPython Subject: [IronPython] IronPython 2.0 RC 2 on Mono Currently you need Mono SVN (both to run and to compile). Using SVN r120972 below. The binary runs fine. IronPython includes its own copy of ExtensionAttribute, but this doesn't seem to work with Mono C# compiler: that is, extension methods don't get recognized as extension methods. This causes trouble where MetaObject is defined in Microsoft.Scripting.Core.dll, and its extensions are defined in MetaObjectExtensions in Microsoft.Scripting.dll. My hack below copies MetaObjectExtensions and its dependencies to Microsoft.Scripting.Core and patch it to be a partial class instead of a static class housing extension methods. Any better idea? Also there are some unused files in the source distribution. Below are steps I used to compile the source on Mono. Download source from http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=19841 $ unzip IronPython-2.0-Src.zip $ cd IronPython-2.0 Some hacks... $ svn co -r 597 https://fepy.svn.sourceforge.net/svnroot/fepy/trunk/patches/latest build This deletes unused files and does copying mentioned above $ sh build/pre.sh Copies NAnt build file: it uses noconfig to avoid pulling System.Core.dll $ cp build/IronPython.build Src Patches $ patch -p1 < build/patch-exthack $ patch -p1 < build/patch-console Build $ cd Src $ nant -- Seo Sanghyeon _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From yashgt at gmail.com Tue Dec 9 14:59:22 2008 From: yashgt at gmail.com (Yash Ganthe) Date: Tue, 9 Dec 2008 19:29:22 +0530 Subject: [IronPython] IronPython Studio and IronPython 2.0 Message-ID: <4f428e7b0812090559l381860f4pe344a564fc721214@mail.gmail.com> I use IPY 2.0 RC2. I would like to debug through the code in Visual Studio. Can IronPython Studio be configured to use IPY 2.0? Thanks, Yash -------------- next part -------------- An HTML attachment was scrubbed... URL: From glenn.k.jones+ipy at gmail.com Tue Dec 9 17:37:04 2008 From: glenn.k.jones+ipy at gmail.com (Glenn Jones) Date: Tue, 9 Dec 2008 16:37:04 +0000 Subject: [IronPython] subclasses of list with __mul__ defined Message-ID: <2679f6510812090837o2460a6d8m370441f9dddc12ef@mail.gmail.com> Hi guys, Another issue from our upgrade to IPy2: class thing(list): def __init__(self, value): self.value = value def __mul__(self, other): return self.value * other t1 = thing(3.0) print t1 * 3.0 results in: Traceback (most recent call last): File "testmat.py", line 12, in testmat.py File "Microsoft.Scripting.Core", line unknown, in New File "Microsoft.Scripting.Core", line unknown, in New File "Microsoft.Scripting.Core", line unknown, in ValidateArgumentTypes ValueError: Expression of type 'System.Double' cannot be used for constructor parameter of type 'System.Object' This has the potential to cause us significant pain since a third-party (pure python) library that we use relies on this behaving correctly. We'll raise this as a bug on codeplex. Thanks Glenn & Tom -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Wed Dec 10 00:27:45 2008 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 9 Dec 2008 15:27:45 -0800 Subject: [IronPython] IronPython Studio and IronPython 2.0 In-Reply-To: <4f428e7b0812090559l381860f4pe344a564fc721214@mail.gmail.com> References: <4f428e7b0812090559l381860f4pe344a564fc721214@mail.gmail.com> Message-ID: <350E7D38B6D819428718949920EC2355564B31BB5F@NA-EXMSG-C102.redmond.corp.microsoft.com> I don't believe there is right now w/o a bunch of work to update to the new 2.0 hosting APIs. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Yash Ganthe Sent: Tuesday, December 09, 2008 5:59 AM To: users at lists.ironpython.com Subject: [IronPython] IronPython Studio and IronPython 2.0 I use IPY 2.0 RC2. I would like to debug through the code in Visual Studio. Can IronPython Studio be configured to use IPY 2.0? Thanks, Yash -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Wed Dec 10 00:43:29 2008 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 9 Dec 2008 15:43:29 -0800 Subject: [IronPython] subclasses of list with __mul__ defined In-Reply-To: <2679f6510812090837o2460a6d8m370441f9dddc12ef@mail.gmail.com> References: <2679f6510812090837o2460a6d8m370441f9dddc12ef@mail.gmail.com> Message-ID: <350E7D38B6D819428718949920EC2355564B31BB74@NA-EXMSG-C102.redmond.corp.microsoft.com> The fix for this is pretty simple. It's going into 2.1 as we speak, and I'll port it back to the 2.0.x branch. Unfortunately at this point I don't think it'll make it into 2.0 final. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Glenn Jones Sent: Tuesday, December 09, 2008 8:37 AM To: Discussion of IronPython Subject: [IronPython] subclasses of list with __mul__ defined Hi guys, Another issue from our upgrade to IPy2: class thing(list): def __init__(self, value): self.value = value def __mul__(self, other): return self.value * other t1 = thing(3.0) print t1 * 3.0 results in: Traceback (most recent call last): File "testmat.py", line 12, in testmat.py File "Microsoft.Scripting.Core", line unknown, in New File "Microsoft.Scripting.Core", line unknown, in New File "Microsoft.Scripting.Core", line unknown, in ValidateArgumentTypes ValueError: Expression of type 'System.Double' cannot be used for constructor parameter of type 'System.Object' This has the potential to cause us significant pain since a third-party (pure python) library that we use relies on this behaving correctly. We'll raise this as a bug on codeplex. Thanks Glenn & Tom -------------- next part -------------- An HTML attachment was scrubbed... URL: From sanxiyn at gmail.com Wed Dec 10 11:39:35 2008 From: sanxiyn at gmail.com (Seo Sanghyeon) Date: Wed, 10 Dec 2008 19:39:35 +0900 Subject: [IronPython] Invalid construct in DLR's MSBuild file? Message-ID: <5b0248170812100239i2abe78fby4c6c20a7fef6daef@mail.gmail.com> Hello, now I am trying to use xbuild (open source implementation of MSBuild language) to build IronPython, and the first error (after instrumenting the source to make it clear what the error is) is this: $ xbuild Microsoft.Scripting.ExtensionAttribute.csproj XBuild Engine Version 0.1 Mono, Version 2.3.0.0 Copyright (C) Marek Sieradzki 2005. All rights reserved. ConditionParser failed to parse $(SilverlightBuild) != 'true' Unhandled Exception: Microsoft.Build.BuildEngine.InvalidProjectFileException: The requested feature is not implemented. ---> System.NotImplementedException: The requested feature is not implemented. at Microsoft.Build.BuildEngine.ConditionParser.ParseFactorExpression () [0x00000] at Microsoft.Build.BuildEngine.ConditionParser.ParseRelationalExpression () [0x00000] at Microsoft.Build.BuildEngine.ConditionParser.ParseBooleanOr () [0x00000] at Microsoft.Build.BuildEngine.ConditionParser.ParseBooleanAnd () [0x00000] at Microsoft.Build.BuildEngine.ConditionParser.ParseBooleanExpression () [0x00000] at Microsoft.Build.BuildEngine.ConditionParser.ParseExpression () [0x00000] at Microsoft.Build.BuildEngine.ConditionParser.ParseCondition (System.String condition) [0x00000] --- End of inner exception stack trace --- at Microsoft.Build.BuildEngine.Project.DoLoad (System.IO.TextReader textReader) [0x00000] at Microsoft.Build.BuildEngine.Project.Load (System.String projectFileName) [0x00000] at Mono.XBuild.CommandLine.MainClass.Execute () [0x00000] According to MSDN, MSBuild Conditions http://msdn.microsoft.com/en-us/library/7szfhaft.aspx conditions should be of the form 'stringA' != 'stringB', where "single quotes are not required for simple alphanumeric strings or boolean values". Is $(SilverlightBuild) this case? If it isn't, shouldn't it be quoted as '$(SilverlightBuild)'? If I manually change this condition to be quoted (I also note, all other uses of $(SilverlightBuild) is actually quoted in this file), xbuild builds this assembly successfully. Even if this is actually valid (then I argue documentation is confusing), I think it would be a good idea to quote this anyway. -- Seo Sanghyeon From fuzzyman at voidspace.org.uk Wed Dec 10 14:12:21 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Wed, 10 Dec 2008 13:12:21 +0000 Subject: [IronPython] IronPython Studio and IronPython 2.0 In-Reply-To: <350E7D38B6D819428718949920EC2355564B31BB5F@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <4f428e7b0812090559l381860f4pe344a564fc721214@mail.gmail.com> <350E7D38B6D819428718949920EC2355564B31BB5F@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <493FC035.30607@voidspace.org.uk> Dino Viehland wrote: > > I don?t believe there is right now w/o a bunch of work to update to > the new 2.0 hosting APIs. > IronPython Studio has looked suspiciously like abandonware pretty much ever since its release. Michael > *From:* users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Yash Ganthe > *Sent:* Tuesday, December 09, 2008 5:59 AM > *To:* users at lists.ironpython.com > *Subject:* [IronPython] IronPython Studio and IronPython 2.0 > > I use IPY 2.0 RC2. I would like to debug through the code in Visual > Studio. Can IronPython Studio be configured to use IPY 2.0? > > Thanks, > Yash > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From guy at rzn.co.il Wed Dec 10 19:04:15 2008 From: guy at rzn.co.il (Guy Rozendorn) Date: Wed, 10 Dec 2008 20:04:15 +0200 Subject: [IronPython] Questions about compiled .py files - their stub exe and dlls Message-ID: <843870680812101004s537b627am8275da5b1273fbd9@mail.gmail.com> Hi, I have a question about compiled python files with the pyc.py example. I read that the dll must exist from the directory from which the executable is executed. For example, let's say I compiled my code to: myProg.exe myProgr.dll and they both reside in C:\Temp\myProg.exe, along with IronPython.dll and IronPythonModules.dll If I try to execute myProg.exe from any other directory (i.e - I'm in C:\Windows, and running C:\Temp\myProg.exe), I get the following error: Unhandled Exception: System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT : 0x80070002) at System.Reflection.Assembly.nLoadFile(String path, Evidence evidence) at System.Reflection.Assembly.LoadFile(String path) at PythonMain.Main() What do I need to do to make myProg.exe run from anywhere? Specfically, this bothers me because in deploying Windows Services wriiten in IronPython. Let's say I just compiled myService.exe, along with myService.dll, and they're both in C:\Temp (along with IronPython DLLs). After I register the service, it fails to start, since the current directory of the services.exe (who executes myService.exe) is %SystemRoot%\system32 If I put myService.dll in the system32 directory, the service works. But I don't want to put myService.dll in system32 (and many more dlls that I use). So, my question is: * Can I make the magic that will cause myService.exe/myProg.exe to look for its DLL inside the directory in which he resides in (and not the current directory)? * It is possible to include myService.dll and IronPython.dll and IronPythonModules.dll inside myService.exe (so I could do import sys and then append to path which ever directries I wish for)? Thanks, Guy -------------- next part -------------- An HTML attachment was scrubbed... URL: From dfugate at microsoft.com Wed Dec 10 22:19:18 2008 From: dfugate at microsoft.com (Dave Fugate) Date: Wed, 10 Dec 2008 13:19:18 -0800 Subject: [IronPython] Announcing IronPython 2.0 Message-ID: Hello Python Community, The IronPython and Dynamic Language Runtime teams are proud to announce the release of IronPython 2.0 final. IronPython 2.0 is the culmination of nearly two years worth of work resulting in a CPython 2.5 compatible release on .NET 2.0 SP1. By far, the biggest change to 2.0 is that our 1.1 codebase was refactored to run on top of the Dynamic Language Runtime. With this we automatically get improvements in many feature areas such as better .NET interop support and hosting Python from managed code. There have been many other major improvements as well. The most notable are: * An MSI installer for Windows platforms which includes parts of the CPython 2.5 standard library * IronPython assemblies targeting Silverlight and tools such as Chiron to improve the Silverlight dynamic development experience * The addition of more C-based standard modules such as cmath and _winreg * Significant improvements in importing compatibility and features * Distribution of IronPython under the Microsoft Public License which has been approved by OSI * Performance improvements. On that note, a new Wiki page has been created for IronPython performance reports - see http://www.codeplex.com/IronPython/Wiki/View.aspx?title=IronPython%20Performance * Over 500 bugs have been closed in 2.0. 453 of these were reported on CodePlex * Support for precompilation of Python source files into a single dll This seems like an opportune time to remind everyone that we fix bugs based on the number of votes they have on CodePlex. As we're planning on releasing IronPython 2.0.1 fairly soon, please vote for your favorite bugs at http://www.codeplex.com/IronPython/WorkItem/AdvancedList.aspx to help ensure they get fixed in time for the next release. We'd like to extend our gratitude to everyone in the IronPython community who reported bugs thereby making this a better release: milind, romank, chadaustin, sjmachin, davidfraser, TimothyFitz, drewid, sanxiyn, bashmohandes, pobrien, perhaps, haypo, Undebtedly, ayarrow, tscottw_cp, rope, arman0, eshaish, nivaldo, fuzzyman, CurtHagenlocher, Eloff, brucec, py_sunil, jacobg23, mziller, beaugunderson, gbraad, Oceanborn, tarlano, jbevain, glchapman, anthonybaxter, jdhardy, jjlee, haibo, doubleyewdee, jackeyoo, whit537, sdahlbac, PeteHufnagel, jtenney, nriley, junfeng, grizlupo, rridge, lewisle, JoelBondurant, johnplatt, lthompson, debackerl, googen, tscottw, VoteFw, leppie, Qvin, heyssion2, CriGoT, baxeno, sbergman, Laurion, luntain, oldman, christmas, 05031972, kevgu, wilberforce, Korbinian, lclj, sorokerr, Eriol, tatwright, ais, TraumaPony, pelikhan, asafk, felixpollan, srid, atifaziz, vernondcole, fwereade, zpy, yanne, facorreia, Daneel, zvikag, psykotic, Cavingdeep, BEaton, sborde, orbital56, fbourgeois, antont, krosavcheg, ktc1, awilkins, ben2004uk, paulfelix, axl, JeffreySax, Lawouach, and KKI. You can download IronPython 2.0 at: http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=8365 The IronPython Team BTW Updates to the IronPython 1.0 samples will be released shortly. Stay tuned to the IronPython mailing list for details. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dfugate at microsoft.com Wed Dec 10 22:50:41 2008 From: dfugate at microsoft.com (Dave Fugate) Date: Wed, 10 Dec 2008 13:50:41 -0800 Subject: [IronPython] Unused files In-Reply-To: <5b0248170812071352t4221ce3at75c7b57f79bbc1fa@mail.gmail.com> References: <5b0248170812071352t4221ce3at75c7b57f79bbc1fa@mail.gmail.com> Message-ID: Done and this ended up being the only change we took in for IP 2.0 final. The change should be live on CodePlex's source repository in a few minutes. Thanks, Dave -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Seo Sanghyeon Sent: Sunday, December 07, 2008 1:52 PM To: Discussion of IronPython Subject: [IronPython] Unused files Following files seem to be unused but are included in 2.0 RC2 source. Please remove them before the final release... Microsoft.Scripting.Core/Actions/RestrictedMetaObject.cs Microsoft.Scripting.Core/Ast/ExpressionTreeVisitor.Generated.cs Microsoft.Scripting.Core/Ast/LabeledStatement.cs Microsoft.Scripting.Core/Com/MetaUnwrappedComObject.cs IronPython/Runtime/Binding/IPythonCallable.cs IronPython/Runtime/ThreadLocal.cs Thanks, -- Seo Sanghyeon _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From sh at defuze.org Wed Dec 10 22:53:35 2008 From: sh at defuze.org (Sylvain Hellegouarch) Date: Wed, 10 Dec 2008 22:53:35 +0100 Subject: [IronPython] Announcing IronPython 2.0 In-Reply-To: References: Message-ID: <49403A5F.2000903@defuze.org> Congratulations to everyone who made it happen. That's fantastic news :) - Sylvain Dave Fugate a ?crit : > > Hello Python Community, > > The IronPython and Dynamic Language Runtime teams are proud to > announce the release of IronPython 2.0 final. IronPython 2.0 is the > culmination of nearly two years worth of work resulting in a CPython > 2.5 compatible release on .NET 2.0 SP1. By far, the biggest change to > 2.0 is that our 1.1 codebase was refactored to run on top of the > Dynamic Language Runtime . With this we > automatically get improvements in many feature areas such as better > .NET interop support and hosting Python from managed code. There have > been many other major improvements as well. The most notable are: > > ? An MSI installer for Windows platforms which includes parts of the > CPython 2.5 standard library > > ? IronPython assemblies targeting Silverlight and tools such as Chiron > to improve the Silverlight dynamic development experience > > ? The addition of more C-based standard modules such as /cmath/ and > /_winreg/ > > ? Significant improvements in importing compatibility and features > > ? Distribution of IronPython under the Microsoft Public License which > has been approved by OSI > > ? Performance improvements. On that note, a new Wiki page has been > created for IronPython performance reports - see > http://www.codeplex.com/IronPython/Wiki/View.aspx?title=IronPython%20Performance > > ? Over 500 bugs have been closed in 2.0. 453 of these were reported on > CodePlex > > ? Support for precompilation of Python source files into a single dll > > This seems like an opportune time to remind everyone that we fix bugs > based on the number of votes they have on CodePlex. As we?re planning > on releasing IronPython 2.0.1 fairly soon, please vote for your > favorite bugs at > http://www.codeplex.com/IronPython/WorkItem/AdvancedList.aspx to help > ensure they get fixed in time for the next release. > > We?d like to extend our gratitude to everyone in the IronPython > community who reported bugs thereby making this a better release: > milind, romank, chadaustin, sjmachin, davidfraser, TimothyFitz, > drewid, sanxiyn, bashmohandes, pobrien, perhaps, haypo, Undebtedly, > ayarrow, tscottw_cp, rope, arman0, eshaish, nivaldo, fuzzyman, > CurtHagenlocher, Eloff, brucec, py_sunil, jacobg23, mziller, > beaugunderson, gbraad, Oceanborn, tarlano, jbevain, glchapman, > anthonybaxter, jdhardy, jjlee, haibo, doubleyewdee, jackeyoo, whit537, > sdahlbac, PeteHufnagel, jtenney, nriley, junfeng, grizlupo, rridge, > lewisle, JoelBondurant, johnplatt, lthompson, debackerl, googen, > tscottw, VoteFw, leppie, Qvin, heyssion2, CriGoT, baxeno, sbergman, > Laurion, luntain, oldman, christmas, 05031972, kevgu, wilberforce, > Korbinian, lclj, sorokerr, Eriol, tatwright, ais, TraumaPony, > pelikhan, asafk, felixpollan, srid, atifaziz, vernondcole, fwereade, > zpy, yanne, facorreia, Daneel, zvikag, psykotic, Cavingdeep, BEaton, > sborde, orbital56, fbourgeois, antont, krosavcheg, ktc1, awilkins, > ben2004uk, paulfelix, axl, JeffreySax, Lawouach, and KKI. > > You can download IronPython 2.0 at: > http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=8365 > > The IronPython Team > > BTW > > Updates to the IronPython 1.0 samples will be released shortly. Stay > tuned to the IronPython mailing list for details. > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From nytrokiss at gmail.com Wed Dec 10 22:58:08 2008 From: nytrokiss at gmail.com (James Matthews) Date: Wed, 10 Dec 2008 23:58:08 +0200 Subject: [IronPython] Announcing IronPython 2.0 In-Reply-To: <49403A5F.2000903@defuze.org> References: <49403A5F.2000903@defuze.org> Message-ID: <8a6b8e350812101358g41a89489j80405e3e106136b4@mail.gmail.com> I agree, I am now downloading and installing it!! On Wed, Dec 10, 2008 at 11:53 PM, Sylvain Hellegouarch wrote: > Congratulations to everyone who made it happen. That's fantastic news :) > > - Sylvain > > Dave Fugate a ?crit : > >> >> Hello Python Community, >> >> The IronPython and Dynamic Language Runtime teams are proud to announce >> the release of IronPython 2.0 final. IronPython 2.0 is the culmination of >> nearly two years worth of work resulting in a CPython 2.5 compatible release >> on .NET 2.0 SP1. By far, the biggest change to 2.0 is that our 1.1 codebase >> was refactored to run on top of the Dynamic Language Runtime < >> http://www.codeplex.com/dlr>. With this we automatically get improvements >> in many feature areas such as better .NET interop support and hosting Python >> from managed code. There have been many other major improvements as well. >> The most notable are: >> >> ? An MSI installer for Windows platforms which includes parts of the >> CPython 2.5 standard library >> >> ? IronPython assemblies targeting Silverlight and tools such as Chiron to >> improve the Silverlight dynamic development experience >> >> ? The addition of more C-based standard modules such as /cmath/ and >> /_winreg/ >> >> ? Significant improvements in importing compatibility and features >> >> ? Distribution of IronPython under the Microsoft Public License which has >> been approved by OSI >> >> ? Performance improvements. On that note, a new Wiki page has been created >> for IronPython performance reports - see >> http://www.codeplex.com/IronPython/Wiki/View.aspx?title=IronPython%20Performance >> >> ? Over 500 bugs have been closed in 2.0. 453 of these were reported on >> CodePlex >> >> ? Support for precompilation of Python source files into a single dll >> >> This seems like an opportune time to remind everyone that we fix bugs >> based on the number of votes they have on CodePlex. As we're planning on >> releasing IronPython 2.0.1 fairly soon, please vote for your favorite bugs >> at http://www.codeplex.com/IronPython/WorkItem/AdvancedList.aspx to help >> ensure they get fixed in time for the next release. >> >> We'd like to extend our gratitude to everyone in the IronPython community >> who reported bugs thereby making this a better release: milind, romank, >> chadaustin, sjmachin, davidfraser, TimothyFitz, drewid, sanxiyn, >> bashmohandes, pobrien, perhaps, haypo, Undebtedly, ayarrow, tscottw_cp, >> rope, arman0, eshaish, nivaldo, fuzzyman, CurtHagenlocher, Eloff, brucec, >> py_sunil, jacobg23, mziller, beaugunderson, gbraad, Oceanborn, tarlano, >> jbevain, glchapman, anthonybaxter, jdhardy, jjlee, haibo, doubleyewdee, >> jackeyoo, whit537, sdahlbac, PeteHufnagel, jtenney, nriley, junfeng, >> grizlupo, rridge, lewisle, JoelBondurant, johnplatt, lthompson, debackerl, >> googen, tscottw, VoteFw, leppie, Qvin, heyssion2, CriGoT, baxeno, sbergman, >> Laurion, luntain, oldman, christmas, 05031972, kevgu, wilberforce, >> Korbinian, lclj, sorokerr, Eriol, tatwright, ais, TraumaPony, pelikhan, >> asafk, felixpollan, srid, atifaziz, vernondcole, fwereade, zpy, yanne, >> facorreia, Daneel, zvikag, psykotic, Cavingdeep, BEaton, sborde, orbital56, >> fbourgeois, antont, krosavcheg, ktc1, awilkins, ben2004uk, paulfelix, axl, >> JeffreySax, Lawouach, and KKI. >> >> You can download IronPython 2.0 at: >> http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=8365 >> >> The IronPython Team >> >> BTW >> >> Updates to the IronPython 1.0 samples will be released shortly. Stay tuned >> to the IronPython mailing list for details. >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.goldwatches.com/ http://www.jewelerslounge.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From giles.thomas at resolversystems.com Thu Dec 11 00:48:28 2008 From: giles.thomas at resolversystems.com (Giles Thomas) Date: Wed, 10 Dec 2008 23:48:28 +0000 Subject: [IronPython] Announcing IronPython 2.0 In-Reply-To: <8a6b8e350812101358g41a89489j80405e3e106136b4@mail.gmail.com> References: <49403A5F.2000903@defuze.org> <8a6b8e350812101358g41a89489j80405e3e106136b4@mail.gmail.com> Message-ID: <4940554C.30705@resolversystems.com> Thirded, well done to all! James Matthews wrote: > I agree, I am now downloading and installing it!! > > On Wed, Dec 10, 2008 at 11:53 PM, Sylvain Hellegouarch > wrote: > > Congratulations to everyone who made it happen. That's fantastic > news :) > > - Sylvain > > Dave Fugate a ?crit : > > > Hello Python Community, > > The IronPython and Dynamic Language Runtime teams are proud to > announce the release of IronPython 2.0 final. IronPython 2.0 > is the culmination of nearly two years worth of work resulting > in a CPython 2.5 compatible release on .NET 2.0 SP1. By far, > the biggest change to 2.0 is that our 1.1 codebase was > refactored to run on top of the Dynamic Language Runtime > . With this we automatically get > improvements in many feature areas such as better .NET interop > support and hosting Python from managed code. There have been > many other major improvements as well. The most notable are: > > > ? An MSI installer for Windows platforms which includes parts > of the CPython 2.5 standard library > > ? IronPython assemblies targeting Silverlight and tools such > as Chiron to improve the Silverlight dynamic development > experience > > ? The addition of more C-based standard modules such as > /cmath/ and /_winreg/ > > ? Significant improvements in importing compatibility and features > > ? Distribution of IronPython under the Microsoft Public > License which has been approved by OSI > > ? Performance improvements. On that note, a new Wiki page has > been created for IronPython performance reports - see > http://www.codeplex.com/IronPython/Wiki/View.aspx?title=IronPython%20Performance > > ? Over 500 bugs have been closed in 2.0. 453 of these were > reported on CodePlex > > ? Support for precompilation of Python source files into a > single dll > > This seems like an opportune time to remind everyone that we > fix bugs based on the number of votes they have on CodePlex. > As we're planning on releasing IronPython 2.0.1 fairly soon, > please vote for your favorite bugs at > http://www.codeplex.com/IronPython/WorkItem/AdvancedList.aspx > to help ensure they get fixed in time for the next release. > > We'd like to extend our gratitude to everyone in the > IronPython community who reported bugs thereby making this a > better release: milind, romank, chadaustin, sjmachin, > davidfraser, TimothyFitz, drewid, sanxiyn, bashmohandes, > pobrien, perhaps, haypo, Undebtedly, ayarrow, tscottw_cp, > rope, arman0, eshaish, nivaldo, fuzzyman, CurtHagenlocher, > Eloff, brucec, py_sunil, jacobg23, mziller, beaugunderson, > gbraad, Oceanborn, tarlano, jbevain, glchapman, anthonybaxter, > jdhardy, jjlee, haibo, doubleyewdee, jackeyoo, whit537, > sdahlbac, PeteHufnagel, jtenney, nriley, junfeng, grizlupo, > rridge, lewisle, JoelBondurant, johnplatt, lthompson, > debackerl, googen, tscottw, VoteFw, leppie, Qvin, heyssion2, > CriGoT, baxeno, sbergman, Laurion, luntain, oldman, christmas, > 05031972, kevgu, wilberforce, Korbinian, lclj, sorokerr, > Eriol, tatwright, ais, TraumaPony, pelikhan, asafk, > felixpollan, srid, atifaziz, vernondcole, fwereade, zpy, > yanne, facorreia, Daneel, zvikag, psykotic, Cavingdeep, > BEaton, sborde, orbital56, fbourgeois, antont, krosavcheg, > ktc1, awilkins, ben2004uk, paulfelix, axl, JeffreySax, > Lawouach, and KKI. > > You can download IronPython 2.0 at: > http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=8365 > > The IronPython Team > > BTW > > Updates to the IronPython 1.0 samples will be released > shortly. Stay tuned to the IronPython mailing list for details. > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > http://www.goldwatches.com/ > > http://www.jewelerslounge.com/ > >------------------------------------------------------------------------ > >_______________________________________________ >Users mailing list >Users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From dfugate at microsoft.com Thu Dec 11 00:53:26 2008 From: dfugate at microsoft.com (Dave Fugate) Date: Wed, 10 Dec 2008 15:53:26 -0800 Subject: [IronPython] Samples for IronPython 2.0 Message-ID: The 1.0 samples that were ported over to 2.0 have now been added to IronPython-2.0-Samples.zip on the 2.0 release page - see http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=8365. If you encounter any issues, please let us know or file a bug on CodePlex. Please remember that in addition to the samples produced by the IronPython Team, there is also a community-driven IronPython Cookbook at http://www.ironpython.info. Thanks, David Fugate Microsoft - IronPython http://knowbody.livejournal.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From artie.ziff at gmail.com Thu Dec 11 01:33:53 2008 From: artie.ziff at gmail.com (Artie Ziff) Date: Wed, 10 Dec 2008 16:33:53 -0800 Subject: [IronPython] def within a def Message-ID: <49405FF1.9050701@gmail.com> Hi, Apologies if this is actually a general python inquiry. Due to the dotnet statement related to adding a handler for an event, I will ask here. Looking at the examples on the "IronPython & Windows Forms" page, I see a code that I am not familiar. In the 2nd example on this page, , I am unfamiliar with placing a method (in this case "update") inside a constructor. I see that the method "update" is being added to the button's event handler in the constructor, __init__. Why must this method be defined inside the constructor? Is there a name for this? Is this an example of a PEP 309, Partial Function Application? Cheers, Art From me at alcidesfonseca.com Thu Dec 11 01:38:49 2008 From: me at alcidesfonseca.com (Alcides Fonseca) Date: Thu, 11 Dec 2008 00:38:49 +0000 Subject: [IronPython] def within a def In-Reply-To: <49405FF1.9050701@gmail.com> References: <49405FF1.9050701@gmail.com> Message-ID: <95648DCC-46CE-4BA5-A404-B3553D1DF567@alcidesfonseca.com> Em 2008/12/11, ?s 00:33, Artie Ziff escreveu: > Looking at the examples on the "IronPython & Windows Forms" page, I > see > a code that I am not familiar. In the 2nd example on this page, > , I am > unfamiliar with placing a method (in this case "update") inside a > constructor. > > I see that the method "update" is being added to the button's event > handler in the constructor, __init__. Why must this method be defined > inside the constructor? Is there a name for this? Is this an example > of > a PEP 309, Partial Function Application? Actually, it's not a method. Methods take self as the first argument. that update is just a function that takes two parameters and prints some value. It's the callback of that event. After you call self.button1.Click += update Everytime button1 is clicked, it is going to call the function update. You can define functions anywhere in your code, inside classes, inside other functions, at the module level, etc... Methods are the ones that are restricted to be inside the class and taking self as the first parameter* Alcides * Actually you can monkey patch, but that's an advanced feature. From billchi at microsoft.com Thu Dec 11 03:09:41 2008 From: billchi at microsoft.com (Bill Chiles) Date: Wed, 10 Dec 2008 18:09:41 -0800 Subject: [IronPython] DLR Codeplex Project v0.9 Released with IPy v2.0 Message-ID: <8DD7BECAEB597D4782F7C9CEFDCA6B92867AB38FCE@NA-EXMSG-C125.redmond.corp.microsoft.com> Today we're excited to announce the final v0.9 release of the Dynamic Language Runtime (DLR). The DLR project provides one-stop shopping for folks who want to: * implement a language on .NET using the DLR * add dynamic features to their existing language like C#'s 'dynamic' (http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=csharpfuture&DownloadId=3550 ) * add scripting to their applications. * create .NET libraries with dynamic objects This Codeplex project includes the DLR sources as well as sources for IronPython, IronRuby, and samples (such as ToyScript). This is a classic open source version 0.9 release with high quality code through much of the system. We're shipping some of this in the .NET 4.0 release coming up. Some parts are still open to design changes as we solidify those parts for post .NET 4.0, and we'll continue to add more docs and samples. We will have coordinated releases or sync points across IronPython and IronRuby sites for major releases so that if you're not pulling from the DLR project, you can still see which sources or releases are consistent across our projects. Jim Hugunin did a great talk at PDC 08 on DLR architecture, concepts, and coding with the .NET 4.0 functionality (http://channel9.msdn.com/pdc2008/TL10/ ). In his talk, he also outlines what's in .NET 4.0: * fast dynamic dispatch with polymorphic inline caching * dynamic object interoperability across languages and libraries (including C# 'dynamic' consuming IronPython and IronRuby objects naturally, including any language whose objects participate in the DLR's dynamic object protocol) * support for library authors to easily make their model objects consumable with nice looking and lightweight code in languages that support the DLR dynamic object protocol (for example, with C#'s 'dynamic', you can write xml.Customer.Name instead of xml.GetChild("Customer").GetChild("Name") * ability to mix binding logic from various languages and library objects in a single dynamic call site cache * Expression Trees v2 with support for control flow, assignments, etc. * COM IDispatch binding as DLR dynamic objects The following highlights the support shipping only on Codeplex until a future .NET release: * common hosting model for languages built on or supporting the DLR hosting model * helpers such as a default .NET binder, complex numbers, tuples * more Expression Tree support, such as globals access in hosted scenarios and iterator/generator functions. All the code is available for what the DLR Team is shipping in .NET 4.0. Furthermore, we're releasing all the code for LINQ Expression Trees v1 since the DLR merged its ASTs with LINQ trees. Some of you have noticed this code has been on the IronPython site for a couple of months now. We will continue indefinitely shipping all of our code open source through .NET 4.0 shipping and future releases of .NET as we move more and more of the DLR into .NET (for example, the common hosting APIs and language implementer APIs). We have no plan in place at this time for source take back from the community. It is worth noting that the sources and binaries in the .zip files are circa mid-October, and the daily source tree pushes have several small but pervasive cleanups to the API (name changes), perf improvements, and so on. We're busy here solidifying final design changes for the DLR parts going into .NET 4.0. We wanted to have our release match IronPython 2.0, and they had to lock down sources before we did. The documents in the release speak to the latest sources. Some of the documents are our internal working specs, but in general we prefer you know where we're planning to end up with the code. There are no significant cognitive changes in the APIs, so you'll easily map from the docs to the actual code. For a consistent IronPython release, go to www.codeplex.com/ironpython and get their v2.0 RC2. We won't normally have consistent release across all projects for RCs, betas, etc., and we don't have one for IronRuby today. When we RTW IPy v2 and DLR v0.9 shortly, we'll have consistent releases for all three projects. If you want to read some documents without downloading sources or bits, go to http://www.codeplex.com/dlr/Wiki/View.aspx?title=Docs%20and%20specs : * dlr-overview.doc * dlr-spec-hosting.doc * sites-binders-dyn-objs-spec.doc * libraries-author-introduction * expr-tree-spec.doc There is a discussion list at http://www.codeplex.com/dlr/Thread/List.aspx (click on the "get email notifications" link). All mail there goes to dlr at microsoft.com which has all the folks working on the DLR and our languages on it. Thanks, Bill -------------- next part -------------- An HTML attachment was scrubbed... URL: From szport at gmail.com Thu Dec 11 09:16:23 2008 From: szport at gmail.com (Zaur Shibzoukhov) Date: Thu, 11 Dec 2008 11:16:23 +0300 Subject: [IronPython] COM Object Issue In-Reply-To: <350E7D38B6D819428718949920EC2355564A4DF775@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <350E7D38B6D819428718949920EC23554FF6DC08FB@NA-EXMSG-C102.redmond.corp.microsoft.com> <350E7D38B6D819428718949920EC23554FF6DC08FE@NA-EXMSG-C102.redmond.corp.microsoft.com> <350E7D38B6D819428718949920EC2355564A4DF775@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: I just discovered strange thing with COM (IP 2.0): D:\Downloads\IronPython-2.0-Bin\IronPython-2.0>ipy.exe -X:ExceptionDetail -X:ShowClrExceptions IronPython 2.0 (2.0.0.0) on .NET 2.0.50727.1433 Type "help", "copyright", "credits" or "license" for more information. >>> import System >>> wt=System.Type.GetTypeFromProgID("Word.Application") >>> wa=System.Activator.CreateInstance(wt) >>> wa.Documents.Add() >>> wa.Documents[1] Error while invoking Item. ? Microsoft.Scripting.Com.ComRuntimeHelpers.CheckThrowException(Int32 hresult, ExcepInfo& excepInfo, UInt32 argErr, String message) ? _stub_$26##25(Closure , CallSite , DispCallable ) ? Microsoft.Scripting.Actions.MatchCaller.Call1[T0,TRet](Func`3 target, CallSite site, Object[] args) ? Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args) ? Microsoft.Scripting.Actions.UpdateDelegates.Update1[T,T0,TRet](CallSite site, T0 arg0) ? _stub_$25##24(Closure , CallSite , ComObject , Int32 ) ? Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4 target, CallSite site, Object[] args) ? Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args) ? Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) ? _stub_$24##23(Closure , CallSite , Object , Int32 ) ? Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4 target, CallSite site, Object[] args) ? Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args) ? Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) ? $23##22(Closure , Scope , LanguageContext ) ? Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpression code, Scope scope) ? Microsoft.Scripting.ScriptCode.Run(Scope scope) ? IronPython.Hosting.PythonCommandLine.<>c__DisplayClass1.b__0() StandardError: Error while invoking Item. CLR Exception: TargetParameterCountException : Error while invoking Item. >>> wa.Documents[None,1] >>> wa.Documents[100000000000000000000,1] It looks like IP's wa.Documents indexer make wrong call of .Item. -- Zaur From giulio.petrucci at gmail.com Thu Dec 11 09:42:10 2008 From: giulio.petrucci at gmail.com (Giulio Petrucci) Date: Thu, 11 Dec 2008 09:42:10 +0100 Subject: [IronPython] Newbie Questions In-Reply-To: <350E7D38B6D819428718949920EC2355564A7FB258@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <350E7D38B6D819428718949920EC2355564A7FB258@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: Hi Dino, first of all, thanks for your reply 2008/12/5 Dino Viehland : > You can add a reference to the assembly and then import both the class and the enum. For example: > > import clr > clr.AddReference('MyLibrary') > from MyLibrary import MyClass, MyEnum > MyClass().SomeMethod(MyEnum.SomeValue) Ok, I've just tested it and everything seems to work fine. > The 2nd question... is this an app.exe.config file that you're reading? If so this might be helpful: > http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.windowsforms/topic64732.aspx I couldn't realize actually the utility of the article. I'll try to explain my problem wit a litlle bit more of words. I've created a .NET library which reads some settings in the application configuration file. The library isn't actually used by any Console/WinForm/whatever application, but I just want to test it using the IronPython interactive console. So I created a MyLibrary.dll.config file, I run the IronPython console and I add the reference to my library. How can I "force" my library to read the proper .config file? Can I explicitly load a .config file? Thanks in advance, Giulio -- OnAir: http://www.giuliopetrucci.it http://www.fujikomonamour.com From dinov at microsoft.com Thu Dec 11 09:57:27 2008 From: dinov at microsoft.com (Dino Viehland) Date: Thu, 11 Dec 2008 00:57:27 -0800 Subject: [IronPython] Newbie Questions In-Reply-To: References: <350E7D38B6D819428718949920EC2355564A7FB258@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <350E7D38B6D819428718949920EC2355564B62DFDF@NA-EXMSG-C102.redmond.corp.microsoft.com> .NET config doesn't really have any concept of configuration for an individual DLL. Instead it only has a config for the exe which kicked things off (or actually for the current app domain). So the concept of a "MyLibrary.dll.config" file doesn't really exist AFAIK. So that basically leaves you with a few options. You could add your configuration to an ipy.exe.config file. Or you could try and force the .NET config APIs to explicitly load a config file (which is what I thought the blog post I linked to showed via ExeConfigurationFileMap/OpenMappedExeConfiguration). Or your DLL could provide its own configuration mechanism if you really feel like its settings should be independent from the app using it. But ultimately I think these are all the same problems you'll encounter when using your DLL from any other EXE. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Giulio Petrucci > Sent: Thursday, December 11, 2008 12:42 AM > To: IronPython mailing list > Subject: Re: [IronPython] Newbie Questions > > Hi Dino, > > first of all, thanks for your reply > > 2008/12/5 Dino Viehland : > > You can add a reference to the assembly and then import both the > class and the enum. For example: > > > > import clr > > clr.AddReference('MyLibrary') > > from MyLibrary import MyClass, MyEnum > > MyClass().SomeMethod(MyEnum.SomeValue) > > Ok, I've just tested it and everything seems to work fine. > > > The 2nd question... is this an app.exe.config file that you're > reading? If so this might be helpful: > > > http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.wi > ndowsforms/topic64732.aspx > > I couldn't realize actually the utility of the article. I'll try to > explain my problem wit a litlle bit more of words. I've created a .NET > library which reads some settings in the application configuration > file. The library isn't actually used by any Console/WinForm/whatever > application, but I just want to test it using the IronPython > interactive console. So I created a MyLibrary.dll.config file, I run > the IronPython console and I add the reference to my library. How can > I "force" my library to read the proper .config file? Can I explicitly > load a .config file? > > Thanks in advance, > Giulio > -- > OnAir: > http://www.giuliopetrucci.it > http://www.fujikomonamour.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From giulio.petrucci at gmail.com Thu Dec 11 10:13:12 2008 From: giulio.petrucci at gmail.com (Giulio Petrucci) Date: Thu, 11 Dec 2008 10:13:12 +0100 Subject: [IronPython] Newbie Questions In-Reply-To: <350E7D38B6D819428718949920EC2355564B62DFDF@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <350E7D38B6D819428718949920EC2355564A7FB258@NA-EXMSG-C102.redmond.corp.microsoft.com> <350E7D38B6D819428718949920EC2355564B62DFDF@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: Hi Dino, 2008/12/11 Dino Viehland : > .NET config doesn't really have any concept of configuration for an individual DLL. Instead it only has a config for the exe > which kicked things off (or actually for the current app domain). So the concept of a "MyLibrary.dll.config" file doesn't > really exist AFAIK. Yes, I know. In fact the "MyLibrary.dll.config" is a conventional name - AFAIK - given by VisualStudio when creating a .config file for a .dll > So that basically leaves you with a few options. You could add your configuration to an ipy.exe.config file. It's an interesting option... ;-) I'll play a bit around an let you know. But... > Or you could > try and force the .NET config APIs to explicitly load a config file (which is what I thought the blog post I linked to showed > via ExeConfigurationFileMap/OpenMappedExeConfiguration). ...and this is the option I prefer. I tryed to follow the example you showd but it didn't work. Basically what I need is that each ConfigurationManager.AppSettings[*] reads the "*" setting from my config file. I'll investigate and, if I find anything interesting, I'll let you know. Thanks, Giulio -- OnAir: http://www.giuliopetrucci.it http://www.fujikomonamour.com From taozuhong at qq.com Thu Dec 11 12:33:43 2008 From: taozuhong at qq.com (=?gbk?B?QW5keS5UYW8=?=) Date: Thu, 11 Dec 2008 19:33:43 +0800 Subject: [IronPython] Announcing IronPython 2.0 Message-ID: good news, thanks for yours' hard working... I noticed that the binary package haven't contain the help document, could you tell us what time the latest API document will be released? thanks ------------------ Andy Tao[???] ??????? http://www.zuhong.cn ??????????????????? ------------------ Original ------------------ From: "Dave Fugate"; Date: Thu, Dec 11, 2008 05:19 AM To: "Discussion of IronPython"; Cc: "python-announce-list at python.org"; Subject: [IronPython] Announcing IronPython 2.0 Hello Python Community, The IronPython and Dynamic Language Runtime teams are proud to announce the release of IronPython 2.0 final. IronPython 2.0 is the culmination of nearly two years worth of work resulting in a CPython 2.5 compatible release on .NET 2.0 SP1. By far, the biggest change to 2.0 is that our 1.1 codebase was refactored to run on top of the Dynamic Language Runtime. With this we automatically get improvements in many feature areas such as better ..NET interop support and hosting Python from managed code. There have been many other major improvements as well. The most notable are: ? An MSI installer for Windows platforms which includes parts of the CPython 2.5 standard library ? IronPython assemblies targeting Silverlight and tools such as Chiron to improve the Silverlight dynamic development experience ? The addition of more C-based standard modules such as cmath and _winreg ? Significant improvements in importing compatibility and features ? Distribution of IronPython under the Microsoft Public License which has been approved by OSI ? Performance improvements. On that note, a new Wiki page has been created for IronPython performance reports - see http://www.codeplex.com/IronPython/Wiki/View.aspx?title=IronPython%20Performance ? Over 500 bugs have been closed in 2.0. 453 of these were reported on CodePlex ? Support for precompilation of Python source files into a single dll This seems like an opportune time to remind everyone that we fix bugs based on the number of votes they have on CodePlex. As we?re planning on releasing IronPython 2.0.1 fairly soon, please vote for your favorite bugs at http://www.codeplex.com/IronPython/WorkItem/AdvancedList.aspx to help ensure they get fixed in time for the next release. We?d like to extend our gratitude to everyone in the IronPython community who reported bugs thereby making this a better release: milind, romank, chadaustin, sjmachin, davidfraser, TimothyFitz, drewid, sanxiyn, bashmohandes, pobrien, perhaps, haypo, Undebtedly, ayarrow, tscottw_cp, rope, arman0, eshaish, nivaldo, fuzzyman, CurtHagenlocher, Eloff, brucec, py_sunil, jacobg23, mziller, beaugunderson, gbraad, Oceanborn, tarlano, jbevain, glchapman, anthonybaxter, jdhardy, jjlee, haibo, doubleyewdee, jackeyoo, whit537, sdahlbac, PeteHufnagel, jtenney, nriley, junfeng, grizlupo, rridge, lewisle, JoelBondurant, johnplatt, lthompson, debackerl, googen, tscottw, VoteFw, leppie, Qvin, heyssion2, CriGoT, baxeno, sbergman, Laurion, luntain, oldman, christmas, 05031972, kevgu, wilberforce, Korbinian, lclj, sorokerr, Eriol, tatwright, ais, TraumaPony, pelikhan, asafk, felixpollan, srid, atifaziz, vernondcole, fwereade, zpy, yanne, facorreia, Daneel, zvikag, psykotic, Cavingdeep, BEaton, sborde, orbital56, fbourgeois, antont, krosavcheg, ktc1, awilkins, ben2004uk, paulfelix, axl, JeffreySax, Lawouach, and KKI. You can download IronPython 2.0 at: http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=8365 The IronPython Team BTW Updates to the IronPython 1.0 samples will be released shortly. Stay tuned to the IronPython mailing list for details. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jslutter at reactorzero.com Thu Dec 11 16:58:33 2008 From: jslutter at reactorzero.com (Jeff Slutter) Date: Thu, 11 Dec 2008 10:58:33 -0500 Subject: [IronPython] Announcing IronPython 2.0 In-Reply-To: References: Message-ID: <494138A9.6040504@reactorzero.com> Excuse me if this is known or not, but searching around has only turned up articles/mailing lists posts that are two years old, but does IronPython 2.0 support .NET attributes yet? I've seen some examples of doing it using stub classes in C# and then deriving from the in Python, but I'm not sure if this will work for me. I need to put an Attribute on a class, or method, in Python that takes a string argument. I can't think of a workaround to get this support. For example, in C# the class would be: class Foo { [MyNameAttribute("Test name")] public void Method() { Console.Write("test"); } } And the string "Test name" could be different for each use of MyNameAttribute. I use it for internal registration purposes in my C# code. How would I write this class in IP? From curt at hagenlocher.org Thu Dec 11 17:46:49 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Thu, 11 Dec 2008 08:46:49 -0800 Subject: [IronPython] Announcing IronPython 2.0 In-Reply-To: <494138A9.6040504@reactorzero.com> References: <494138A9.6040504@reactorzero.com> Message-ID: We don't support this in IronPython 2.0, no. And oddly, no one seems to have added this as a "desired feature" in CodePlex, even though it's come up a few times before on this list. The most likely way that we'd initially provide support for this is to let you override the "CLS backing class" that's being used to represent your Python class -- this would mean that you'd need to do the code generation for the attribute yourself, though. On Thu, Dec 11, 2008 at 7:58 AM, Jeff Slutter wrote: > Excuse me if this is known or not, but searching around has only turned > up articles/mailing lists posts that are two years old, but does > IronPython 2.0 support .NET attributes yet? > > I've seen some examples of doing it using stub classes in C# and then > deriving from the in Python, but I'm not sure if this will work for me. > I need to put an Attribute on a class, or method, in Python that takes a > string argument. I can't think of a workaround to get this support. > > For example, in C# the class would be: > > class Foo > { > [MyNameAttribute("Test name")] > public void Method() > { > Console.Write("test"); > } > } > > And the string "Test name" could be different for each use of > MyNameAttribute. I use it for internal registration purposes in my C# code. > > How would I write this class in IP? > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From billchi at microsoft.com Thu Dec 11 21:03:47 2008 From: billchi at microsoft.com (Bill Chiles) Date: Thu, 11 Dec 2008 12:03:47 -0800 Subject: [IronPython] Announcing IronPython 2.0 In-Reply-To: References: Message-ID: <8DD7BECAEB597D4782F7C9CEFDCA6B92867AB3941A@NA-EXMSG-C125.redmond.corp.microsoft.com> You can always get the latest docs from http://www.codeplex.com/dlr/Wiki/View.aspx?title=Docs%20and%20specs&referringTitle=Home where I push specs and docs. IPy specific docs like the tutorial and whatnot are only in the IPy zips. bill From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Andy.Tao Sent: Thursday, December 11, 2008 3:34 AM To: Discussion of IronPython Subject: Re: [IronPython] Announcing IronPython 2.0 good news, thanks for yours' hard working... I noticed that the binary package haven't contain the help document, could you tell us what time the latest API document will be released? thanks ------------------ Andy Tao[???] ??????? http://www.zuhong.cn ??????????????????? ------------------ Original ------------------ From: "Dave Fugate"; Date: Thu, Dec 11, 2008 05:19 AM To: "Discussion of IronPython"; Cc: "python-announce-list at python.org"; Subject: [IronPython] Announcing IronPython 2.0 Hello Python Community, The IronPython and Dynamic Language Runtime teams are proud to announce the release of IronPython 2.0 final. IronPython 2.0 is the culmination of nearly two years worth of work resulting in a CPython 2.5 compatible release on .NET 2.0 SP1. By far, the biggest change to 2.0 is that our 1.1 codebase was refactored to run on top of the Dynamic Language Runtime. With this we automatically get improvements in many feature areas such as better ..NET interop support and hosting Python from managed code. There have been many other major improvements as well. The most notable are: * An MSI installer for Windows platforms which includes parts of the CPython 2.5 standard library * IronPython assemblies targeting Silverlight and tools such as Chiron to improve the Silverlight dynamic development experience * The addition of more C-based standard modules such as cmath and _winreg * Significant improvements in importing compatibility and features * Distribution of IronPython under the Microsoft Public License which has been approved by OSI * Performance improvements. On that note, a new Wiki page has been created for IronPython performance reports - see http://www.codeplex.com/IronPython/Wiki/View.aspx?title=IronPython%20Performance * Over 500 bugs have been closed in 2.0. 453 of these were reported on CodePlex * Support for precompilation of Python source files into a single dll This seems like an opportune time to remind everyone that we fix bugs based on the number of votes they have on CodePlex. As we?re planning on releasing IronPython 2.0.1 fairly soon, please vote for your favorite bugs at http://www.codeplex.com/IronPython/WorkItem/AdvancedList.aspx to help ensure they get fixed in time for the next release. We?d like to extend our gratitude to everyone in the IronPython community who reported bugs thereby making this a better release: milind, romank, chadaustin, sjmachin, davidfraser, TimothyFitz, drewid, sanxiyn, bashmohandes, pobrien, perhaps, haypo, Undebtedly, ayarrow, tscottw_cp, rope, arman0, eshaish, nivaldo, fuzzyman, CurtHagenlocher, Eloff, brucec, py_sunil, jacobg23, mziller, beaugunderson, gbraad, Oceanborn, tarlano, jbevain, glchapman, anthonybaxter, jdhardy, jjlee, haibo, doubleyewdee, jackeyoo, whit537, sdahlbac, PeteHufnagel, jtenney, nriley, junfeng, grizlupo, rridge, lewisle, JoelBondurant, johnplatt, lthompson, debackerl, googen, tscottw, VoteFw, leppie, Qvin, heyssion2, CriGoT, baxeno, sbergman, Laurion, luntain, oldman, christmas, 05031972, kevgu, wilberforce, Korbinian, lclj, sorokerr, Eriol, tatwright, ais, TraumaPony, pelikhan, asafk, felixpollan, srid, atifaziz, vernondcole, fwereade, zpy, yanne, facorreia, Daneel, zvikag, psykotic, Cavingdeep, BEaton, sborde, orbital56, fbourgeois, antont, krosavcheg, ktc1, awilkins, ben2004uk, paulfelix, axl, JeffreySax, Lawouach, and KKI. You can download IronPython 2.0 at: http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=8365 The IronPython Team BTW Updates to the IronPython 1.0 samples will be released shortly. Stay tuned to the IronPython mailing list for details. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kfarmer at thuban.org Thu Dec 11 23:05:13 2008 From: kfarmer at thuban.org (Keith J. Farmer) Date: Thu, 11 Dec 2008 14:05:13 -0800 Subject: [IronPython] Announcing IronPython 2.0 References: <8DD7BECAEB597D4782F7C9CEFDCA6B92867AB3941A@NA-EXMSG-C125.redmond.corp.microsoft.com> Message-ID: Actually, IP has error messages about help that refer to things that don't exist -- such as the CHM help included in other distributions. At this point, I suspect IP is emulating CPython behavior too closely ;) So congrats on v2! I recall there was talk long ago about a PyPan-like service (including dependency tracking and such). I wonder if that's gone anywhere? ________________________________ From: users-bounces at lists.ironpython.com on behalf of Bill Chiles Sent: Thu 12/11/2008 12:03 PM To: Discussion of IronPython Subject: Re: [IronPython] Announcing IronPython 2.0 You can always get the latest docs from http://www.codeplex.com/dlr/Wiki/View.aspx?title=Docs%20and%20specs&referringTitle=Home where I push specs and docs. IPy specific docs like the tutorial and whatnot are only in the IPy zips. bill From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Andy.Tao Sent: Thursday, December 11, 2008 3:34 AM To: Discussion of IronPython Subject: Re: [IronPython] Announcing IronPython 2.0 good news, thanks for yours' hard working... I noticed that the binary package haven't contain the help document, could you tell us what time the latest API document will be released? thanks ------------------ Andy Tao[???] ??????? http://www.zuhong.cn ????,????,????????! ------------------ Original ------------------ From: "Dave Fugate"; Date: Thu, Dec 11, 2008 05:19 AM To: "Discussion of IronPython"; Cc: "python-announce-list at python.org"; Subject: [IronPython] Announcing IronPython 2.0 Hello Python Community, The IronPython and Dynamic Language Runtime teams are proud to announce the release of IronPython 2.0 final. IronPython 2.0 is the culmination of nearly two years worth of work resulting in a CPython 2.5 compatible release on .NET 2.0 SP1. By far, the biggest change to 2.0 is that our 1.1 codebase was refactored to run on top of the Dynamic Language Runtime . With this we automatically get improvements in many feature areas such as better ..NET interop support and hosting Python from managed code. There have been many other major improvements as well. The most notable are: ? An MSI installer for Windows platforms which includes parts of the CPython 2.5 standard library ? IronPython assemblies targeting Silverlight and tools such as Chiron to improve the Silverlight dynamic development experience ? The addition of more C-based standard modules such as cmath and _winreg ? Significant improvements in importing compatibility and features ? Distribution of IronPython under the Microsoft Public License which has been approved by OSI ? Performance improvements. On that note, a new Wiki page has been created for IronPython performance reports - see http://www.codeplex.com/IronPython/Wiki/View.aspx?title=IronPython%20Performance ? Over 500 bugs have been closed in 2.0. 453 of these were reported on CodePlex ? Support for precompilation of Python source files into a single dll This seems like an opportune time to remind everyone that we fix bugs based on the number of votes they have on CodePlex. As we're planning on releasing IronPython 2.0.1 fairly soon, please vote for your favorite bugs at http://www.codeplex.com/IronPython/WorkItem/AdvancedList.aspx to help ensure they get fixed in time for the next release. We'd like to extend our gratitude to everyone in the IronPython community who reported bugs thereby making this a better release: milind, romank, chadaustin, sjmachin, davidfraser, TimothyFitz, drewid, sanxiyn, bashmohandes, pobrien, perhaps, haypo, Undebtedly, ayarrow, tscottw_cp, rope, arman0, eshaish, nivaldo, fuzzyman, CurtHagenlocher, Eloff, brucec, py_sunil, jacobg23, mziller, beaugunderson, gbraad, Oceanborn, tarlano, jbevain, glchapman, anthonybaxter, jdhardy, jjlee, haibo, doubleyewdee, jackeyoo, whit537, sdahlbac, PeteHufnagel, jtenney, nriley, junfeng, grizlupo, rridge, lewisle, JoelBondurant, johnplatt, lthompson, debackerl, googen, tscottw, VoteFw, leppie, Qvin, heyssion2, CriGoT, baxeno, sbergman, Laurion, luntain, oldman, christmas, 05031972, kevgu, wilberforce, Korbinian, lclj, sorokerr, Eriol, tatwright, ais, TraumaPony, pelikhan, asafk, felixpollan, srid, atifaziz, vernondcole, fwereade, zpy, yanne, facorreia, Daneel, zvikag, psykotic, Cavingdeep, BEaton, sborde, orbital56, fbourgeois, antont, krosavcheg, ktc1, awilkins, ben2004uk, paulfelix, axl, JeffreySax, Lawouach, and KKI. You can download IronPython 2.0 at: http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=8365 The IronPython Team BTW Updates to the IronPython 1.0 samples will be released shortly. Stay tuned to the IronPython mailing list for details. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mtraudt at alum.mit.edu Fri Dec 12 14:48:51 2008 From: mtraudt at alum.mit.edu (Mark Traudt) Date: Fri, 12 Dec 2008 05:48:51 -0800 (PST) Subject: [IronPython] Problem inheriting from C# abstract base class with overloaded constructors In-Reply-To: <350E7D38B6D819428718949920EC2355564A70AA3E@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <20804327.post@talk.nabble.com> <350E7D38B6D819428718949920EC2355564A70AA3E@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <20975961.post@talk.nabble.com> Dino Viehland-2 wrote: > > This is bug #20021 - > http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20021 > > I checked a fix for this in today into the Main branch (which is 2.1). I > think that should show up on CodePlex tonight or tomorrow if you're > willing to build IronPython from source. If not we'll definitely fix this > in 2.0.1 if we don't spin a new build for 2.0 which would also likely > include the fix. > > I built Main from latest source and the problem is fixed. Thanks. -- View this message in context: http://www.nabble.com/Problem-inheriting-from-C--abstract-base-class-with-overloaded-constructors-tp20804327p20975961.html Sent from the IronPython mailing list archive at Nabble.com. From glenn.k.jones+ipy at gmail.com Fri Dec 12 16:27:27 2008 From: glenn.k.jones+ipy at gmail.com (Glenn Jones) Date: Fri, 12 Dec 2008 15:27:27 +0000 Subject: [IronPython] Issue about string.upper and string.lower Message-ID: <2679f6510812120727o58a85ec4ub686aeac4dc4820b@mail.gmail.com> Hello everybody, We ran across http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=13629(turkish collation issues) today while trying to port Resolver One to IronPython 2.0. This is in a test that tries to import decimal while in the turkish locale (it was actually reported by a user!). It does an .upper on a string with an 'i', and that doesn't give the expected results. This is a very big issue because all the python code out there expects string transformations to be locale-independent, and there may be strange bugs in strange places. Is mapping .upper and .lower to ToUpperInvariant and ToLowerInvariant an acceptable solution? People that want to do locale-dependent transformations can always use the .NET specific ToUpper/ToLower. We can work around the decimal being unimportable by hacking it, but clearly this is not a general solution. We will report other modules that might fail from this as we find them. Thanks, Glenn and Orestis -------------- next part -------------- An HTML attachment was scrubbed... URL: From glenn.k.jones+ipy at gmail.com Fri Dec 12 17:27:10 2008 From: glenn.k.jones+ipy at gmail.com (Glenn Jones) Date: Fri, 12 Dec 2008 16:27:10 +0000 Subject: [IronPython] Compiled dlls and builtin modules Message-ID: <2679f6510812120827x173452fbg97ba9ac332d63e92@mail.gmail.com> Hi all, We are compiling the python standard library (so it can be ngend when it is shipped with Resolver One) and we've discovered that modules in the dll take precedence over builtins. We noticed this because re and socket are included in the standard Lib directory (installed with IPy2) and when we ran against the dll built from the Lib, importing them failed. We have removed the following files from the standard library (and we may have to remove some others): socket, copy_reg, re, sre_compile, sre_constants, sre_parse (the sre_* were referenced in re) A better solution would be for builtin modules to take precedence over modules in referenced assemblies. As an experiment, we created a datetime module that just printed that it was being imported. When we included it in a dll and referenced it, it replaced the builtin datetime. Glenn & Orestis -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Sat Dec 13 15:26:28 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 13 Dec 2008 14:26:28 +0000 Subject: [IronPython] Questions about compiled .py files - their stub exe and dlls In-Reply-To: <843870680812101004s537b627am8275da5b1273fbd9@mail.gmail.com> References: <843870680812101004s537b627am8275da5b1273fbd9@mail.gmail.com> Message-ID: <4943C614.8020705@voidspace.org.uk> Guy Rozendorn wrote: > Hi, > > I have a question about compiled python files with the pyc.py example. > I read that the dll must exist from the directory from which the > executable is executed. > For example, let's say I compiled my code to: > myProg.exe > myProgr.dll > > and they both reside in C:\Temp\myProg.exe, along with IronPython.dll > and IronPythonModules.dll It looks like you are using the Pyc.py sample with IronPython 1. Can you update to IronPython 2 and try again. Thanks Michael Foord > > If I try to execute myProg.exe from any other directory (i.e - I'm in > C:\Windows, and running C:\Temp\myProg.exe), I get the following error: > Unhandled Exception: System.IO.FileNotFoundException: The system > cannot find the file specified. (Exception from HRESULT > : 0x80070002) > at System.Reflection.Assembly.nLoadFile(String path, Evidence evidence) > at System.Reflection.Assembly.LoadFile(String path) > at PythonMain.Main() > > What do I need to do to make myProg.exe run from anywhere? > Specfically, this bothers me because in deploying Windows Services > wriiten in IronPython. > Let's say I just compiled myService.exe, along with myService.dll, and > they're both in C:\Temp (along with IronPython DLLs). > After I register the service, it fails to start, since the current > directory of the services.exe (who executes myService.exe) is > %SystemRoot%\system32 > If I put myService.dll in the system32 directory, the service works. > But I don't want to put myService.dll in system32 (and many more dlls > that I use). > > So, my question is: > * Can I make the magic that will cause myService.exe/myProg.exe to > look for its DLL inside the directory in which he resides in (and not > the current directory)? > * It is possible to include myService.dll and IronPython.dll and > IronPythonModules.dll inside myService.exe (so I could do import sys > and then append to path which ever directries I wish for)? > > Thanks, > Guy > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From guy at rzn.co.il Sat Dec 13 15:40:31 2008 From: guy at rzn.co.il (Guy Rozendorn) Date: Sat, 13 Dec 2008 16:40:31 +0200 Subject: [IronPython] Questions about compiled .py files - their stub exe and dlls In-Reply-To: <4943C614.8020705@voidspace.org.uk> References: <843870680812101004s537b627am8275da5b1273fbd9@mail.gmail.com> <4943C614.8020705@voidspace.org.uk> Message-ID: <843870680812130640i639e7692h8506137188d8528f@mail.gmail.com> I'm using the IronPython 2.0, final version, and the corresponding pyc.py sample >> and they both reside in C:\Temp\myProg.exe, along with IronPython.dll and >> IronPythonModules.dll >> > > It looks like you are using the Pyc.py sample with IronPython 1. Can you > update to IronPython 2 and try again. > > Thanks > > Michael Foord > > >> If I try to execute myProg.exe from any other directory (i.e - I'm in >> C:\Windows, and running C:\Temp\myProg.exe), I get the following error: >> Unhandled Exception: System.IO.FileNotFoundException: The system cannot >> find the file specified. (Exception from HRESULT >> : 0x80070002) >> at System.Reflection.Assembly.nLoadFile(String path, Evidence evidence) >> at System.Reflection.Assembly.LoadFile(String path) >> at PythonMain.Main() >> >> What do I need to do to make myProg.exe run from anywhere? >> Specfically, this bothers me because in deploying Windows Services wriiten >> in IronPython. >> Let's say I just compiled myService.exe, along with myService.dll, and >> they're both in C:\Temp (along with IronPython DLLs). >> After I register the service, it fails to start, since the current >> directory of the services.exe (who executes myService.exe) is >> %SystemRoot%\system32 >> If I put myService.dll in the system32 directory, the service works. >> But I don't want to put myService.dll in system32 (and many more dlls that >> I use). >> >> So, my question is: >> * Can I make the magic that will cause myService.exe/myProg.exe to look >> for its DLL inside the directory in which he resides in (and not the current >> directory)? >> * It is possible to include myService.dll and IronPython.dll and >> IronPythonModules.dll inside myService.exe (so I could do import sys and >> then append to path which ever directries I wish for)? >> >> Thanks, >> Guy >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Sat Dec 13 15:43:25 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 13 Dec 2008 14:43:25 +0000 Subject: [IronPython] Questions about compiled .py files - their stub exe and dlls In-Reply-To: <843870680812130640i639e7692h8506137188d8528f@mail.gmail.com> References: <843870680812101004s537b627am8275da5b1273fbd9@mail.gmail.com> <4943C614.8020705@voidspace.org.uk> <843870680812130640i639e7692h8506137188d8528f@mail.gmail.com> Message-ID: <4943CA0D.80907@voidspace.org.uk> Guy Rozendorn wrote: > I'm using the IronPython 2.0, final version, and the corresponding pyc.py Well, in which case you need to include *all* the IronPython assemblies and not just IronPython.dll and IronPythonModules.dll. All the best, Michael Foord > > > and they both reside in C:\Temp\myProg.exe, along with > IronPython.dll and IronPythonModules.dll > > > It looks like you are using the Pyc.py sample with IronPython 1. > Can you update to IronPython 2 and try again. > > Thanks > > Michael Foord > > > If I try to execute myProg.exe from any other directory (i.e - > I'm in C:\Windows, and running C:\Temp\myProg.exe), I get the > following error: > Unhandled Exception: System.IO.FileNotFoundException: The > system cannot find the file specified. (Exception from HRESULT > : 0x80070002) > at System.Reflection.Assembly.nLoadFile(String path, > Evidence evidence) > at System.Reflection.Assembly.LoadFile(String path) > at PythonMain.Main() > > What do I need to do to make myProg.exe run from anywhere? > Specfically, this bothers me because in deploying Windows > Services wriiten in IronPython. > Let's say I just compiled myService.exe, along with > myService.dll, and they're both in C:\Temp (along with > IronPython DLLs). > After I register the service, it fails to start, since the > current directory of the services.exe (who executes > myService.exe) is %SystemRoot%\system32 > If I put myService.dll in the system32 directory, the service > works. > But I don't want to put myService.dll in system32 (and many > more dlls that I use). > > So, my question is: > * Can I make the magic that will cause > myService.exe/myProg.exe to look for its DLL inside the > directory in which he resides in (and not the current directory)? > * It is possible to include myService.dll and IronPython.dll > and IronPythonModules.dll inside myService.exe (so I could do > import sys and then append to path which ever directries I > wish for)? > > Thanks, > Guy > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From guy at rzn.co.il Sat Dec 13 15:56:20 2008 From: guy at rzn.co.il (Guy Rozendorn) Date: Sat, 13 Dec 2008 16:56:20 +0200 Subject: [IronPython] Questions about compiled .py files - their stub exe and dlls In-Reply-To: <4943CA0D.80907@voidspace.org.uk> References: <843870680812101004s537b627am8275da5b1273fbd9@mail.gmail.com> <4943C614.8020705@voidspace.org.uk> <843870680812130640i639e7692h8506137188d8528f@mail.gmail.com> <4943CA0D.80907@voidspace.org.uk> Message-ID: <843870680812130656s44e39cf7w8a78f8f7a9ab11bb@mail.gmail.com> Include them where? Let's look at the following example: bar.py only has one line: print dir() I compile using pyc.py to bar.dll and bar.exe I place bar* and IronPyhton*.dll in C:\Temp\yyy\ If I execute bar.exe from insdie C:\Temp\yyy, it runs without problems. here's the output: C:\Temp\yyy\ bar.exe ['__builtins__', '__file__', '__name__'] But, if I try to execute bar.exe from any other directory (for example, C:\Temp\), it fails: C:\Temp\ yyy\bar.exe Unhandled Exception: System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002) at System.Reflection.Assembly.nLoadFile(String path, Evidence evidence) at System.Reflection.Assembly.LoadFile(String path) at PythonMain.Main() ==== All I want is to be able to execute the compiled python scripts from whatever directory I want, and not just the directory in which the binary and all assemblies are in. Is it possilble? On Sat, Dec 13, 2008 at 4:43 PM, Michael Foord wrote: > Guy Rozendorn wrote: > >> I'm using the IronPython 2.0, final version, and the corresponding pyc.py >> > Well, in which case you need to include *all* the IronPython assemblies and > not just IronPython.dll and IronPythonModules.dll. > > All the best, > > Michael Foord > > >> >> and they both reside in C:\Temp\myProg.exe, along with >> IronPython.dll and IronPythonModules.dll >> >> >> It looks like you are using the Pyc.py sample with IronPython 1. >> Can you update to IronPython 2 and try again. >> >> Thanks >> >> Michael Foord >> >> >> If I try to execute myProg.exe from any other directory (i.e - >> I'm in C:\Windows, and running C:\Temp\myProg.exe), I get the >> following error: >> Unhandled Exception: System.IO.FileNotFoundException: The >> system cannot find the file specified. (Exception from HRESULT >> : 0x80070002) >> at System.Reflection.Assembly.nLoadFile(String path, >> Evidence evidence) >> at System.Reflection.Assembly.LoadFile(String path) >> at PythonMain.Main() >> >> What do I need to do to make myProg.exe run from anywhere? >> Specfically, this bothers me because in deploying Windows >> Services wriiten in IronPython. >> Let's say I just compiled myService.exe, along with >> myService.dll, and they're both in C:\Temp (along with >> IronPython DLLs). >> After I register the service, it fails to start, since the >> current directory of the services.exe (who executes >> myService.exe) is %SystemRoot%\system32 >> If I put myService.dll in the system32 directory, the service >> works. >> But I don't want to put myService.dll in system32 (and many >> more dlls that I use). >> >> So, my question is: >> * Can I make the magic that will cause >> myService.exe/myProg.exe to look for its DLL inside the >> directory in which he resides in (and not the current directory)? >> * It is possible to include myService.dll and IronPython.dll >> and IronPythonModules.dll inside myService.exe (so I could do >> import sys and then append to path which ever directries I >> wish for)? >> >> Thanks, >> Guy >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> >> >> -- http://www.ironpythoninaction.com/ >> http://www.voidspace.org.uk/blog >> >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Sat Dec 13 15:57:57 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 13 Dec 2008 14:57:57 +0000 Subject: [IronPython] Questions about compiled .py files - their stub exe and dlls In-Reply-To: <843870680812130656s44e39cf7w8a78f8f7a9ab11bb@mail.gmail.com> References: <843870680812101004s537b627am8275da5b1273fbd9@mail.gmail.com> <4943C614.8020705@voidspace.org.uk> <843870680812130640i639e7692h8506137188d8528f@mail.gmail.com> <4943CA0D.80907@voidspace.org.uk> <843870680812130656s44e39cf7w8a78f8f7a9ab11bb@mail.gmail.com> Message-ID: <4943CD75.2030101@voidspace.org.uk> Guy Rozendorn wrote: > Include them where? > > Let's look at the following example: > bar.py only has one line: print dir() > I compile using pyc.py to bar.dll and bar.exe > I place bar* and IronPyhton*.dll in C:\Temp\yyy\ What about the Microsoft.Scripting etc dlls - are you including those? Michael > If I execute bar.exe from insdie C:\Temp\yyy, it runs without > problems. here's the output: > C:\Temp\yyy\ > bar.exe > ['__builtins__', '__file__', '__name__'] > > But, if I try to execute bar.exe from any other directory (for > example, C:\Temp\), it fails: > C:\Temp\ > yyy\bar.exe > > Unhandled Exception: System.IO.FileNotFoundException: The system > cannot find the file specified. (Exception from HRESULT: 0x80070002) > at System.Reflection.Assembly.nLoadFile(String path, Evidence evidence) > at System.Reflection.Assembly.LoadFile(String path) > at PythonMain.Main() > > ==== > > All I want is to be able to execute the compiled python scripts from > whatever directory I want, and not just the directory in which the > binary and all assemblies are in. Is it possilble? > > > On Sat, Dec 13, 2008 at 4:43 PM, Michael Foord > > wrote: > > Guy Rozendorn wrote: > > I'm using the IronPython 2.0, final version, and the > corresponding pyc.py > > Well, in which case you need to include *all* the IronPython > assemblies and not just IronPython.dll and IronPythonModules.dll. > > All the best, > > Michael Foord > > > > and they both reside in C:\Temp\myProg.exe, along with > IronPython.dll and IronPythonModules.dll > > > It looks like you are using the Pyc.py sample with > IronPython 1. > Can you update to IronPython 2 and try again. > > Thanks > > Michael Foord > > > If I try to execute myProg.exe from any other directory > (i.e - > I'm in C:\Windows, and running C:\Temp\myProg.exe), I > get the > following error: > Unhandled Exception: System.IO.FileNotFoundException: The > system cannot find the file specified. (Exception from > HRESULT > : 0x80070002) > at System.Reflection.Assembly.nLoadFile(String path, > Evidence evidence) > at System.Reflection.Assembly.LoadFile(String path) > at PythonMain.Main() > > What do I need to do to make myProg.exe run from anywhere? > Specfically, this bothers me because in deploying Windows > Services wriiten in IronPython. > Let's say I just compiled myService.exe, along with > myService.dll, and they're both in C:\Temp (along with > IronPython DLLs). > After I register the service, it fails to start, since the > current directory of the services.exe (who executes > myService.exe) is %SystemRoot%\system32 > If I put myService.dll in the system32 directory, the > service > works. > But I don't want to put myService.dll in system32 (and many > more dlls that I use). > > So, my question is: > * Can I make the magic that will cause > myService.exe/myProg.exe to look for its DLL inside the > directory in which he resides in (and not the current > directory)? > * It is possible to include myService.dll and > IronPython.dll > and IronPythonModules.dll inside myService.exe (so I > could do > import sys and then append to path which ever directries I > wish for)? > > Thanks, > Guy > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > > > > > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > -- http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > > > > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From guy at rzn.co.il Sat Dec 13 16:49:13 2008 From: guy at rzn.co.il (Guy Rozendorn) Date: Sat, 13 Dec 2008 17:49:13 +0200 Subject: [IronPython] Questions about compiled .py files - their stub exe and dlls In-Reply-To: <4943CD75.2030101@voidspace.org.uk> References: <843870680812101004s537b627am8275da5b1273fbd9@mail.gmail.com> <4943C614.8020705@voidspace.org.uk> <843870680812130640i639e7692h8506137188d8528f@mail.gmail.com> <4943CA0D.80907@voidspace.org.uk> <843870680812130656s44e39cf7w8a78f8f7a9ab11bb@mail.gmail.com> <4943CD75.2030101@voidspace.org.uk> Message-ID: <843870680812130749n5ff2d172x92227ab7ffee15cc@mail.gmail.com> Yes, forgot to mention that - also, the Microsoft*.dll form the IronPython 2.0 directory are in C:\Temp\yyy\ Chevy Chase - "Parrots make great pets. They have more personality than goldfish." On Sat, Dec 13, 2008 at 4:57 PM, Michael Foord wrote: > Guy Rozendorn wrote: > >> Include them where? >> >> Let's look at the following example: >> bar.py only has one line: print dir() >> I compile using pyc.py to bar.dll and bar.exe >> I place bar* and IronPyhton*.dll in C:\Temp\yyy\ >> > > What about the Microsoft.Scripting etc dlls - are you including those? > > Michael > > If I execute bar.exe from insdie C:\Temp\yyy, it runs without problems. >> here's the output: >> C:\Temp\yyy\ >> bar.exe >> ['__builtins__', '__file__', '__name__'] >> >> But, if I try to execute bar.exe from any other directory (for example, >> C:\Temp\), it fails: >> C:\Temp\ >> yyy\bar.exe >> >> Unhandled Exception: System.IO.FileNotFoundException: The system cannot >> find the file specified. (Exception from HRESULT: 0x80070002) >> at System.Reflection.Assembly.nLoadFile(String path, Evidence evidence) >> at System.Reflection.Assembly.LoadFile(String path) >> at PythonMain.Main() >> >> ==== >> >> All I want is to be able to execute the compiled python scripts from >> whatever directory I want, and not just the directory in which the binary >> and all assemblies are in. Is it possilble? >> >> >> On Sat, Dec 13, 2008 at 4:43 PM, Michael Foord > fuzzyman at voidspace.org.uk>> wrote: >> >> Guy Rozendorn wrote: >> >> I'm using the IronPython 2.0, final version, and the >> corresponding pyc.py >> >> Well, in which case you need to include *all* the IronPython >> assemblies and not just IronPython.dll and IronPythonModules.dll. >> >> All the best, >> >> Michael Foord >> >> >> >> and they both reside in C:\Temp\myProg.exe, along with >> IronPython.dll and IronPythonModules.dll >> >> >> It looks like you are using the Pyc.py sample with >> IronPython 1. >> Can you update to IronPython 2 and try again. >> >> Thanks >> >> Michael Foord >> >> >> If I try to execute myProg.exe from any other directory >> (i.e - >> I'm in C:\Windows, and running C:\Temp\myProg.exe), I >> get the >> following error: >> Unhandled Exception: System.IO.FileNotFoundException: The >> system cannot find the file specified. (Exception from >> HRESULT >> : 0x80070002) >> at System.Reflection.Assembly.nLoadFile(String path, >> Evidence evidence) >> at System.Reflection.Assembly.LoadFile(String path) >> at PythonMain.Main() >> >> What do I need to do to make myProg.exe run from anywhere? >> Specfically, this bothers me because in deploying Windows >> Services wriiten in IronPython. >> Let's say I just compiled myService.exe, along with >> myService.dll, and they're both in C:\Temp (along with >> IronPython DLLs). >> After I register the service, it fails to start, since the >> current directory of the services.exe (who executes >> myService.exe) is %SystemRoot%\system32 >> If I put myService.dll in the system32 directory, the >> service >> works. >> But I don't want to put myService.dll in system32 (and many >> more dlls that I use). >> >> So, my question is: >> * Can I make the magic that will cause >> myService.exe/myProg.exe to look for its DLL inside the >> directory in which he resides in (and not the current >> directory)? >> * It is possible to include myService.dll and >> IronPython.dll >> and IronPythonModules.dll inside myService.exe (so I >> could do >> import sys and then append to path which ever directries I >> wish for)? >> >> Thanks, >> Guy >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> >> > > >> >> >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> >> -- http://www.ironpythoninaction.com/ >> http://www.voidspace.org.uk/blog >> >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> >> > > >> >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> >> >> -- http://www.ironpythoninaction.com/ >> http://www.voidspace.org.uk/blog >> >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mbrown at dynamicfunds.com Sun Dec 14 22:31:21 2008 From: mbrown at dynamicfunds.com (Brown, Matt) Date: Sun, 14 Dec 2008 16:31:21 -0500 (EST) Subject: [IronPython] subprocess module Message-ID: <059cf3f17480523c780fb749efcbc8c6.squirrel@www.dynamicfunds.com> Hello, I was glad to see that a subprocess module had been written for use with IronPython; as I'd like to get stdout from plink and os.popen will not handle this, but subprocess.popen will. (http://www.ironpython.info/index.php/The_subprocess_module) However, when I attempt build an IronPython Studio project, it errors upon build citing an error in Program.py: - from Form1 import * - PythonSyntaxErrorException was unhandled by user code (unexpected token if) This seems to happen whenever there is an issue with an import (note that I've sys.path.appended the path containing subprocess.py). Note that I'm completely new to Python, so I assume it's something simple. Any input is appreciated. Thanks, Matt Brown DYNAMIC Capital Management LLC From hernan.martinez at ecc.es Mon Dec 15 13:52:27 2008 From: hernan.martinez at ecc.es (=?iso-8859-1?Q?Hern=E1n_Mart=EDnez_Foffani?=) Date: Mon, 15 Dec 2008 13:52:27 +0100 Subject: [IronPython] Help contents Message-ID: Where does IP find the help content for .NET libraries? I mean, for instance, the output of >>> help(System.DateTime.ToBoolean) Does it parse the Help.2 files? If so where does it look for them? Only under "%ALLUSERSPROFILE%\{Program Data}\Microsoft Help"? Regards, -H. From yashgt at gmail.com Mon Dec 15 14:46:12 2008 From: yashgt at gmail.com (Yash Ganthe) Date: Mon, 15 Dec 2008 19:16:12 +0530 Subject: [IronPython] Preprocessor directives in IronPython 2.0 Message-ID: <4f428e7b0812150546l2ed24c73td1f492f320f5a95a@mail.gmail.com> In C# we can code for conditional compilation such as: public static void Main() { #if DEBUG Console.WriteLine("DEBUG is defined"); #else Console.WriteLine("DEBUG is not defined"); #endif } Is it possible to do the same in IronPython? Does it support preprocessor directives? Thanks, Yash -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Mon Dec 15 15:27:05 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 15 Dec 2008 06:27:05 -0800 Subject: [IronPython] Preprocessor directives in IronPython 2.0 In-Reply-To: <4f428e7b0812150546l2ed24c73td1f492f320f5a95a@mail.gmail.com> References: <4f428e7b0812150546l2ed24c73td1f492f320f5a95a@mail.gmail.com> Message-ID: Nope. Why do you think you want them? Or rather, what's wrong with this: debug = False def Main(): if debug: print 'DEBUG is set' else: print 'DEBUG is not set' On Mon, Dec 15, 2008 at 5:46 AM, Yash Ganthe wrote: > In C# we can code for conditional compilation such as: > public static void Main() > { > #if DEBUG > Console.WriteLine("DEBUG is defined"); > #else > Console.WriteLine("DEBUG is not defined"); > #endif > } > > Is it possible to do the same in IronPython? Does it support preprocessor > directives? > > Thanks, > Yash > > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom.wright at resolversystems.com Mon Dec 15 17:03:38 2008 From: tom.wright at resolversystems.com (Tom Wright) Date: Mon, 15 Dec 2008 16:03:38 +0000 Subject: [IronPython] IronPython and file descriptors Message-ID: <49467FDA.5000101@resolversystems.com> Hi, At the moment file.fileno() returns an arbitrary identifier of a python file rather than a true file descriptor. This is semi-blocking the Ironclad port of PIL. Code in PIL gets an integer using fileno() and passes it directly to C code where a call to write() is made. To fix this one would have to patch PIL, IronPython's file objects or the write function provided to C code - none of these feel like a good course of action. When ctypes is ported to IronPython this may create similar problems. Ideally fileno() would return a real file descriptor. Would this be possible? Thanks, Tom Resolver Systems From curt at hagenlocher.org Mon Dec 15 18:28:04 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 15 Dec 2008 09:28:04 -0800 Subject: [IronPython] IronPython and file descriptors In-Reply-To: <49467FDA.5000101@resolversystems.com> References: <49467FDA.5000101@resolversystems.com> Message-ID: There's no such thing as a file descriptor number in .NET -- or, for that matter, in Windows itself! :) (The latter is something of a semantic point, of course, as a HANDLE serves something of the same role in Win32 as a file descriptor number does in Unix.) If you have a FileStream, I think you can turn it into a Windows HANDLE by saying IntPtr handle = stream.SafeFileHandle.DangerousGetHandle(); The C library should have a way to convert a HANDLE into a "file descriptor", though I wasn't able to identify the function name with a quick google. I don't see a way to get handles for stdin, stdout or stderr, though, except that these ought to be easy to translate by hand. On Mon, Dec 15, 2008 at 8:03 AM, Tom Wright wrote: > Hi, > > At the moment file.fileno() returns an arbitrary identifier of a python > file rather than a true file descriptor. This is semi-blocking the Ironclad > port of PIL. > > Code in PIL gets an integer using fileno() and passes it directly to C code > where a call to write() is made. To fix this one would have to patch PIL, > IronPython's file objects or the write function provided to C code - none of > these feel like a good course of action. > > When ctypes is ported to IronPython this may create similar problems. > Ideally fileno() would return a real file descriptor. Would this be > possible? > > Thanks, > > Tom > Resolver Systems > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom.wright at resolversystems.com Mon Dec 15 18:37:04 2008 From: tom.wright at resolversystems.com (Tom Wright) Date: Mon, 15 Dec 2008 17:37:04 +0000 Subject: [IronPython] IronPython and file descriptors In-Reply-To: References: <49467FDA.5000101@resolversystems.com> Message-ID: <494695C0.9040401@resolversystems.com> Not so: Though admittedly you have to do quite a bit of work to get the file descriptor into .NET. http://msdn.microsoft.com/en-us/library/bdts1c9x(VS.71).aspx To clarify - the C library was written to work with Python (not IronPython) and is not my code. Thanks, Tom Curt Hagenlocher wrote: > > There's no such thing as a file descriptor number in .NET -- or, for > that matter, in Windows itself! :) (The latter is something of a > semantic point, of course, as a HANDLE serves something of the same > role in Win32 as a file descriptor number does in Unix.) > > If you have a FileStream, I think you can turn it into a Windows > HANDLE by saying > IntPtr handle = stream.SafeFileHandle.DangerousGetHandle(); > The C library should have a way to convert a HANDLE into a "file > descriptor", though I wasn't able to identify the function name with a > quick google. > I don't see a way to get handles for stdin, stdout or stderr, though, > except that these ought to be easy to translate by hand. > > On Mon, Dec 15, 2008 at 8:03 AM, Tom Wright > > wrote: > > Hi, > > At the moment file.fileno() returns an arbitrary identifier of a > python file rather than a true file descriptor. This is > semi-blocking the Ironclad port of PIL. > > Code in PIL gets an integer using fileno() and passes it directly > to C code where a call to write() is made. To fix this one would > have to patch PIL, IronPython's file objects or the write function > provided to C code - none of these feel like a good course of action. > > When ctypes is ported to IronPython this may create similar > problems. Ideally fileno() would return a real file descriptor. > Would this be possible? > > Thanks, > > Tom > Resolver Systems > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From curt at hagenlocher.org Mon Dec 15 18:47:19 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 15 Dec 2008 09:47:19 -0800 Subject: [IronPython] IronPython and file descriptors In-Reply-To: <494695C0.9040401@resolversystems.com> References: <49467FDA.5000101@resolversystems.com> <494695C0.9040401@resolversystems.com> Message-ID: Ah, that was the function I was looking for. Sure, the file descriptor exists in the C library under Windows. But the C library is basically doing exactly the same thing as IronPython is; it's maintaining the file descriptor number as an abstraction on top of the HANDLE that the operating system knows about. So we're dealing two similar abstractions with entirely unrelated interfaces: IronPython fd built on top of .NET stream built on top of Windows HANDLE, vs clib fd built directly on top of Windows HANDLE To get from the IronPython fd to a clib fd, you need to translate down the first chain and up the second. On Mon, Dec 15, 2008 at 9:37 AM, Tom Wright wrote: > Not so: Though admittedly you have to do quite a bit of work to get the > file descriptor into .NET. > http://msdn.microsoft.com/en-us/library/bdts1c9x(VS.71).aspx > > To clarify - the C library was written to work with Python (not IronPython) > and is not my code. > > Thanks, > Tom > > Curt Hagenlocher wrote: > >> >> There's no such thing as a file descriptor number in .NET -- or, for that >> matter, in Windows itself! :) (The latter is something of a semantic point, >> of course, as a HANDLE serves something of the same role in Win32 as a file >> descriptor number does in Unix.) >> >> If you have a FileStream, I think you can turn it into a Windows HANDLE by >> saying >> IntPtr handle = stream.SafeFileHandle.DangerousGetHandle(); >> The C library should have a way to convert a HANDLE into a "file >> descriptor", though I wasn't able to identify the function name with a quick >> google. >> I don't see a way to get handles for stdin, stdout or stderr, though, >> except that these ought to be easy to translate by hand. >> On Mon, Dec 15, 2008 at 8:03 AM, Tom Wright < >> tom.wright at resolversystems.com > >> wrote: >> >> Hi, >> >> At the moment file.fileno() returns an arbitrary identifier of a >> python file rather than a true file descriptor. This is >> semi-blocking the Ironclad port of PIL. >> >> Code in PIL gets an integer using fileno() and passes it directly >> to C code where a call to write() is made. To fix this one would >> have to patch PIL, IronPython's file objects or the write function >> provided to C code - none of these feel like a good course of action. >> >> When ctypes is ported to IronPython this may create similar >> problems. Ideally fileno() would return a real file descriptor. >> Would this be possible? >> >> Thanks, >> >> Tom >> Resolver Systems >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Mon Dec 15 18:56:04 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 15 Dec 2008 09:56:04 -0800 Subject: [IronPython] Help contents In-Reply-To: References: Message-ID: This is generated from the XML document that lives adjacent to the assembly containing the code. For instance, mscorlib is typically located someplace like C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll, so the XML file is taken from C:\Windows\Microsoft.NET\Framework\v2.0.50727\en\mscorlib.xml (assuming CurrentCulture is English). The source code for this can be found in DocBuilder.cs On Mon, Dec 15, 2008 at 4:52 AM, Hern?n Mart?nez Foffani < hernan.martinez at ecc.es> wrote: > Where does IP find the help content for .NET libraries? > I mean, for instance, the output of > >>> help(System.DateTime.ToBoolean) > > Does it parse the Help.2 files? If so where does it look > for them? Only under "%ALLUSERSPROFILE%\{Program Data}\Microsoft Help"? > > Regards, > -H. > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom.wright at resolversystems.com Mon Dec 15 19:18:46 2008 From: tom.wright at resolversystems.com (Tom Wright) Date: Mon, 15 Dec 2008 18:18:46 +0000 Subject: [IronPython] IronPython and file descriptors In-Reply-To: References: <49467FDA.5000101@resolversystems.com> <494695C0.9040401@resolversystems.com> Message-ID: <49469F86.8040901@resolversystems.com> Agreed. It is certainly possible with some work to get a file descriptor and pass it to C code. This is not the problem, however. Ironclad's aim (eventually) is to allow *arbitrary* C extensions to work with Ironpython without changing the extensions. Ctypes aim is to allow arbitrary C code to be run by python (possibly in other python libraries which you really don't want to modify). In CPython .fileno() is a file descriptor and some modules use this fact (specifically PIL) by passing file descriptors as integers into C code. I do not know how one can make this code work in IronPython unless .fileno() returns a file descriptor. The game here is not making a particular C library work with IronPython by modifying this library but making as many libraries as possible work without modification. Of course whether this is worthwhile depends on how many libraries rely on this fact. Sorry - I hope this is a little clearer. Tom Curt Hagenlocher wrote: > Ah, that was the function I was looking for. > > Sure, the file descriptor exists in the C library under Windows. But > the C library is basically doing exactly the same thing as IronPython > is; it's maintaining the file descriptor number as an abstraction on > top of the HANDLE that the operating system knows about. So we're > dealing two similar abstractions with entirely unrelated interfaces: > > IronPython fd built on top of .NET stream built on top of Windows > HANDLE, vs > clib fd built directly on top of Windows HANDLE > > To get from the IronPython fd to a clib fd, you need to translate down > the first chain and up the second. > On Mon, Dec 15, 2008 at 9:37 AM, Tom Wright > > wrote: > > Not so: Though admittedly you have to do quite a bit of work to > get the file descriptor into .NET. > http://msdn.microsoft.com/en-us/library/bdts1c9x(VS.71).aspx > > > To clarify - the C library was written to work with Python (not > IronPython) and is not my code. > > Thanks, > Tom > > Curt Hagenlocher wrote: > > > There's no such thing as a file descriptor number in .NET -- > or, for that matter, in Windows itself! :) (The latter is > something of a semantic point, of course, as a HANDLE serves > something of the same role in Win32 as a file descriptor > number does in Unix.) > > If you have a FileStream, I think you can turn it into a > Windows HANDLE by saying > IntPtr handle = stream.SafeFileHandle.DangerousGetHandle(); > The C library should have a way to convert a HANDLE into a > "file descriptor", though I wasn't able to identify the > function name with a quick google. > I don't see a way to get handles for stdin, stdout or stderr, > though, except that these ought to be easy to translate by hand. > On Mon, Dec 15, 2008 at 8:03 AM, Tom Wright > > >> wrote: > > Hi, > > At the moment file.fileno() returns an arbitrary identifier > of a > python file rather than a true file descriptor. This is > semi-blocking the Ironclad port of PIL. > > Code in PIL gets an integer using fileno() and passes it > directly > to C code where a call to write() is made. To fix this one > would > have to patch PIL, IronPython's file objects or the write > function > provided to C code - none of these feel like a good course > of action. > > When ctypes is ported to IronPython this may create similar > problems. Ideally fileno() would return a real file descriptor. > Would this be possible? > > Thanks, > > Tom > Resolver Systems > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > > > > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From slide.o.mix at gmail.com Mon Dec 15 19:21:27 2008 From: slide.o.mix at gmail.com (Slide) Date: Mon, 15 Dec 2008 11:21:27 -0700 Subject: [IronPython] IronPython and file descriptors In-Reply-To: <49469F86.8040901@resolversystems.com> References: <49467FDA.5000101@resolversystems.com> <494695C0.9040401@resolversystems.com> <49469F86.8040901@resolversystems.com> Message-ID: On Mon, Dec 15, 2008 at 11:18 AM, Tom Wright wrote: > Agreed. It is certainly possible with some work to get a file descriptor and > pass it to C code. > > This is not the problem, however. Ironclad's aim (eventually) is to allow > *arbitrary* C extensions to work with Ironpython without changing the > extensions. Ctypes aim is to allow arbitrary C code to be run by python > (possibly in other python libraries which you really don't want to modify). > > In CPython .fileno() is a file descriptor and some modules use this fact > (specifically PIL) by passing file descriptors as integers into C code. I do > not know how one can make this code work in IronPython unless .fileno() > returns a file descriptor. > > The game here is not making a particular C library work with IronPython by > modifying this library but making as many libraries as possible work without > modification. Of course whether this is worthwhile depends on how many > libraries rely on this fact. > > Sorry - I hope this is a little clearer. > > Tom How does CPython get the file descriptor for fileno()? Does it just return the HANDLE on Windows? slide From dinov at microsoft.com Mon Dec 15 19:20:47 2008 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 15 Dec 2008 10:20:47 -0800 Subject: [IronPython] Preprocessor directives in IronPython 2.0 In-Reply-To: References: <4f428e7b0812150546l2ed24c73td1f492f320f5a95a@mail.gmail.com> Message-ID: <350E7D38B6D819428718949920EC2355564B62EA68@NA-EXMSG-C102.redmond.corp.microsoft.com> The one form this is available is with the assert keyword. Assert statements will be removed in optimized code so you don't have the if debug check. But they won't let you have the else branch. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher Sent: Monday, December 15, 2008 6:27 AM To: Discussion of IronPython Subject: Re: [IronPython] Preprocessor directives in IronPython 2.0 Nope. Why do you think you want them? Or rather, what's wrong with this: debug = False def Main(): if debug: print 'DEBUG is set' else: print 'DEBUG is not set' On Mon, Dec 15, 2008 at 5:46 AM, Yash Ganthe > wrote: In C# we can code for conditional compilation such as: public static void Main() { #if DEBUG Console.WriteLine("DEBUG is defined"); #else Console.WriteLine("DEBUG is not defined"); #endif } Is it possible to do the same in IronPython? Does it support preprocessor directives? Thanks, Yash _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Mon Dec 15 19:27:35 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 15 Dec 2008 10:27:35 -0800 Subject: [IronPython] IronPython and file descriptors In-Reply-To: <49469F86.8040901@resolversystems.com> References: <49467FDA.5000101@resolversystems.com> <494695C0.9040401@resolversystems.com> <49469F86.8040901@resolversystems.com> Message-ID: I think I understand the motivation pretty well; what I'm saying is that I don't see that this is possible. IronPython has no access to the table being used by the C library to map between Windows HANDLEs and clib file descriptors, so we can't return a clib-compatible fd. Even if we were to return a Windows HANDLE as the fd from IronPython (something which is bad in several ways), this wouldn't be a value that could just be used directly by the C extension through the C library. On Mon, Dec 15, 2008 at 10:18 AM, Tom Wright wrote: > Agreed. It is certainly possible with some work to get a file descriptor > and pass it to C code. > > This is not the problem, however. Ironclad's aim (eventually) is to allow > *arbitrary* C extensions to work with Ironpython without changing the > extensions. Ctypes aim is to allow arbitrary C code to be run by python > (possibly in other python libraries which you really don't want to modify). > > In CPython .fileno() is a file descriptor and some modules use this fact > (specifically PIL) by passing file descriptors as integers into C code. I do > not know how one can make this code work in IronPython unless .fileno() > returns a file descriptor. > > The game here is not making a particular C library work with IronPython by > modifying this library but making as many libraries as possible work without > modification. Of course whether this is worthwhile depends on how many > libraries rely on this fact. > > Sorry - I hope this is a little clearer. > > Tom > > > Curt Hagenlocher wrote: > >> Ah, that was the function I was looking for. >> Sure, the file descriptor exists in the C library under Windows. But the >> C library is basically doing exactly the same thing as IronPython is; it's >> maintaining the file descriptor number as an abstraction on top of the >> HANDLE that the operating system knows about. So we're dealing two similar >> abstractions with entirely unrelated interfaces: >> >> IronPython fd built on top of .NET stream built on top of Windows HANDLE, >> vs >> clib fd built directly on top of Windows HANDLE >> To get from the IronPython fd to a clib fd, you need to translate down >> the first chain and up the second. >> On Mon, Dec 15, 2008 at 9:37 AM, Tom Wright < >> tom.wright at resolversystems.com > >> wrote: >> >> Not so: Though admittedly you have to do quite a bit of work to >> get the file descriptor into .NET. >> http://msdn.microsoft.com/en-us/library/bdts1c9x(VS.71).aspx >> >> >> >> To clarify - the C library was written to work with Python (not >> IronPython) and is not my code. >> >> Thanks, >> Tom >> >> Curt Hagenlocher wrote: >> >> >> There's no such thing as a file descriptor number in .NET -- >> or, for that matter, in Windows itself! :) (The latter is >> something of a semantic point, of course, as a HANDLE serves >> something of the same role in Win32 as a file descriptor >> number does in Unix.) >> >> If you have a FileStream, I think you can turn it into a >> Windows HANDLE by saying >> IntPtr handle = stream.SafeFileHandle.DangerousGetHandle(); >> The C library should have a way to convert a HANDLE into a >> "file descriptor", though I wasn't able to identify the >> function name with a quick google. >> I don't see a way to get handles for stdin, stdout or stderr, >> though, except that these ought to be easy to translate by hand. >> On Mon, Dec 15, 2008 at 8:03 AM, Tom Wright >> > >> > >> wrote: >> >> Hi, >> >> At the moment file.fileno() returns an arbitrary identifier >> of a >> python file rather than a true file descriptor. This is >> semi-blocking the Ironclad port of PIL. >> >> Code in PIL gets an integer using fileno() and passes it >> directly >> to C code where a call to write() is made. To fix this one >> would >> have to patch PIL, IronPython's file objects or the write >> function >> provided to C code - none of these feel like a good course >> of action. >> >> When ctypes is ported to IronPython this may create similar >> problems. Ideally fileno() would return a real file descriptor. >> Would this be possible? >> >> Thanks, >> >> Tom >> Resolver Systems >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> >> > > >> >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> >> >> ------------------------------------------------------------------------ >> >> >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hernan.martinez at ecc.es Mon Dec 15 19:45:38 2008 From: hernan.martinez at ecc.es (=?iso-8859-1?Q?Hern=E1n_Mart=EDnez_Foffani?=) Date: Mon, 15 Dec 2008 19:45:38 +0100 Subject: [IronPython] Help contents In-Reply-To: Message-ID: It seems clear now, thank you. Reading DocBuilder.cs:GetXPathDocument(..) I assume that if I want to let our users to be able to get IP console help on our own C# libraries, we can place the XML docs in a culture subdirectory under the DLLs install directory, right? > This is generated from the XML document that lives adjacent to the > assembly containing the code. For instance, mscorlib is typically > located someplace like > C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll, so the > XML file is taken from > C:\Windows\Microsoft.NET\Framework\v2.0.50727\en\mscorlib.xml > (assuming CurrentCulture is English). > > The source code for this can be found in DocBuilder.cs > > > On Mon, Dec 15, 2008 at 4:52 AM, Hern?n Mart?nez Foffani > wrote: > > Where does IP find the help content for .NET libraries? > I mean, for instance, the output of > >>> help(System.DateTime.ToBoolean) > > Does it parse the Help.2 files? If so where does it look > for them? Only under "%ALLUSERSPROFILE%\{Program Data}\Microsoft > Help"? > From dinov at microsoft.com Mon Dec 15 19:49:46 2008 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 15 Dec 2008 10:49:46 -0800 Subject: [IronPython] IronPython and file descriptors In-Reply-To: References: <49467FDA.5000101@resolversystems.com> <494695C0.9040401@resolversystems.com> <49469F86.8040901@resolversystems.com> Message-ID: <350E7D38B6D819428718949920EC2355564B62EAC4@NA-EXMSG-C102.redmond.corp.microsoft.com> Presumably CPython is linking against msvcrt and is using the C abstraction rather than calling the Win32 APIs which return handles directly. As Curt said the biggest problem for us is that .NET does not expose C file descriptors. Therefore we could fix this by P/Invoking out to msvcrt. For users on other platforms we'd need to either add support for their platform or hope that their handles == C runtime file descriptors. For something like fileno maybe this is ok because it's an interop point only - or are there any non-interop uses of fileno in the world? What do people think of this? This would be the 1st place where we would add a P/Invoke so I'd want to tread lightly and make sure this is really the right thing to do. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Slide Sent: Monday, December 15, 2008 10:21 AM To: Discussion of IronPython Subject: Re: [IronPython] IronPython and file descriptors On Mon, Dec 15, 2008 at 11:18 AM, Tom Wright wrote: > Agreed. It is certainly possible with some work to get a file descriptor and > pass it to C code. > > This is not the problem, however. Ironclad's aim (eventually) is to allow > *arbitrary* C extensions to work with Ironpython without changing the > extensions. Ctypes aim is to allow arbitrary C code to be run by python > (possibly in other python libraries which you really don't want to modify). > > In CPython .fileno() is a file descriptor and some modules use this fact > (specifically PIL) by passing file descriptors as integers into C code. I do > not know how one can make this code work in IronPython unless .fileno() > returns a file descriptor. > > The game here is not making a particular C library work with IronPython by > modifying this library but making as many libraries as possible work without > modification. Of course whether this is worthwhile depends on how many > libraries rely on this fact. > > Sorry - I hope this is a little clearer. > > Tom How does CPython get the file descriptor for fileno()? Does it just return the HANDLE on Windows? slide _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From curt at hagenlocher.org Mon Dec 15 19:50:19 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 15 Dec 2008 10:50:19 -0800 Subject: [IronPython] Help contents In-Reply-To: References: Message-ID: If you have only one version/culture, I believe you can just place the XML doc in the same directory as the DLL. On Mon, Dec 15, 2008 at 10:45 AM, Hern?n Mart?nez Foffani < hernan.martinez at ecc.es> wrote: > It seems clear now, thank you. > > Reading DocBuilder.cs:GetXPathDocument(..) I assume that if I want > to let our users to be able to get IP console help on our own C# > libraries, we can place the XML docs in a culture subdirectory under > the DLLs install directory, right? > > > > This is generated from the XML document that lives adjacent to the > > assembly containing the code. For instance, mscorlib is typically > > located someplace like > > C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll, so the > > XML file is taken from > > C:\Windows\Microsoft.NET\Framework\v2.0.50727\en\mscorlib.xml > > (assuming CurrentCulture is English). > > > > The source code for this can be found in DocBuilder.cs > > > > > > On Mon, Dec 15, 2008 at 4:52 AM, Hern?n Mart?nez Foffani > > wrote: > > > > Where does IP find the help content for .NET libraries? > > I mean, for instance, the output of > > >>> help(System.DateTime.ToBoolean) > > > > Does it parse the Help.2 files? If so where does it look > > for them? Only under "%ALLUSERSPROFILE%\{Program Data}\Microsoft > > Help"? > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Mon Dec 15 20:32:03 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 15 Dec 2008 11:32:03 -0800 Subject: [IronPython] IronPython and file descriptors In-Reply-To: <350E7D38B6D819428718949920EC2355564B62EAC4@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <49467FDA.5000101@resolversystems.com> <494695C0.9040401@resolversystems.com> <49469F86.8040901@resolversystems.com> <350E7D38B6D819428718949920EC2355564B62EAC4@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: I guess I'm too much of a purist when it comes to managed code. But it would make me sad to P/Invoke by default for this purpose, even if "Mono compatibility" is the only real counterargument I can muster. On Mon, Dec 15, 2008 at 10:49 AM, Dino Viehland wrote: > Presumably CPython is linking against msvcrt and is using the C abstraction > rather than calling the Win32 APIs which return handles directly. > > As Curt said the biggest problem for us is that .NET does not expose C file > descriptors. Therefore we could fix this by P/Invoking out to msvcrt. For > users on other platforms we'd need to either add support for their platform > or hope that their handles == C runtime file descriptors. For something > like fileno maybe this is ok because it's an interop point only - or are > there any non-interop uses of fileno in the world? > > What do people think of this? This would be the 1st place where we would > add a P/Invoke so I'd want to tread lightly and make sure this is really the > right thing to do. > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] On Behalf Of Slide > Sent: Monday, December 15, 2008 10:21 AM > To: Discussion of IronPython > Subject: Re: [IronPython] IronPython and file descriptors > > On Mon, Dec 15, 2008 at 11:18 AM, Tom Wright > wrote: > > Agreed. It is certainly possible with some work to get a file descriptor > and > > pass it to C code. > > > > This is not the problem, however. Ironclad's aim (eventually) is to allow > > *arbitrary* C extensions to work with Ironpython without changing the > > extensions. Ctypes aim is to allow arbitrary C code to be run by python > > (possibly in other python libraries which you really don't want to > modify). > > > > In CPython .fileno() is a file descriptor and some modules use this fact > > (specifically PIL) by passing file descriptors as integers into C code. I > do > > not know how one can make this code work in IronPython unless .fileno() > > returns a file descriptor. > > > > The game here is not making a particular C library work with IronPython > by > > modifying this library but making as many libraries as possible work > without > > modification. Of course whether this is worthwhile depends on how many > > libraries rely on this fact. > > > > Sorry - I hope this is a little clearer. > > > > Tom > > > How does CPython get the file descriptor for fileno()? Does it just > return the HANDLE on Windows? > > slide > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jslutter at reactorzero.com Mon Dec 15 21:14:51 2008 From: jslutter at reactorzero.com (Jeff Slutter) Date: Mon, 15 Dec 2008 15:14:51 -0500 Subject: [IronPython] Determine the classes/interfaces a Python implements Message-ID: <4946BABB.2080905@reactorzero.com> I have a Python script that creates a class within it. This Python class is derived off of a class, or interface, I made in C# - something like: class MyClass(Test.MainForm.IScript): ... Now, back in C#, I have gotten access to "MyClass" by: object myclass = someScope.GetVariable("MyClass"); Is there a way to determine either: a) what classes/interfaces MyClass implements OR b) if it implements a specific class/interface I want to know if the "object myclass" is supposed to implement Test.MainForm.IScript or not. I don't want to create an instance of MyClass as this would cause problems, executing things I'm not ready to execute. Also, related but not as important, implementing an interface (as above) doesn't cause any compiler errors if I'm missing functions - is there a way to enforce this? Thanks, Jeff From fuzzyman at gmail.com Mon Dec 15 21:52:43 2008 From: fuzzyman at gmail.com (Michael Foord) Date: Mon, 15 Dec 2008 20:52:43 +0000 Subject: [IronPython] IronPython and file descriptors In-Reply-To: <350E7D38B6D819428718949920EC2355564B62EAC4@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <49467FDA.5000101@resolversystems.com> <494695C0.9040401@resolversystems.com> <49469F86.8040901@resolversystems.com> <350E7D38B6D819428718949920EC2355564B62EAC4@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <6f4025010812151252p2bb355d7p1b9d915c0b033016@mail.gmail.com> 2008/12/15 Dino Viehland > Presumably CPython is linking against msvcrt and is using the C abstraction > rather than calling the Win32 APIs which return handles directly. > > As Curt said the biggest problem for us is that .NET does not expose C file > descriptors. Therefore we could fix this by P/Invoking out to msvcrt. For > users on other platforms we'd need to either add support for their platform > or hope that their handles == C runtime file descriptors. For something > like fileno maybe this is ok because it's an interop point only - or are > there any non-interop uses of fileno in the world? > > What do people think of this? This would be the 1st place where we would > add a P/Invoke so I'd want to tread lightly and make sure this is really the > right thing to do. Well, some way of doing this is needed if certain Python C extensions are to work with Ironclad. Perhaps a global or per engine setting that allows file handles to be associated with a C descriptor. Users of Ironclad could switch it on if they wished and take the consequences. Michael Foord > > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] On Behalf Of Slide > Sent: Monday, December 15, 2008 10:21 AM > To: Discussion of IronPython > Subject: Re: [IronPython] IronPython and file descriptors > > On Mon, Dec 15, 2008 at 11:18 AM, Tom Wright > wrote: > > Agreed. It is certainly possible with some work to get a file descriptor > and > > pass it to C code. > > > > This is not the problem, however. Ironclad's aim (eventually) is to allow > > *arbitrary* C extensions to work with Ironpython without changing the > > extensions. Ctypes aim is to allow arbitrary C code to be run by python > > (possibly in other python libraries which you really don't want to > modify). > > > > In CPython .fileno() is a file descriptor and some modules use this fact > > (specifically PIL) by passing file descriptors as integers into C code. I > do > > not know how one can make this code work in IronPython unless .fileno() > > returns a file descriptor. > > > > The game here is not making a particular C library work with IronPython > by > > modifying this library but making as many libraries as possible work > without > > modification. Of course whether this is worthwhile depends on how many > > libraries rely on this fact. > > > > Sorry - I hope this is a little clearer. > > > > Tom > > > How does CPython get the file descriptor for fileno()? Does it just > return the HANDLE on Windows? > > slide > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Mon Dec 15 22:20:18 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 15 Dec 2008 21:20:18 +0000 Subject: [IronPython] Determine the classes/interfaces a Python implements In-Reply-To: <4946BABB.2080905@reactorzero.com> References: <4946BABB.2080905@reactorzero.com> Message-ID: <4946CA12.4050600@voidspace.org.uk> Hi Jeff, Probably the easiest way of doing this is to define a Python function that uses issubtype. You can use this as a delegate from the C# side (warning untested): ScriptScope scope = engine.CreateScope(); ScriptSource imports = engine.CreateScriptSourceFromString("from System import ISomething", SourceCodeKind.Staatements); imports.Execute(scope); ScriptSource source = engine.CreateScriptSourceFromString("lambda x: issubtype(x, ISomething)", SourceCodeKind.Expression); Func Implements = (scope)source.Execute(scope); bool result = Implements(some_object); Note that issubtype will barf if you give it anything other than a type, so it may make more sense to define a function with exception handling and pull it out of the scope instead. HTH Michael Foord Jeff Slutter wrote: > I have a Python script that creates a class within it. This Python class > is derived off of a class, or interface, I made in C# - something like: > > class MyClass(Test.MainForm.IScript): > ... > > Now, back in C#, I have gotten access to "MyClass" by: > > object myclass = someScope.GetVariable("MyClass"); > > Is there a way to determine either: > a) what classes/interfaces MyClass implements OR > b) if it implements a specific class/interface > > I want to know if the "object myclass" is supposed to implement > Test.MainForm.IScript or not. > > I don't want to create an instance of MyClass as this would cause > problems, executing things I'm not ready to execute. > > Also, related but not as important, implementing an interface (as above) > doesn't cause any compiler errors if I'm missing functions - is there a > way to enforce this? > > > Thanks, > Jeff > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From sanxiyn at gmail.com Mon Dec 15 22:30:39 2008 From: sanxiyn at gmail.com (Seo Sanghyeon) Date: Tue, 16 Dec 2008 06:30:39 +0900 Subject: [IronPython] Determine the classes/interfaces a Python implements In-Reply-To: <4946CA12.4050600@voidspace.org.uk> References: <4946BABB.2080905@reactorzero.com> <4946CA12.4050600@voidspace.org.uk> Message-ID: <5b0248170812151330u7a6754d4paa688086c0735944@mail.gmail.com> 2008/12/16 Michael Foord : > Probably the easiest way of doing this is to define a Python function that > uses issubtype. You can use this as a delegate from the C# side (warning > untested): You mean issubclass... -- Seo Sanghyeon From dinov at microsoft.com Mon Dec 15 22:29:15 2008 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 15 Dec 2008 13:29:15 -0800 Subject: [IronPython] Determine the classes/interfaces a Python implements In-Reply-To: <4946BABB.2080905@reactorzero.com> References: <4946BABB.2080905@reactorzero.com> Message-ID: <350E7D38B6D819428718949920EC2355564B62EC27@NA-EXMSG-C102.redmond.corp.microsoft.com> You should call PythonOps.IsSubClass and pass in the PythonType and the interface you want to compare it with. The interface can be either a .NET type object or another Python type object (or a tuple, etc...) The not raising on missing functions is a feature :) You could build a meta-class which would look at the incoming arguments and validate that all of the methods in an interface are implemented. That shouldn't be too hard - probably just seomthing like: assert (set(dir(someInterface)) & set(newTypeDict)) == set(dir(someInterface)) -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Slutter Sent: Monday, December 15, 2008 12:15 PM To: Discussion of IronPython Subject: [IronPython] Determine the classes/interfaces a Python implements I have a Python script that creates a class within it. This Python class is derived off of a class, or interface, I made in C# - something like: class MyClass(Test.MainForm.IScript): ... Now, back in C#, I have gotten access to "MyClass" by: object myclass = someScope.GetVariable("MyClass"); Is there a way to determine either: a) what classes/interfaces MyClass implements OR b) if it implements a specific class/interface I want to know if the "object myclass" is supposed to implement Test.MainForm.IScript or not. I don't want to create an instance of MyClass as this would cause problems, executing things I'm not ready to execute. Also, related but not as important, implementing an interface (as above) doesn't cause any compiler errors if I'm missing functions - is there a way to enforce this? Thanks, Jeff _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at microsoft.com Mon Dec 15 22:24:03 2008 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 15 Dec 2008 13:24:03 -0800 Subject: [IronPython] Determine the classes/interfaces a Python implements In-Reply-To: <4946CA12.4050600@voidspace.org.uk> References: <4946BABB.2080905@reactorzero.com> <4946CA12.4050600@voidspace.org.uk> Message-ID: <350E7D38B6D819428718949920EC2355564B62EC17@NA-EXMSG-C102.redmond.corp.microsoft.com> Can you open a feature request on CodePlex? It's certainly an interesting idea to ponder and I'm leaning towards it but there's lots of details to be gotten right. Do you know if this needs to work w/ sockets as well? (There's also the question of can we make it work with sockets? :)) There'll be a bunch of places we need to update (nt, socket, file, select, etc...) so I think it'll have to wait until 2.1 instead of coming in a minor update like 2.0.1. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Monday, December 15, 2008 1:20 PM To: Discussion of IronPython Subject: Re: [IronPython] Determine the classes/interfaces a Python implements Hi Jeff, Probably the easiest way of doing this is to define a Python function that uses issubtype. You can use this as a delegate from the C# side (warning untested): ScriptScope scope = engine.CreateScope(); ScriptSource imports = engine.CreateScriptSourceFromString("from System import ISomething", SourceCodeKind.Staatements); imports.Execute(scope); ScriptSource source = engine.CreateScriptSourceFromString("lambda x: issubtype(x, ISomething)", SourceCodeKind.Expression); Func Implements = (scope)source.Execute(scope); bool result = Implements(some_object); Note that issubtype will barf if you give it anything other than a type, so it may make more sense to define a function with exception handling and pull it out of the scope instead. HTH Michael Foord Jeff Slutter wrote: > I have a Python script that creates a class within it. This Python class > is derived off of a class, or interface, I made in C# - something like: > > class MyClass(Test.MainForm.IScript): > ... > > Now, back in C#, I have gotten access to "MyClass" by: > > object myclass = someScope.GetVariable("MyClass"); > > Is there a way to determine either: > a) what classes/interfaces MyClass implements OR > b) if it implements a specific class/interface > > I want to know if the "object myclass" is supposed to implement > Test.MainForm.IScript or not. > > I don't want to create an instance of MyClass as this would cause > problems, executing things I'm not ready to execute. > > Also, related but not as important, implementing an interface (as above) > doesn't cause any compiler errors if I'm missing functions - is there a > way to enforce this? > > > Thanks, > Jeff > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From curt at hagenlocher.org Mon Dec 15 22:40:17 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 15 Dec 2008 13:40:17 -0800 Subject: [IronPython] Determine the classes/interfaces a Python implements In-Reply-To: <350E7D38B6D819428718949920EC2355564B62EC17@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <4946BABB.2080905@reactorzero.com> <4946CA12.4050600@voidspace.org.uk> <350E7D38B6D819428718949920EC2355564B62EC17@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: (Dino clearly meant this to be a reply to the other thread with respect to C file descriptors. :) On Mon, Dec 15, 2008 at 1:24 PM, Dino Viehland wrote: > Can you open a feature request on CodePlex? It's certainly an interesting > idea to ponder and I'm leaning towards it but there's lots of details to be > gotten right. > > Do you know if this needs to work w/ sockets as well? (There's also the > question of can we make it work with sockets? :)) > > There'll be a bunch of places we need to update (nt, socket, file, select, > etc...) so I think it'll have to wait until 2.1 instead of coming in a minor > update like 2.0.1. > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Monday, December 15, 2008 1:20 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Determine the classes/interfaces a Python > implements > > > Hi Jeff, > > Probably the easiest way of doing this is to define a Python function > that uses issubtype. You can use this as a delegate from the C# side > (warning untested): > > ScriptScope scope = engine.CreateScope(); > ScriptSource imports = engine.CreateScriptSourceFromString("from System > import ISomething", SourceCodeKind.Staatements); > imports.Execute(scope); > ScriptSource source = engine.CreateScriptSourceFromString("lambda x: > issubtype(x, ISomething)", SourceCodeKind.Expression); > Func Implements = (scope)source.Execute(scope); > > bool result = Implements(some_object); > > > Note that issubtype will barf if you give it anything other than a type, > so it may make more sense to define a function with exception handling > and pull it out of the scope instead. > > HTH > > Michael Foord > > > Jeff Slutter wrote: > > I have a Python script that creates a class within it. This Python class > > is derived off of a class, or interface, I made in C# - something like: > > > > class MyClass(Test.MainForm.IScript): > > ... > > > > Now, back in C#, I have gotten access to "MyClass" by: > > > > object myclass = someScope.GetVariable("MyClass"); > > > > Is there a way to determine either: > > a) what classes/interfaces MyClass implements OR > > b) if it implements a specific class/interface > > > > I want to know if the "object myclass" is supposed to implement > > Test.MainForm.IScript or not. > > > > I don't want to create an instance of MyClass as this would cause > > problems, executing things I'm not ready to execute. > > > > Also, related but not as important, implementing an interface (as above) > > doesn't cause any compiler errors if I'm missing functions - is there a > > way to enforce this? > > > > > > Thanks, > > Jeff > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Mon Dec 15 22:39:35 2008 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 15 Dec 2008 13:39:35 -0800 Subject: [IronPython] IronPython and file descriptors In-Reply-To: <6f4025010812151252p2bb355d7p1b9d915c0b033016@mail.gmail.com> References: <49467FDA.5000101@resolversystems.com> <494695C0.9040401@resolversystems.com> <49469F86.8040901@resolversystems.com> <350E7D38B6D819428718949920EC2355564B62EAC4@NA-EXMSG-C102.redmond.corp.microsoft.com> <6f4025010812151252p2bb355d7p1b9d915c0b033016@mail.gmail.com> Message-ID: <350E7D38B6D819428718949920EC2355564B62EC42@NA-EXMSG-C102.redmond.corp.microsoft.com> (now I've replied to the correct thread...) Can you open a feature request on CodePlex? It's certainly an interesting idea to ponder and I'm leaning towards it but there's lots of details to be gotten right. Do you know if this needs to work w/ sockets as well? (There's also the question of can we make it work with sockets? :)) There'll be a bunch of places we need to update (nt, socket, file, select, etc...) so I think it'll have to wait until 2.1 instead of coming in a minor update like 2.0.1. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Monday, December 15, 2008 12:53 PM To: Discussion of IronPython Subject: Re: [IronPython] IronPython and file descriptors 2008/12/15 Dino Viehland > Presumably CPython is linking against msvcrt and is using the C abstraction rather than calling the Win32 APIs which return handles directly. As Curt said the biggest problem for us is that .NET does not expose C file descriptors. Therefore we could fix this by P/Invoking out to msvcrt. For users on other platforms we'd need to either add support for their platform or hope that their handles == C runtime file descriptors. For something like fileno maybe this is ok because it's an interop point only - or are there any non-interop uses of fileno in the world? What do people think of this? This would be the 1st place where we would add a P/Invoke so I'd want to tread lightly and make sure this is really the right thing to do. Well, some way of doing this is needed if certain Python C extensions are to work with Ironclad. Perhaps a global or per engine setting that allows file handles to be associated with a C descriptor. Users of Ironclad could switch it on if they wished and take the consequences. Michael Foord -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Slide Sent: Monday, December 15, 2008 10:21 AM To: Discussion of IronPython Subject: Re: [IronPython] IronPython and file descriptors On Mon, Dec 15, 2008 at 11:18 AM, Tom Wright > wrote: > Agreed. It is certainly possible with some work to get a file descriptor and > pass it to C code. > > This is not the problem, however. Ironclad's aim (eventually) is to allow > *arbitrary* C extensions to work with Ironpython without changing the > extensions. Ctypes aim is to allow arbitrary C code to be run by python > (possibly in other python libraries which you really don't want to modify). > > In CPython .fileno() is a file descriptor and some modules use this fact > (specifically PIL) by passing file descriptors as integers into C code. I do > not know how one can make this code work in IronPython unless .fileno() > returns a file descriptor. > > The game here is not making a particular C library work with IronPython by > modifying this library but making as many libraries as possible work without > modification. Of course whether this is worthwhile depends on how many > libraries rely on this fact. > > Sorry - I hope this is a little clearer. > > Tom How does CPython get the file descriptor for fileno()? Does it just return the HANDLE on Windows? slide _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- http://www.ironpythoninaction.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Mon Dec 15 22:56:24 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 15 Dec 2008 21:56:24 +0000 Subject: [IronPython] IronPython and file descriptors In-Reply-To: <350E7D38B6D819428718949920EC2355564B62EC42@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <49467FDA.5000101@resolversystems.com> <494695C0.9040401@resolversystems.com> <49469F86.8040901@resolversystems.com> <350E7D38B6D819428718949920EC2355564B62EAC4@NA-EXMSG-C102.redmond.corp.microsoft.com> <6f4025010812151252p2bb355d7p1b9d915c0b033016@mail.gmail.com> <350E7D38B6D819428718949920EC2355564B62EC42@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <4946D288.5020909@voidspace.org.uk> Dino Viehland wrote: > > (now I?ve replied to the correct thread?) > > Can you open a feature request on CodePlex? It's certainly an > interesting idea to ponder and I'm leaning towards it but there's lots > of details to be gotten right. > > Do you know if this needs to work w/ sockets as well? (There's also > the question of can we make it work with sockets? :)) > > There'll be a bunch of places we need to update (nt, socket, file, > select, etc...) so I think it'll have to wait until 2.1 instead of > coming in a minor update like 2.0.1. > Tom will have to comment on whether it is needed for sockets as well. Not yet I guess. :-) Tom created an issue on Codeplex - I've added a comment to that: http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20242 Michael > > *From:* users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Michael Foord > *Sent:* Monday, December 15, 2008 12:53 PM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] IronPython and file descriptors > > 2008/12/15 Dino Viehland > > > Presumably CPython is linking against msvcrt and is using the C > abstraction rather than calling the Win32 APIs which return handles > directly. > > As Curt said the biggest problem for us is that .NET does not expose C > file descriptors. Therefore we could fix this by P/Invoking out to > msvcrt. For users on other platforms we'd need to either add support > for their platform or hope that their handles == C runtime file > descriptors. For something like fileno maybe this is ok because it's > an interop point only - or are there any non-interop uses of fileno in > the world? > > What do people think of this? This would be the 1st place where we > would add a P/Invoke so I'd want to tread lightly and make sure this > is really the right thing to do. > > > > Well, some way of doing this is needed if certain Python C extensions > are to work with Ironclad. Perhaps a global or per engine setting that > allows file handles to be associated with a C descriptor. Users of > Ironclad could switch it on if they wished and take the consequences. > > Michael Foord > > > -----Original Message----- > From: users-bounces at lists.ironpython.com > > [mailto:users-bounces at lists.ironpython.com > ] On Behalf Of Slide > Sent: Monday, December 15, 2008 10:21 AM > To: Discussion of IronPython > Subject: Re: [IronPython] IronPython and file descriptors > > On Mon, Dec 15, 2008 at 11:18 AM, Tom Wright > > wrote: > > Agreed. It is certainly possible with some work to get a file > descriptor and > > pass it to C code. > > > > This is not the problem, however. Ironclad's aim (eventually) is > to allow > > *arbitrary* C extensions to work with Ironpython without > changing the > > extensions. Ctypes aim is to allow arbitrary C code to be run by > python > > (possibly in other python libraries which you really don't want > to modify). > > > > In CPython .fileno() is a file descriptor and some modules use > this fact > > (specifically PIL) by passing file descriptors as integers into > C code. I do > > not know how one can make this code work in IronPython unless > .fileno() > > returns a file descriptor. > > > > The game here is not making a particular C library work with > IronPython by > > modifying this library but making as many libraries as possible > work without > > modification. Of course whether this is worthwhile depends on > how many > > libraries rely on this fact. > > > > Sorry - I hope this is a little clearer. > > > > Tom > > > How does CPython get the file descriptor for fileno()? Does it just > return the HANDLE on Windows? > > slide > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > http://www.ironpythoninaction.com/ > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From dinov at microsoft.com Tue Dec 16 00:00:26 2008 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 15 Dec 2008 15:00:26 -0800 Subject: [IronPython] Compiled dlls and builtin modules In-Reply-To: <2679f6510812120827x173452fbg97ba9ac332d63e92@mail.gmail.com> References: <2679f6510812120827x173452fbg97ba9ac332d63e92@mail.gmail.com> Message-ID: <350E7D38B6D819428718949920EC2355564B62ECF8@NA-EXMSG-C102.redmond.corp.microsoft.com> I think this behavior is currently by design because we're using sys.meta_path which does take precedence over the built-in modules. We could switch to using sys.path_hooks in 2.1 or 3.0 if the consensus is this behavior in undesirable (which would also give control over when pre-compiled modules take precedence over other places on sys.path). Personally I'm +0 to make the change but this would probably break the other recently reported behavior w/ combinations on disk as .py files & precompiled files :) From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Glenn Jones Sent: Friday, December 12, 2008 8:27 AM To: Discussion of IronPython Subject: [IronPython] Compiled dlls and builtin modules Hi all, We are compiling the python standard library (so it can be ngend when it is shipped with Resolver One) and we've discovered that modules in the dll take precedence over builtins. We noticed this because re and socket are included in the standard Lib directory (installed with IPy2) and when we ran against the dll built from the Lib, importing them failed. We have removed the following files from the standard library (and we may have to remove some others): socket, copy_reg, re, sre_compile, sre_constants, sre_parse (the sre_* were referenced in re) A better solution would be for builtin modules to take precedence over modules in referenced assemblies. As an experiment, we created a datetime module that just printed that it was being imported. When we included it in a dll and referenced it, it replaced the builtin datetime. Glenn & Orestis -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Tue Dec 16 00:04:05 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 15 Dec 2008 23:04:05 +0000 Subject: [IronPython] Compiled dlls and builtin modules In-Reply-To: <350E7D38B6D819428718949920EC2355564B62ECF8@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <2679f6510812120827x173452fbg97ba9ac332d63e92@mail.gmail.com> <350E7D38B6D819428718949920EC2355564B62ECF8@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <4946E265.9000802@voidspace.org.uk> Dino Viehland wrote: > > I think this behavior is currently by design because we?re using > sys.meta_path which does take precedence over the built-in modules. We > could switch to using sys.path_hooks in 2.1 or 3.0 if the consensus is > this behavior in undesirable (which would also give control over when > pre-compiled modules take precedence over other places on sys.path). > Personally I?m +0 to make the change but this would probably break the > other recently reported behavior w/ combinations on disk as .py files > & precompiled files J > Another suggestion is that you stop including these unneeded modules in the version of the standard library shipped with the IronPython 2 installer. Michael > *From:* users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Glenn Jones > *Sent:* Friday, December 12, 2008 8:27 AM > *To:* Discussion of IronPython > *Subject:* [IronPython] Compiled dlls and builtin modules > > Hi all, > > We are compiling the python standard library (so it can be ngend when > it is shipped with Resolver One) and we've discovered that modules in > the dll take precedence over builtins. We noticed this because re and > socket are included in the standard Lib directory (installed with > IPy2) and when we ran against the dll built from the Lib, importing > them failed. > > We have removed the following files from the standard library (and we > may have to remove some others): > socket, copy_reg, re, sre_compile, sre_constants, sre_parse (the sre_* > were referenced in re) > > A better solution would be for builtin modules to take precedence over > modules in referenced assemblies. > > As an experiment, we created a datetime module that just printed that > it was being imported. When we included it in a dll and referenced it, > it replaced the builtin datetime. > > Glenn & Orestis > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From curt at hagenlocher.org Tue Dec 16 00:49:45 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 15 Dec 2008 15:49:45 -0800 Subject: [IronPython] Compiled dlls and builtin modules In-Reply-To: <4946E265.9000802@voidspace.org.uk> References: <2679f6510812120827x173452fbg97ba9ac332d63e92@mail.gmail.com> <350E7D38B6D819428718949920EC2355564B62ECF8@NA-EXMSG-C102.redmond.corp.microsoft.com> <4946E265.9000802@voidspace.org.uk> Message-ID: Sounds waaay too easy :P. In the long run, I'd prefer that we implement only the "C" part of these modules and share the Python part with CPython. But this is not only a potentially breaking change, it also would require modification to the standard library for at least the "socket" module. On Mon, Dec 15, 2008 at 3:04 PM, Michael Foord wrote: > Dino Viehland wrote: > >> >> I think this behavior is currently by design because we're using >> sys.meta_path which does take precedence over the built-in modules. We could >> switch to using sys.path_hooks in 2.1 or 3.0 if the consensus is this >> behavior in undesirable (which would also give control over when >> pre-compiled modules take precedence over other places on sys.path). >> Personally I'm +0 to make the change but this would probably break the other >> recently reported behavior w/ combinations on disk as .py files & >> precompiled files J >> >> Another suggestion is that you stop including these unneeded modules in > the version of the standard library shipped with the IronPython 2 installer. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Tue Dec 16 01:29:02 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 15 Dec 2008 16:29:02 -0800 Subject: [IronPython] Invalid construct in DLR's MSBuild file? In-Reply-To: <5b0248170812100239i2abe78fby4c6c20a7fef6daef@mail.gmail.com> References: <5b0248170812100239i2abe78fby4c6c20a7fef6daef@mail.gmail.com> Message-ID: This looks like a problem in quite a few of our csproj files. Could you open up a bug report on CodePlex for this? Thanks, -Curt On Wed, Dec 10, 2008 at 2:39 AM, Seo Sanghyeon wrote: > Hello, now I am trying to use xbuild (open source implementation of > MSBuild language) to build IronPython, and the first error (after > instrumenting the source to make it clear what the error is) is this: > > $ xbuild Microsoft.Scripting.ExtensionAttribute.csproj > XBuild Engine Version 0.1 > Mono, Version 2.3.0.0 > Copyright (C) Marek Sieradzki 2005. All rights reserved. > ConditionParser failed to parse $(SilverlightBuild) != 'true' > > Unhandled Exception: > Microsoft.Build.BuildEngine.InvalidProjectFileException: The requested > feature is not implemented. ---> System.NotImplementedException: The > requested feature is not implemented. > at Microsoft.Build.BuildEngine.ConditionParser.ParseFactorExpression > () [0x00000] > at Microsoft.Build.BuildEngine.ConditionParser.ParseRelationalExpression > () [0x00000] > at Microsoft.Build.BuildEngine.ConditionParser.ParseBooleanOr () [0x00000] > at Microsoft.Build.BuildEngine.ConditionParser.ParseBooleanAnd () > [0x00000] > at Microsoft.Build.BuildEngine.ConditionParser.ParseBooleanExpression > () [0x00000] > at Microsoft.Build.BuildEngine.ConditionParser.ParseExpression () > [0x00000] > at Microsoft.Build.BuildEngine.ConditionParser.ParseCondition > (System.String condition) [0x00000] > --- End of inner exception stack trace --- > at Microsoft.Build.BuildEngine.Project.DoLoad (System.IO.TextReader > textReader) [0x00000] > at Microsoft.Build.BuildEngine.Project.Load (System.String > projectFileName) [0x00000] > at Mono.XBuild.CommandLine.MainClass.Execute () [0x00000] > > According to MSDN, MSBuild Conditions > http://msdn.microsoft.com/en-us/library/7szfhaft.aspx conditions > should be of the form 'stringA' != 'stringB', where "single quotes are > not required for simple alphanumeric strings or boolean values". Is > $(SilverlightBuild) this case? If it isn't, shouldn't it be quoted as > '$(SilverlightBuild)'? > > If I manually change this condition to be quoted (I also note, all > other uses of $(SilverlightBuild) is actually quoted in this file), > xbuild builds this assembly successfully. > > Even if this is actually valid (then I argue documentation is > confusing), I think it would be a good idea to quote this anyway. > > -- > Seo Sanghyeon > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Tue Dec 16 01:36:44 2008 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 15 Dec 2008 16:36:44 -0800 Subject: [IronPython] Compiled dlls and builtin modules In-Reply-To: References: <2679f6510812120827x173452fbg97ba9ac332d63e92@mail.gmail.com> <350E7D38B6D819428718949920EC2355564B62ECF8@NA-EXMSG-C102.redmond.corp.microsoft.com> <4946E265.9000802@voidspace.org.uk> Message-ID: <350E7D38B6D819428718949920EC2355564B62ED93@NA-EXMSG-C102.redmond.corp.microsoft.com> Yeah, I would like to see us more closely match the C modules as well. Socket is particularly challenging though because socket.py depends on the ref counting semantics of CPython's garbage collector. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher Sent: Monday, December 15, 2008 3:50 PM To: Discussion of IronPython Subject: Re: [IronPython] Compiled dlls and builtin modules Sounds waaay too easy :P. In the long run, I'd prefer that we implement only the "C" part of these modules and share the Python part with CPython. But this is not only a potentially breaking change, it also would require modification to the standard library for at least the "socket" module. On Mon, Dec 15, 2008 at 3:04 PM, Michael Foord > wrote: Dino Viehland wrote: I think this behavior is currently by design because we're using sys.meta_path which does take precedence over the built-in modules. We could switch to using sys.path_hooks in 2.1 or 3.0 if the consensus is this behavior in undesirable (which would also give control over when pre-compiled modules take precedence over other places on sys.path). Personally I'm +0 to make the change but this would probably break the other recently reported behavior w/ combinations on disk as .py files & precompiled files J Another suggestion is that you stop including these unneeded modules in the version of the standard library shipped with the IronPython 2 installer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Tue Dec 16 01:37:38 2008 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 15 Dec 2008 16:37:38 -0800 Subject: [IronPython] Compiled dlls and builtin modules In-Reply-To: <4946E265.9000802@voidspace.org.uk> References: <2679f6510812120827x173452fbg97ba9ac332d63e92@mail.gmail.com> <350E7D38B6D819428718949920EC2355564B62ECF8@NA-EXMSG-C102.redmond.corp.microsoft.com> <4946E265.9000802@voidspace.org.uk> Message-ID: <350E7D38B6D819428718949920EC2355564B62ED94@NA-EXMSG-C102.redmond.corp.microsoft.com> Yeah, it's funny, I thought we were supposed to have done that for at least some of them. Maybe these were just missed, but I agree we should definitely do at least that. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Monday, December 15, 2008 3:04 PM To: Discussion of IronPython Subject: Re: [IronPython] Compiled dlls and builtin modules Dino Viehland wrote: > > I think this behavior is currently by design because we're using > sys.meta_path which does take precedence over the built-in modules. We > could switch to using sys.path_hooks in 2.1 or 3.0 if the consensus is > this behavior in undesirable (which would also give control over when > pre-compiled modules take precedence over other places on sys.path). > Personally I'm +0 to make the change but this would probably break the > other recently reported behavior w/ combinations on disk as .py files > & precompiled files J > Another suggestion is that you stop including these unneeded modules in the version of the standard library shipped with the IronPython 2 installer. Michael > *From:* users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Glenn Jones > *Sent:* Friday, December 12, 2008 8:27 AM > *To:* Discussion of IronPython > *Subject:* [IronPython] Compiled dlls and builtin modules > > Hi all, > > We are compiling the python standard library (so it can be ngend when > it is shipped with Resolver One) and we've discovered that modules in > the dll take precedence over builtins. We noticed this because re and > socket are included in the standard Lib directory (installed with > IPy2) and when we ran against the dll built from the Lib, importing > them failed. > > We have removed the following files from the standard library (and we > may have to remove some others): > socket, copy_reg, re, sre_compile, sre_constants, sre_parse (the sre_* > were referenced in re) > > A better solution would be for builtin modules to take precedence over > modules in referenced assemblies. > > As an experiment, we created a datetime module that just printed that > it was being imported. When we included it in a dll and referenced it, > it replaced the builtin datetime. > > Glenn & Orestis > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at microsoft.com Tue Dec 16 08:12:33 2008 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 15 Dec 2008 23:12:33 -0800 Subject: [IronPython] Issue about string.upper and string.lower In-Reply-To: <2679f6510812120727o58a85ec4ub686aeac4dc4820b@mail.gmail.com> References: <2679f6510812120727o58a85ec4ub686aeac4dc4820b@mail.gmail.com> Message-ID: <350E7D38B6D819428718949920EC2355564B62EE33@NA-EXMSG-C102.redmond.corp.microsoft.com> I've actually looked at this not too long ago and I think your proposal of calling the Invariant functions is the correct solution. I was looking at a few things: This bug http://bugs.python.org/issue1528802, the 3.0 decimal.py module, and also just using Turkish I at the command prompt. If you follow the comments the bug says: "String upper and lower conversion are locale dependent and implemented by the underlying libc, whereas Unicode upper/lower conversion is not and only depends on the Unicode character database." That's a pretty clear statement that we shouldn't be using the current locale for our upper/lower string conversions. It wouldn't surprise me if that breaks something somewhere because we won't be doing locale dependent conversions on what someone expects to its type to be str not unicode but in this case I think it'd be better to be consistent with the Unicode side of Python as that's our future. As for the decimal module it doesn't change from 2.x to 3.0. So .upper() apparently doesn't have this problem when CPython switches to Unicode strings. Or at least no one's hit it, and when they do I think the resolution would be the same as 1528802. Finally at the command prompt I could never get CPython to do a culture-sensitive operation. I hadn't fully convinced myself on that part though because I hadn't yet escalated to a Turkish install of the OS running IronPython. But I'm still pretty confident we're at fault and we should change our lower/upper implementation. Obviously the change is easy but I'll do a full test pass to see if it breaks anything. I also think calling ToUpper to get non-Pythonic results is easy enough (I actually think it's kind of better this way - it saves typing out the framework friendly ToUpperInvariant :)). From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Glenn Jones Sent: Friday, December 12, 2008 7:27 AM To: Discussion of IronPython Subject: [IronPython] Issue about string.upper and string.lower Hello everybody, We ran across http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=13629 (turkish collation issues) today while trying to port Resolver One to IronPython 2.0. This is in a test that tries to import decimal while in the turkish locale (it was actually reported by a user!). It does an .upper on a string with an 'i', and that doesn't give the expected results. This is a very big issue because all the python code out there expects string transformations to be locale-independent, and there may be strange bugs in strange places. Is mapping .upper and .lower to ToUpperInvariant and ToLowerInvariant an acceptable solution? People that want to do locale-dependent transformations can always use the .NET specific ToUpper/ToLower. We can work around the decimal being unimportable by hacking it, but clearly this is not a general solution. We will report other modules that might fail from this as we find them. Thanks, Glenn and Orestis -------------- next part -------------- An HTML attachment was scrubbed... URL: From hernan.martinez at ecc.es Tue Dec 16 10:02:18 2008 From: hernan.martinez at ecc.es (=?iso-8859-1?Q?Hern=E1n_Mart=EDnez_Foffani?=) Date: Tue, 16 Dec 2008 10:02:18 +0100 Subject: [IronPython] Help contents In-Reply-To: Message-ID: Thanks a lot again. > If you have only one version/culture, I believe you can just place > the XML doc in the same directory as the DLL. > > >> >> It seems clear now, thank you. >> >> Reading DocBuilder.cs:GetXPathDocument(..) I assume that if I want >> to let our users to be able to get IP console help on our own C# >> libraries, we can place the XML docs in a culture subdirectory under >> the DLLs install directory, right? >> >> From kristian.jaksch at gmail.com Tue Dec 16 10:25:39 2008 From: kristian.jaksch at gmail.com (xkrja) Date: Tue, 16 Dec 2008 01:25:39 -0800 (PST) Subject: [IronPython] Newbie: convert string to python expression?? Message-ID: <21029759.post@talk.nabble.com> Hi, I'm just starting out learning IronPython. How can I convert a string that someone writes in a textbox to a python expression or statement?? Compare it to the console input: If I write for example a=2 in the console it's not just a string I assume? It becomes an expression in the python code or something like that? This is what I got so far: import clr, sys import Microsoft clr.AddReference("Mapack, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null") clr.AddReference('Microsoft.Scripting') clr.AddReference('Microsoft.Scripting.Core') from System.Windows import Application from System.Windows.Controls import UserControl from Mapack import * class Writer(object): def __init__(self, element): self.element = element def write(self, text): self.element.Text = self.element.Text + text def inputBox_KeyDown(s, e): #I want to check the key down events. If 'Enter' is pressed I want the root.message.Text = '' #string that is written in the textbox to be converted to an expression key = e.Key.value__ #or statement or whatever it is if key == 3: #If key '3' (Enter key) is pressed I want the text in "infoBox" to be read and converted? How??? root = Application.Current.LoadRootVisual(UserControl(), "app.xaml") sys.stdout = Writer(root.message) root.inputBox.KeyDown += inputBox_KeyDown Thanks for help! -- View this message in context: http://www.nabble.com/Newbie%3A-convert-string-to-python-expression---tp21029759p21029759.html Sent from the IronPython mailing list archive at Nabble.com. From konryd at gmail.com Tue Dec 16 11:21:56 2008 From: konryd at gmail.com (Konrad Delong) Date: Tue, 16 Dec 2008 11:21:56 +0100 Subject: [IronPython] Newbie: convert string to python expression?? In-Reply-To: <21029759.post@talk.nabble.com> References: <21029759.post@talk.nabble.com> Message-ID: <74401640812160221o18f71aape038806a11bf88f7@mail.gmail.com> 2008/12/16 xkrja : > > Hi, > I'm just starting out learning IronPython. How can I convert a string that > someone writes in a textbox to a python expression or statement?? Compare it > to the console input: If I write for example a=2 in the console it's not > just a string I assume? It becomes an expression in the python code or > something like that If I understood well, you're looking for eval() function. You use it this way: eval("1 + 4") # => 5 In your case: root.message.Text = eval(root.message.Text) eval() is one of the built-in python functions. You can read about rest of them on http://www.python.org/doc/2.5.2/lib/built-in-funcs.html hope that answers your question. Konrad From tom.wright at resolversystems.com Tue Dec 16 12:02:44 2008 From: tom.wright at resolversystems.com (Tom Wright) Date: Tue, 16 Dec 2008 11:02:44 +0000 Subject: [IronPython] IronPython and file descriptors In-Reply-To: <4946D288.5020909@voidspace.org.uk> References: <49467FDA.5000101@resolversystems.com> <494695C0.9040401@resolversystems.com> <49469F86.8040901@resolversystems.com> <350E7D38B6D819428718949920EC2355564B62EAC4@NA-EXMSG-C102.redmond.corp.microsoft.com> <6f4025010812151252p2bb355d7p1b9d915c0b033016@mail.gmail.com> <350E7D38B6D819428718949920EC2355564B62EC42@NA-EXMSG-C102.redmond.corp.microsoft.com> <4946D288.5020909@voidspace.org.uk> Message-ID: <49478AD4.1080002@resolversystems.com> I'm not sure about sockets. The only example I have found in the wild so far is with files in PIL. The python implementation seems to have socket.fileno() returning a file descriptor which comes from 's socketpair function in the standard C library (see socketmodule.c if you are interested) So, again, it would be possible for people to pass this identifier as an integer directly to C. Whether people do this in practice is a different question... Tom Michael Foord wrote: > Dino Viehland wrote: >> >> (now I?ve replied to the correct thread?) >> >> Can you open a feature request on CodePlex? It's certainly an >> interesting idea to ponder and I'm leaning towards it but there's >> lots of details to be gotten right. >> >> Do you know if this needs to work w/ sockets as well? (There's also >> the question of can we make it work with sockets? :)) >> >> There'll be a bunch of places we need to update (nt, socket, file, >> select, etc...) so I think it'll have to wait until 2.1 instead of >> coming in a minor update like 2.0.1. >> > > Tom will have to comment on whether it is needed for sockets as well. > Not yet I guess. :-) > > Tom created an issue on Codeplex - I've added a comment to that: > > http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20242 > > Michael >> >> *From:* users-bounces at lists.ironpython.com >> [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Michael Foord >> *Sent:* Monday, December 15, 2008 12:53 PM >> *To:* Discussion of IronPython >> *Subject:* Re: [IronPython] IronPython and file descriptors >> >> 2008/12/15 Dino Viehland > > >> >> Presumably CPython is linking against msvcrt and is using the C >> abstraction rather than calling the Win32 APIs which return handles >> directly. >> >> As Curt said the biggest problem for us is that .NET does not expose >> C file descriptors. Therefore we could fix this by P/Invoking out to >> msvcrt. For users on other platforms we'd need to either add support >> for their platform or hope that their handles == C runtime file >> descriptors. For something like fileno maybe this is ok because it's >> an interop point only - or are there any non-interop uses of fileno >> in the world? >> >> What do people think of this? This would be the 1st place where we >> would add a P/Invoke so I'd want to tread lightly and make sure this >> is really the right thing to do. >> >> >> >> Well, some way of doing this is needed if certain Python C extensions >> are to work with Ironclad. Perhaps a global or per engine setting >> that allows file handles to be associated with a C descriptor. Users >> of Ironclad could switch it on if they wished and take the consequences. >> >> Michael Foord >> >> >> -----Original Message----- >> From: users-bounces at lists.ironpython.com >> >> [mailto:users-bounces at lists.ironpython.com >> ] On Behalf Of Slide >> Sent: Monday, December 15, 2008 10:21 AM >> To: Discussion of IronPython >> Subject: Re: [IronPython] IronPython and file descriptors >> >> On Mon, Dec 15, 2008 at 11:18 AM, Tom Wright >> > > wrote: >> > Agreed. It is certainly possible with some work to get a file >> descriptor and >> > pass it to C code. >> > >> > This is not the problem, however. Ironclad's aim (eventually) is >> to allow >> > *arbitrary* C extensions to work with Ironpython without >> changing the >> > extensions. Ctypes aim is to allow arbitrary C code to be run by >> python >> > (possibly in other python libraries which you really don't want >> to modify). >> > >> > In CPython .fileno() is a file descriptor and some modules use >> this fact >> > (specifically PIL) by passing file descriptors as integers into >> C code. I do >> > not know how one can make this code work in IronPython unless >> .fileno() >> > returns a file descriptor. >> > >> > The game here is not making a particular C library work with >> IronPython by >> > modifying this library but making as many libraries as possible >> work without >> > modification. Of course whether this is worthwhile depends on >> how many >> > libraries rely on this fact. >> > >> > Sorry - I hope this is a little clearer. >> > >> > Tom >> >> >> How does CPython get the file descriptor for fileno()? Does it just >> return the HANDLE on Windows? >> >> slide >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> >> >> >> -- >> http://www.ironpythoninaction.com/ >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > > From kristian.jaksch at gmail.com Tue Dec 16 12:14:38 2008 From: kristian.jaksch at gmail.com (xkrja) Date: Tue, 16 Dec 2008 03:14:38 -0800 (PST) Subject: [IronPython] Newbie: convert string to python expression?? In-Reply-To: <74401640812160221o18f71aape038806a11bf88f7@mail.gmail.com> References: <21029759.post@talk.nabble.com> <74401640812160221o18f71aape038806a11bf88f7@mail.gmail.com> Message-ID: <21031241.post@talk.nabble.com> Thanks for the reply. This is what I have: def inputBox_KeyDown(s, e): root.message.Text = '' key = e.Key.value__ if key == 3: result = eval(root.inputBox.Text) root.message.Text = str(result) eval() seems to work sometimes. For example if the text in the textbox is 1+1 . But if the text for example is a=1 i get an error "Unexpected token '=' " (This is in Ironpython studio). I guess it is because a=1 is not an expression. What should I use then? What if I don't know what the user will type in? Thanks again! -- View this message in context: http://www.nabble.com/Newbie%3A-convert-string-to-python-expression---tp21029759p21031241.html Sent from the IronPython mailing list archive at Nabble.com. From fuzzyman at voidspace.org.uk Tue Dec 16 12:23:28 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 16 Dec 2008 11:23:28 +0000 Subject: [IronPython] Newbie: convert string to python expression?? In-Reply-To: <21031241.post@talk.nabble.com> References: <21029759.post@talk.nabble.com> <74401640812160221o18f71aape038806a11bf88f7@mail.gmail.com> <21031241.post@talk.nabble.com> Message-ID: <49478FB0.2040803@voidspace.org.uk> xkrja wrote: > Thanks for the reply. This is what I have: > > def inputBox_KeyDown(s, e): > root.message.Text = '' > key = e.Key.value__ > if key == 3: > result = eval(root.inputBox.Text) > root.message.Text = str(result) > > eval() seems to work sometimes. For example if the text in the textbox is > 1+1 . But if the text for example is a=1 i get an error "Unexpected token > '=' " (This is in Ironpython studio). I guess it is because a=1 is not an > expression. What should I use then? What if I don't know what the user will > type in? > > Thanks again! > If you only *want* an expression then a statement is indeed invalid. As you are accepting arbitrary user input then you will need error handling around the eval for when the user enters nonsense (as they are guaranteed to at some point...). You probably want a way to signal to the user what went wrong - perhaps a system message box. Michael -- http://www.ironpythoninaction.com/ From dblank at brynmawr.edu Tue Dec 16 13:00:23 2008 From: dblank at brynmawr.edu (Douglas Blank) Date: Tue, 16 Dec 2008 07:00:23 -0500 (EST) Subject: [IronPython] Newbie: convert string to python expression?? In-Reply-To: <21031241.post@talk.nabble.com> Message-ID: <1040764474.2765171229428823660.JavaMail.root@ganesh.brynmawr.edu> This is just a Python issue (not specific to IronPython). exec is used for statement(s) and eval() for expressions. You might have to: try: eval(root.inputBox.Text) except: exec root.inputBox.Text -Doug ----- xkrja wrote: > > Thanks for the reply. This is what I have: > > def inputBox_KeyDown(s, e): > root.message.Text = '' > key = e.Key.value__ > if key == 3: > result = eval(root.inputBox.Text) > root.message.Text = str(result) > > eval() seems to work sometimes. For example if the text in the textbox is > 1+1 . But if the text for example is a=1 i get an error "Unexpected token > '=' " (This is in Ironpython studio). I guess it is because a=1 is not an > expression. What should I use then? What if I don't know what the user will > type in? > > Thanks again! > -- > View this message in context: http://www.nabble.com/Newbie%3A-convert-string-to-python-expression---tp21029759p21031241.html > Sent from the IronPython mailing list archive at Nabble.com. > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From yashgt at gmail.com Tue Dec 16 13:16:29 2008 From: yashgt at gmail.com (Yash Ganthe) Date: Tue, 16 Dec 2008 17:46:29 +0530 Subject: [IronPython] Modules importing each other Message-ID: <4f428e7b0812160416j3703c6a3h3f93bb4cb898a5aa@mail.gmail.com> I use IronPython 2.0. In Program.py I have: print "hello" DEBUGMODE=0 . . . import LogMessage In LogMessage.py I have from Program import DEBUGMODE When I run : ipy Program.py I observe that "hello" is printed twice: Once when Program.py is run and next when a symbol from Program.py is imported in LogMessage. If one module imports another, does it execute all statements in it even if that module has been loaded before? What do I need to do to avoid it? Program.py and LogMessage.py are both in the same folder. Thanks, Yash -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Tue Dec 16 13:19:22 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 16 Dec 2008 12:19:22 +0000 Subject: [IronPython] Modules importing each other In-Reply-To: <4f428e7b0812160416j3703c6a3h3f93bb4cb898a5aa@mail.gmail.com> References: <4f428e7b0812160416j3703c6a3h3f93bb4cb898a5aa@mail.gmail.com> Message-ID: <49479CCA.6080208@voidspace.org.uk> You would find the same thing in CPython. When you execute Program.py it is run with the name '__main__' (the main program being executed). When you import it, you import it with the name 'Program' which causes it to be imported with a different name. I suggest you put your debug symbol in a separate module that both Program.py and LogMessage.py import from. Michael Foord Yash Ganthe wrote: > I use IronPython 2.0. > > In Program.py I have: > print "hello" > DEBUGMODE=0 > . > . > . > import LogMessage > > In LogMessage.py I have > from Program import DEBUGMODE > > When I run : > ipy Program.py > I observe that "hello" is printed twice: Once when Program.py is run > and next when a symbol from Program.py is imported in LogMessage. If > one module imports another, does it execute all statements in it even > if that module has been loaded before? > What do I need to do to avoid it? > > Program.py and LogMessage.py are both in the same folder. > > Thanks, > Yash > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ From kristian.jaksch at gmail.com Tue Dec 16 13:28:51 2008 From: kristian.jaksch at gmail.com (xkrja) Date: Tue, 16 Dec 2008 04:28:51 -0800 (PST) Subject: [IronPython] Newbie: convert string to python expression?? In-Reply-To: <1040764474.2765171229428823660.JavaMail.root@ganesh.brynmawr.edu> References: <21029759.post@talk.nabble.com> <74401640812160221o18f71aape038806a11bf88f7@mail.gmail.com> <21031241.post@talk.nabble.com> <1040764474.2765171229428823660.JavaMail.root@ganesh.brynmawr.edu> Message-ID: <21032160.post@talk.nabble.com> Thanks for the replies guys. I tried the solution below and it works in some cases. But a strange thing is (remember I'm a newbie) that if I first type, for example a=1 in the "inputBox" and then hit enter, the debugger goes down to exec root.inputBox.Text and nothing is reported so I assume the statement is executed correctly. But if I next time type print a in the "inputBox" the debugger goes down to exec root.inputBox.Text again but now an exception is raised: "name 'a' is not defined". Why is that??? I typed a=1! Thanks! Douglas Blank wrote: > > This is just a Python issue (not specific to IronPython). > > exec is used for statement(s) and eval() for expressions. You might have > to: > > try: > eval(root.inputBox.Text) > except: > exec root.inputBox.Text > > -Doug > > > > -- View this message in context: http://www.nabble.com/Newbie%3A-convert-string-to-python-expression---tp21029759p21032160.html Sent from the IronPython mailing list archive at Nabble.com. From fuzzyman at voidspace.org.uk Tue Dec 16 13:32:24 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 16 Dec 2008 12:32:24 +0000 Subject: [IronPython] Newbie: convert string to python expression?? In-Reply-To: <21032160.post@talk.nabble.com> References: <21029759.post@talk.nabble.com> <74401640812160221o18f71aape038806a11bf88f7@mail.gmail.com> <21031241.post@talk.nabble.com> <1040764474.2765171229428823660.JavaMail.root@ganesh.brynmawr.edu> <21032160.post@talk.nabble.com> Message-ID: <49479FD8.2030501@voidspace.org.uk> xkrja wrote: > Thanks for the replies guys. > > I tried the solution below and it works in some cases. But a strange thing > is (remember I'm a newbie) that if I first type, for example a=1 in the > "inputBox" and then hit enter, the debugger goes down to exec > root.inputBox.Text and nothing is reported so I assume the statement is > executed correctly. > > But if I next time type print a in the "inputBox" the debugger goes down to > exec root.inputBox.Text again but now an exception is raised: "name 'a' is > not defined". Why is that??? I typed a=1! > You've snipped the code so I can't see it exactly, but I'm pretty sure you are doing this inside a method. This will create a new 'scope' every time you enter the method and so you are creating a local variable that disappears when you exit the method. When you exec you can provide a dictionary as a context for the execution to happen in. If you store this as an instance member and re-use the same execution context every time then changes will be 'remembered'. Michael > Thanks! > > > Douglas Blank wrote: > >> This is just a Python issue (not specific to IronPython). >> >> exec is used for statement(s) and eval() for expressions. You might have >> to: >> >> try: >> eval(root.inputBox.Text) >> except: >> exec root.inputBox.Text >> >> -Doug >> >> >> >> >> > > -- http://www.ironpythoninaction.com/ From kristian.jaksch at gmail.com Tue Dec 16 15:25:01 2008 From: kristian.jaksch at gmail.com (xkrja) Date: Tue, 16 Dec 2008 06:25:01 -0800 (PST) Subject: [IronPython] Newbie: convert string to python expression?? In-Reply-To: <49479FD8.2030501@voidspace.org.uk> References: <21029759.post@talk.nabble.com> <74401640812160221o18f71aape038806a11bf88f7@mail.gmail.com> <21031241.post@talk.nabble.com> <1040764474.2765171229428823660.JavaMail.root@ganesh.brynmawr.edu> <21032160.post@talk.nabble.com> <49479FD8.2030501@voidspace.org.uk> Message-ID: <21033977.post@talk.nabble.com> Thanks for the reply. Below is a snippet of what I've got: def inputBox_KeyDown(s, e): root.message.Text = '' key = e.Key.value__ result = root.inputBox.Text if key == 3: #If 'Enter' key is pressed try: root.message.Text = eval(result) except: exec result root = Application.Current.LoadRootVisual(UserControl(), "app.xaml") sys.stdout = Writer(root.message) root.inputBox.KeyDown += inputBox_KeyDown Can't I just put everthing that is evaluated or executed in some kind of global scope so that they can be accessed just like in the console? If not: I looked a little at dictionaries but didn't really understand how to use them in this case? Can someone give me a short example that can be used for my case? Once again, thanks for all help! Michael Foord-5 wrote: > > You've snipped the code so I can't see it exactly, but I'm pretty sure > you are doing this inside a method. This will create a new 'scope' every > time you enter the method and so you are creating a local variable that > disappears when you exit the method. > > When you exec you can provide a dictionary as a context for the > execution to happen in. If you store this as an instance member and > re-use the same execution context every time then changes will be > 'remembered'. > > Michael > -- View this message in context: http://www.nabble.com/Newbie%3A-convert-string-to-python-expression---tp21029759p21033977.html Sent from the IronPython mailing list archive at Nabble.com. From fuzzyman at voidspace.org.uk Tue Dec 16 16:23:57 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 16 Dec 2008 15:23:57 +0000 Subject: [IronPython] Newbie: convert string to python expression?? In-Reply-To: <21033977.post@talk.nabble.com> References: <21029759.post@talk.nabble.com> <74401640812160221o18f71aape038806a11bf88f7@mail.gmail.com> <21031241.post@talk.nabble.com> <1040764474.2765171229428823660.JavaMail.root@ganesh.brynmawr.edu> <21032160.post@talk.nabble.com> <49479FD8.2030501@voidspace.org.uk> <21033977.post@talk.nabble.com> Message-ID: <4947C80D.1070504@voidspace.org.uk> context = {} def inputBox_KeyDown(s, e): root.message.Text = '' key = e.Key.value__ result = root.inputBox.Text if key == 3: #If 'Enter' key is pressed try: try: root.message.Text = eval(result) except SyntaxError: exec result in context except Exception, e: print 'Unhandled exception', e Note the "exec result in context" and my suggested changes to your exception handling. Michael xkrja wrote: > Thanks for the reply. > > Below is a snippet of what I've got: > > def inputBox_KeyDown(s, e): > root.message.Text = '' > key = e.Key.value__ > result = root.inputBox.Text > if key == 3: #If 'Enter' key is pressed > try: > root.message.Text = eval(result) > except: > exec result > > root = Application.Current.LoadRootVisual(UserControl(), "app.xaml") > sys.stdout = Writer(root.message) > > root.inputBox.KeyDown += inputBox_KeyDown > > Can't I just put everthing that is evaluated or executed in some kind of > global scope so that they can be accessed just like in the console? If not: > I looked a little at dictionaries but didn't really understand how to use > them in this case? Can someone give me a short example that can be used for > my case? > > Once again, thanks for all help! > > > Michael Foord-5 wrote: > >> You've snipped the code so I can't see it exactly, but I'm pretty sure >> you are doing this inside a method. This will create a new 'scope' every >> time you enter the method and so you are creating a local variable that >> disappears when you exit the method. >> >> When you exec you can provide a dictionary as a context for the >> execution to happen in. If you store this as an instance member and >> re-use the same execution context every time then changes will be >> 'remembered'. >> >> Michael >> >> > > -- http://www.ironpythoninaction.com/ From fuzzyman at voidspace.org.uk Tue Dec 16 16:28:36 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 16 Dec 2008 15:28:36 +0000 Subject: [IronPython] Newbie: convert string to python expression?? In-Reply-To: <4947C80D.1070504@voidspace.org.uk> References: <21029759.post@talk.nabble.com> <74401640812160221o18f71aape038806a11bf88f7@mail.gmail.com> <21031241.post@talk.nabble.com> <1040764474.2765171229428823660.JavaMail.root@ganesh.brynmawr.edu> <21032160.post@talk.nabble.com> <49479FD8.2030501@voidspace.org.uk> <21033977.post@talk.nabble.com> <4947C80D.1070504@voidspace.org.uk> Message-ID: <4947C924.9030107@voidspace.org.uk> Oh - and Windows Forms has a Keys enumeration so that you don't have to rely on the underlying value of the event key property. from System.Windows.Forms import Keys if e.Key == Keys.Enter: (or something like that - check out the MSDN documentation for the enumeration.) Michael Foord Michael Foord wrote: > > context = {} > > def inputBox_KeyDown(s, e): > root.message.Text = '' > key = e.Key.value__ > result = root.inputBox.Text > if key == 3: #If 'Enter' key is pressed > try: > try: > root.message.Text = eval(result) > except SyntaxError: > exec result in context > except Exception, e: > print 'Unhandled exception', e > > Note the "exec result in context" and my suggested changes to your > exception handling. > > Michael > > > xkrja wrote: >> Thanks for the reply. >> >> Below is a snippet of what I've got: >> >> def inputBox_KeyDown(s, e): >> root.message.Text = '' >> key = e.Key.value__ >> result = root.inputBox.Text >> if key == 3: #If 'Enter' key is pressed >> try: >> root.message.Text = eval(result) >> except: >> exec result >> root = Application.Current.LoadRootVisual(UserControl(), >> "app.xaml") >> sys.stdout = Writer(root.message) >> >> root.inputBox.KeyDown += inputBox_KeyDown >> >> Can't I just put everthing that is evaluated or executed in some kind of >> global scope so that they can be accessed just like in the console? >> If not: >> I looked a little at dictionaries but didn't really understand how to >> use >> them in this case? Can someone give me a short example that can be >> used for >> my case? >> >> Once again, thanks for all help! >> >> >> Michael Foord-5 wrote: >> >>> You've snipped the code so I can't see it exactly, but I'm pretty >>> sure you are doing this inside a method. This will create a new >>> 'scope' every time you enter the method and so you are creating a >>> local variable that disappears when you exit the method. >>> >>> When you exec you can provide a dictionary as a context for the >>> execution to happen in. If you store this as an instance member and >>> re-use the same execution context every time then changes will be >>> 'remembered'. >>> >>> Michael >>> >>> >> >> > > -- http://www.ironpythoninaction.com/ From kristian.jaksch at gmail.com Tue Dec 16 17:13:03 2008 From: kristian.jaksch at gmail.com (xkrja) Date: Tue, 16 Dec 2008 08:13:03 -0800 (PST) Subject: [IronPython] Newbie: convert string to python expression?? In-Reply-To: <4947C924.9030107@voidspace.org.uk> References: <21029759.post@talk.nabble.com> <74401640812160221o18f71aape038806a11bf88f7@mail.gmail.com> <21031241.post@talk.nabble.com> <1040764474.2765171229428823660.JavaMail.root@ganesh.brynmawr.edu> <21032160.post@talk.nabble.com> <49479FD8.2030501@voidspace.org.uk> <21033977.post@talk.nabble.com> <4947C80D.1070504@voidspace.org.uk> <4947C924.9030107@voidspace.org.uk> Message-ID: <21036162.post@talk.nabble.com> Thanks! I'm using Ironpython with Silverlight so I can't get access to Windows.Forms Please bear with me :-) New stuff's showing up all the time. The solution you proposed worked but there must be something I don't get with the scope. Please look at my snippet below: import clr, sys clr.AddReference("Mapack, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null") from Mapack import * . . . def inputBox_KeyDown(s, e): key = e.Key.value__ result = root.inputBox.Text if key == 3: #If 'Enter' key is pressed try: try: root.message.Text = eval(result) except SyntaxError: exec result in context except Exception, e: print 'Unhandled exception', e root.inputBox.Text = "" m = Matrix(2,2) #NOTICE: If I hard code this definition in the function it works print m #but if I try to type m=Matrix(2,2) in inputBox it says: #"Matrix is not defined" I can create an object of the Matrix()-class if I code it straight into the function as shown in my snippet above but I can't type m=Matrix(2,2) in the 'inputBox' and then execute it. Then I get an exception: "Matrix is not defined". How can I work around this? Thanks very much! Michael Foord-5 wrote: > > Oh - and Windows Forms has a Keys enumeration so that you don't have to > rely on the underlying value of the event key property. > > from System.Windows.Forms import Keys > > if e.Key == Keys.Enter: > > (or something like that - check out the MSDN documentation for the > enumeration.) > > Michael Foord > > -- View this message in context: http://www.nabble.com/Newbie%3A-convert-string-to-python-expression---tp21029759p21036162.html Sent from the IronPython mailing list archive at Nabble.com. From fuzzyman at voidspace.org.uk Tue Dec 16 17:19:04 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 16 Dec 2008 16:19:04 +0000 Subject: [IronPython] Newbie: convert string to python expression?? In-Reply-To: <21036162.post@talk.nabble.com> References: <21029759.post@talk.nabble.com> <74401640812160221o18f71aape038806a11bf88f7@mail.gmail.com> <21031241.post@talk.nabble.com> <1040764474.2765171229428823660.JavaMail.root@ganesh.brynmawr.edu> <21032160.post@talk.nabble.com> <49479FD8.2030501@voidspace.org.uk> <21033977.post@talk.nabble.com> <4947C80D.1070504@voidspace.org.uk> <4947C924.9030107@voidspace.org.uk> <21036162.post@talk.nabble.com> Message-ID: <4947D4F8.5010600@voidspace.org.uk> xkrja wrote: > Thanks! > > I'm using Ironpython with Silverlight so I can't get access to Windows.Forms > Ah - in which case it probably lives in System.Windows.Input > Please bear with me :-) New stuff's showing up all the time. The solution > you proposed worked but there must be something I don't get with the scope. > Please look at my snippet below: > > The advantage of a specific context is that you control what objects the code has access to. Try setting the Matrix object into the dictionary with the key 'm' and your code should have access to it. Michael > import clr, sys > clr.AddReference("Mapack, Version=1.0.0.0, Culture=neutral, > PublicKeyToken=null") > from Mapack import * > . > . > . > > def inputBox_KeyDown(s, e): > > key = e.Key.value__ > result = root.inputBox.Text > if key == 3: #If 'Enter' key is pressed > try: > try: > root.message.Text = eval(result) > except SyntaxError: > exec result in context > except Exception, e: > print 'Unhandled exception', e > root.inputBox.Text = "" > m = Matrix(2,2) #NOTICE: If I hard code this > definition in the function it works > print m #but if I try to type > m=Matrix(2,2) in inputBox it says: > #"Matrix is not defined" > > > I can create an object of the Matrix()-class if I code it straight into the > function as shown in my snippet above but I can't type m=Matrix(2,2) in the > 'inputBox' and then execute it. Then I get an exception: "Matrix is not > defined". > > How can I work around this? > > Thanks very much! > > > > Michael Foord-5 wrote: > >> Oh - and Windows Forms has a Keys enumeration so that you don't have to >> rely on the underlying value of the event key property. >> >> from System.Windows.Forms import Keys >> >> if e.Key == Keys.Enter: >> >> (or something like that - check out the MSDN documentation for the >> enumeration.) >> >> Michael Foord >> >> >> > > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From kristian.jaksch at gmail.com Tue Dec 16 18:08:07 2008 From: kristian.jaksch at gmail.com (Kristian Jaksch) Date: Tue, 16 Dec 2008 18:08:07 +0100 Subject: [IronPython] Newbie: convert string to python expression?? In-Reply-To: <4947D4F8.5010600@voidspace.org.uk> References: <21029759.post@talk.nabble.com> <21031241.post@talk.nabble.com> <1040764474.2765171229428823660.JavaMail.root@ganesh.brynmawr.edu> <21032160.post@talk.nabble.com> <49479FD8.2030501@voidspace.org.uk> <21033977.post@talk.nabble.com> <4947C80D.1070504@voidspace.org.uk> <4947C924.9030107@voidspace.org.uk> <21036162.post@talk.nabble.com> <4947D4F8.5010600@voidspace.org.uk> Message-ID: <1dab55500812160908s7edb66acg67e61f80357ee652@mail.gmail.com> Ok, did you mean something like below?: * clr.AddReference("Mapack, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null") from Mapack import ** * #A library that contain classes for working with algebra etc.* *context = {} context['m'] = Matrix(5,5) #creating a 5 rows, 5 columns matrix object in context def inputBox_KeyDown(s, e): key = e.Key.value__ result = root.inputBox.Text if key == 3: #If 'Enter' key is pressed try: try: root.message.Text = eval(result) except SyntaxError: exec result in context except Exception, e: print 'Unhandled exception', e root.inputBox.Text = "" #Clearing inputBox* But this creates a fixed size matrix and I still get an exception if I type for example *m=Matrix(2,2)* in the 'inputBox'. I want to make this as general as possible. Can't I place everything that is imported from 'Mapack' into the 'context' dictionary together with whatever the user types in besides of that? There are several more classes that must be placed in 'context'. It would be nice to have the user type *n=m.Transpose()* or whatever method he wants to get out from the 'Mapack' library and then let the code be executed correctly. Thanks very much! 2008/12/16 Michael Foord : > xkrja wrote: >> >> Thanks! >> >> I'm using Ironpython with Silverlight so I can't get access to >> Windows.Forms >> > > Ah - in which case it probably lives in System.Windows.Input >> >> Please bear with me :-) New stuff's showing up all the time. The solution >> you proposed worked but there must be something I don't get with the >> scope. >> Please look at my snippet below: >> >> > > The advantage of a specific context is that you control what objects the > code has access to. Try setting the Matrix object into the dictionary with > the key 'm' and your code should have access to it. > > Michael > >> import clr, sys >> clr.AddReference("Mapack, Version=1.0.0.0, Culture=neutral, >> PublicKeyToken=null") >> from Mapack import * >> . >> . >> . >> >> def inputBox_KeyDown(s, e): >> key = e.Key.value__ >> result = root.inputBox.Text >> if key == 3: #If 'Enter' key is pressed >> try: >> try: >> root.message.Text = eval(result) >> except SyntaxError: >> exec result in context >> except Exception, e: >> print 'Unhandled exception', e >> root.inputBox.Text = "" m = Matrix(2,2) >> #NOTICE: If I hard code this >> definition in the function it works >> print m #but if I try to type >> m=Matrix(2,2) in inputBox it says: >> #"Matrix is not defined" >> >> >> I can create an object of the Matrix()-class if I code it straight into >> the >> function as shown in my snippet above but I can't type m=Matrix(2,2) in >> the >> 'inputBox' and then execute it. Then I get an exception: "Matrix is not >> defined". >> How can I work around this? >> >> Thanks very much! >> >> >> Michael Foord-5 wrote: >> >>> >>> Oh - and Windows Forms has a Keys enumeration so that you don't have to >>> rely on the underlying value of the event key property. >>> >>> from System.Windows.Forms import Keys >>> >>> if e.Key == Keys.Enter: >>> >>> (or something like that - check out the MSDN documentation for the >>> enumeration.) >>> >>> Michael Foord >>> >>> >>> >> >> > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Tue Dec 16 18:13:27 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 16 Dec 2008 17:13:27 +0000 Subject: [IronPython] Newbie: convert string to python expression?? In-Reply-To: <1dab55500812160908s7edb66acg67e61f80357ee652@mail.gmail.com> References: <21029759.post@talk.nabble.com> <21031241.post@talk.nabble.com> <1040764474.2765171229428823660.JavaMail.root@ganesh.brynmawr.edu> <21032160.post@talk.nabble.com> <49479FD8.2030501@voidspace.org.uk> <21033977.post@talk.nabble.com> <4947C80D.1070504@voidspace.org.uk> <4947C924.9030107@voidspace.org.uk> <21036162.post@talk.nabble.com> <4947D4F8.5010600@voidspace.org.uk> <1dab55500812160908s7edb66acg67e61f80357ee652@mail.gmail.com> Message-ID: <4947E1B7.7@voidspace.org.uk> Kristian Jaksch wrote: > Ok, did you mean something like below?: > * > clr.AddReference("Mapack, Version=1.0.0.0, Culture=neutral, > PublicKeyToken=null") > > from Mapack import ** * #A library that contain classes for working > with algebra etc.* > > *context = {} > > context['m'] = Matrix(5,5) #creating a 5 rows, 5 columns matrix > object in context > > * Looks good. > * > def inputBox_KeyDown(s, e): > key = e.Key.value__ > result = root.inputBox.Text > if key == 3: #If 'Enter' key is pressed > try: > try: > root.message.Text = eval(result) > except SyntaxError: > exec result in context > except Exception, e: > print 'Unhandled exception', e > root.inputBox.Text = "" #Clearing inputBox* > > But this creates a fixed size matrix and I still get an exception if I > type for example *m=Matrix(2,2)* in the 'inputBox'. I want to make > this as general as possible. Can't I place everything that is imported > from 'Mapack' into the 'context' dictionary together with whatever the > user types in besides of that? You can. I'll give you a clue - import * makes it harder. Try importing Mapack and then it will be easier to put things from the module into the dictionary. > There are several more classes that must be placed in 'context'. It > would be nice to have the user type *n=m.Transpose()* or whatever > method he wants to get out from the 'Mapack' library and then let the > code be executed correctly. Does that not work already - it should do. Michael > > Thanks very much! > > > 2008/12/16 Michael Foord >: > > xkrja wrote: > >> > >> Thanks! > >> > >> I'm using Ironpython with Silverlight so I can't get access to > >> Windows.Forms > >> > > > > Ah - in which case it probably lives in System.Windows.Input > >> > >> Please bear with me :-) New stuff's showing up all the time. The > solution > >> you proposed worked but there must be something I don't get with the > >> scope. > >> Please look at my snippet below: > >> > >> > > > > The advantage of a specific context is that you control what objects the > > code has access to. Try setting the Matrix object into the > dictionary with > > the key 'm' and your code should have access to it. > > > > Michael > > > >> import clr, sys > >> clr.AddReference("Mapack, Version=1.0.0.0, Culture=neutral, > >> PublicKeyToken=null") > >> from Mapack import * > >> . > >> . > >> . > >> > >> def inputBox_KeyDown(s, e): > >> key = e.Key.value__ > >> result = root.inputBox.Text > >> if key == 3: #If 'Enter' key is pressed > >> try: > >> try: > >> root.message.Text = eval(result) > >> except SyntaxError: > >> exec result in context > >> except Exception, e: > >> print 'Unhandled exception', e > >> root.inputBox.Text = "" m = > Matrix(2,2) > >> #NOTICE: If I hard code this > >> definition in the function it works > >> print m #but if I try to type > >> m=Matrix(2,2) in inputBox it says: > >> #"Matrix is not defined" > >> > >> > >> I can create an object of the Matrix()-class if I code it straight into > >> the > >> function as shown in my snippet above but I can't type m=Matrix(2,2) in > >> the > >> 'inputBox' and then execute it. Then I get an exception: "Matrix is not > >> defined". > >> How can I work around this? > >> > >> Thanks very much! > >> > >> > >> Michael Foord-5 wrote: > >> > >>> > >>> Oh - and Windows Forms has a Keys enumeration so that you don't > have to > >>> rely on the underlying value of the event key property. > >>> > >>> from System.Windows.Forms import Keys > >>> > >>> if e.Key == Keys.Enter: > >>> > >>> (or something like that - check out the MSDN documentation for the > >>> enumeration.) > >>> > >>> Michael Foord > >>> > >>> > >>> > >> > >> > > > > > > -- > > http://www.ironpythoninaction.com/ > > http://www.voidspace.org.uk/blog > > > > > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From orestis at resolversystems.com Tue Dec 16 19:08:55 2008 From: orestis at resolversystems.com (Orestis Markou) Date: Tue, 16 Dec 2008 18:08:55 +0000 Subject: [IronPython] Newbie: convert string to python expression?? In-Reply-To: <4947E1B7.7@voidspace.org.uk> References: <21029759.post@talk.nabble.com> <21031241.post@talk.nabble.com> <1040764474.2765171229428823660.JavaMail.root@ganesh.brynmawr.edu> <21032160.post@talk.nabble.com> <49479FD8.2030501@voidspace.org.uk> <21033977.post@talk.nabble.com> <4947C80D.1070504@voidspace.org.uk> <4947C924.9030107@voidspace.org.uk> <21036162.post@talk.nabble.com> <4947D4F8.5010600@voidspace.org.uk> <1dab55500812160908s7edb66acg67e61f80357ee652@mail.gmail.com> <4947E1B7.7@voidspace.org.uk> Message-ID: <4947EEB7.4050701@resolversystems.com> you have to pass the context to eval as well: eval(result, context) make sure that the context doesn't change between calls to eval and exec. It should be a property on your form, really, but it doesn't seem so. Just make sure that you don't re-create the context every time. If you don't want to setup the context everytime, what you can do is: eval(result, globals(), locals()) exec(result, globals(), locals()) But this is a major security concern as the user can access (and change!) everything that is in every scope. You probably don't want to do that. Try printing globals() to see what kind of objects you have lying around. Michael Foord wrote: > Kristian Jaksch wrote: >> Ok, did you mean something like below?: >> * >> clr.AddReference("Mapack, Version=1.0.0.0, Culture=neutral, >> PublicKeyToken=null") >> >> from Mapack import ** * #A library that contain classes for working >> with algebra etc.* >> >> *context = {} >> >> context['m'] = Matrix(5,5) #creating a 5 rows, 5 columns matrix >> object in context >> >> * > > Looks good. >> * >> def inputBox_KeyDown(s, e): >> key = e.Key.value__ >> result = root.inputBox.Text >> if key == 3: #If 'Enter' key is pressed >> try: >> try: >> root.message.Text = eval(result) >> except SyntaxError: >> exec result in context >> except Exception, e: >> print 'Unhandled exception', e >> root.inputBox.Text = "" #Clearing inputBox* >> >> But this creates a fixed size matrix and I still get an exception if I >> type for example *m=Matrix(2,2)* in the 'inputBox'. I want to make >> this as general as possible. Can't I place everything that is imported >> from 'Mapack' into the 'context' dictionary together with whatever the >> user types in besides of that? > > You can. I'll give you a clue - import * makes it harder. Try importing > Mapack and then it will be easier to put things from the module into the > dictionary. >> There are several more classes that must be placed in 'context'. It >> would be nice to have the user type *n=m.Transpose()* or whatever >> method he wants to get out from the 'Mapack' library and then let the >> code be executed correctly. > > Does that not work already - it should do. > > Michael >> >> Thanks very much! >> >> >> 2008/12/16 Michael Foord > >: >> > xkrja wrote: >> >> >> >> Thanks! >> >> >> >> I'm using Ironpython with Silverlight so I can't get access to >> >> Windows.Forms >> >> > >> > Ah - in which case it probably lives in System.Windows.Input >> >> >> >> Please bear with me :-) New stuff's showing up all the time. The >> solution >> >> you proposed worked but there must be something I don't get with the >> >> scope. >> >> Please look at my snippet below: >> >> >> >> > >> > The advantage of a specific context is that you control what objects >> the >> > code has access to. Try setting the Matrix object into the >> dictionary with >> > the key 'm' and your code should have access to it. >> > >> > Michael >> > >> >> import clr, sys >> >> clr.AddReference("Mapack, Version=1.0.0.0, Culture=neutral, >> >> PublicKeyToken=null") >> >> from Mapack import * >> >> . >> >> . >> >> . >> >> >> >> def inputBox_KeyDown(s, e): >> >> key = e.Key.value__ >> >> result = root.inputBox.Text >> >> if key == 3: #If 'Enter' key is pressed >> >> try: >> >> try: >> >> root.message.Text = eval(result) >> >> except SyntaxError: >> >> exec result in context >> >> except Exception, e: >> >> print 'Unhandled exception', e >> >> root.inputBox.Text = "" m = >> Matrix(2,2) >> #NOTICE: If I hard code this >> >> definition in the function it works >> >> print m #but if I try to type >> >> m=Matrix(2,2) in inputBox it says: >> >> #"Matrix is not defined" >> >> >> >> >> >> I can create an object of the Matrix()-class if I code it straight >> into >> >> the >> >> function as shown in my snippet above but I can't type >> m=Matrix(2,2) in >> >> the >> >> 'inputBox' and then execute it. Then I get an exception: "Matrix is >> not >> >> defined". >> >> How can I work around this? >> >> >> >> Thanks very much! >> >> >> >> >> Michael Foord-5 wrote: >> >> >>> >> >>> Oh - and Windows Forms has a Keys enumeration so that you don't >> have to >> >>> rely on the underlying value of the event key property. >> >>> >> >>> from System.Windows.Forms import Keys >> >>> >> >>> if e.Key == Keys.Enter: >> >>> >> >>> (or something like that - check out the MSDN documentation for the >> >>> enumeration.) >> >>> >> >>> Michael Foord >> >>> >> >>> >> >>> >> >> >> > >> > >> > -- >> > http://www.ironpythoninaction.com/ >> > http://www.voidspace.org.uk/blog >> > >> > >> > _______________________________________________ >> > Users mailing list >> > Users at lists.ironpython.com >> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > > -- Orestis Markou Software Engineer, Resolver Systems Ltd. orestis at resolversystems.com +44 (0) 20 7253 6372 From fuzzyman at voidspace.org.uk Tue Dec 16 19:18:27 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 16 Dec 2008 18:18:27 +0000 Subject: [IronPython] Newbie: convert string to python expression?? In-Reply-To: <4947E1B7.7@voidspace.org.uk> References: <21029759.post@talk.nabble.com> <21031241.post@talk.nabble.com> <1040764474.2765171229428823660.JavaMail.root@ganesh.brynmawr.edu> <21032160.post@talk.nabble.com> <49479FD8.2030501@voidspace.org.uk> <21033977.post@talk.nabble.com> <4947C80D.1070504@voidspace.org.uk> <4947C924.9030107@voidspace.org.uk> <21036162.post@talk.nabble.com> <4947D4F8.5010600@voidspace.org.uk> <1dab55500812160908s7edb66acg67e61f80357ee652@mail.gmail.com> <4947E1B7.7@voidspace.org.uk> Message-ID: <4947F0F3.6000607@voidspace.org.uk> Michael Foord wrote: > Kristian Jaksch wrote: >> * >> def inputBox_KeyDown(s, e): >> key = e.Key.value__ >> result = root.inputBox.Text >> if key == 3: #If 'Enter' key is pressed >> try: >> try: >> root.message.Text = eval(result) >> except SyntaxError: >> exec result in context >> except Exception, e: >> print 'Unhandled exception', e >> root.inputBox.Text = "" #Clearing inputBox* >> >> But this creates a fixed size matrix and I still get an exception if >> I type for example *m=Matrix(2,2)* in the 'inputBox'. I want to make >> this as general as possible. Can't I place everything that is >> imported from 'Mapack' into the 'context' dictionary together with >> whatever the user types in besides of that? > > You can. I'll give you a clue - import * makes it harder. Try > importing Mapack and then it will be easier to put things from the > module into the dictionary. Hmmm - actually you could exec the import * inside the context to populate it. Michael >> There are several more classes that must be placed in 'context'. It >> would be nice to have the user type *n=m.Transpose()* or whatever >> method he wants to get out from the 'Mapack' library and then let the >> code be executed correctly. > > Does that not work already - it should do. > > Michael >> >> Thanks very much! >> >> >> 2008/12/16 Michael Foord > >: >> > xkrja wrote: >> >> >> >> Thanks! >> >> >> >> I'm using Ironpython with Silverlight so I can't get access to >> >> Windows.Forms >> >> > >> > Ah - in which case it probably lives in System.Windows.Input >> >> >> >> Please bear with me :-) New stuff's showing up all the time. The >> solution >> >> you proposed worked but there must be something I don't get with the >> >> scope. >> >> Please look at my snippet below: >> >> >> >> > >> > The advantage of a specific context is that you control what >> objects the >> > code has access to. Try setting the Matrix object into the >> dictionary with >> > the key 'm' and your code should have access to it. >> > >> > Michael >> > >> >> import clr, sys >> >> clr.AddReference("Mapack, Version=1.0.0.0, Culture=neutral, >> >> PublicKeyToken=null") >> >> from Mapack import * >> >> . >> >> . >> >> . >> >> >> >> def inputBox_KeyDown(s, e): >> >> key = e.Key.value__ >> >> result = root.inputBox.Text >> >> if key == 3: #If 'Enter' key is pressed >> >> try: >> >> try: >> >> root.message.Text = eval(result) >> >> except SyntaxError: >> >> exec result in context >> >> except Exception, e: >> >> print 'Unhandled exception', e >> >> root.inputBox.Text = "" m = >> Matrix(2,2) >> #NOTICE: If I hard code this >> >> definition in the function it works >> >> print m #but if I try to type >> >> m=Matrix(2,2) in inputBox it says: >> >> #"Matrix is not defined" >> >> >> >> >> >> I can create an object of the Matrix()-class if I code it straight >> into >> >> the >> >> function as shown in my snippet above but I can't type >> m=Matrix(2,2) in >> >> the >> >> 'inputBox' and then execute it. Then I get an exception: "Matrix >> is not >> >> defined". >> >> How can I work around this? >> >> >> >> Thanks very much! >> >> >> >> >> Michael Foord-5 wrote: >> >> >>> >> >>> Oh - and Windows Forms has a Keys enumeration so that you don't >> have to >> >>> rely on the underlying value of the event key property. >> >>> >> >>> from System.Windows.Forms import Keys >> >>> >> >>> if e.Key == Keys.Enter: >> >>> >> >>> (or something like that - check out the MSDN documentation for the >> >>> enumeration.) >> >>> >> >>> Michael Foord >> >>> >> >>> >> >>> >> >> >> > >> > >> > -- >> > http://www.ironpythoninaction.com/ >> > http://www.voidspace.org.uk/blog >> > >> > >> > _______________________________________________ >> > Users mailing list >> > Users at lists.ironpython.com >> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From kristian.jaksch at gmail.com Tue Dec 16 19:45:56 2008 From: kristian.jaksch at gmail.com (Kristian Jaksch) Date: Tue, 16 Dec 2008 19:45:56 +0100 Subject: [IronPython] Newbie: convert string to python expression?? In-Reply-To: <4947F0F3.6000607@voidspace.org.uk> References: <21029759.post@talk.nabble.com> <49479FD8.2030501@voidspace.org.uk> <21033977.post@talk.nabble.com> <4947C80D.1070504@voidspace.org.uk> <4947C924.9030107@voidspace.org.uk> <21036162.post@talk.nabble.com> <4947D4F8.5010600@voidspace.org.uk> <1dab55500812160908s7edb66acg67e61f80357ee652@mail.gmail.com> <4947E1B7.7@voidspace.org.uk> <4947F0F3.6000607@voidspace.org.uk> Message-ID: <1dab55500812161045r175637ddyb89aa37369222c9e@mail.gmail.com> Orestis, passing the 'context' to 'eval' seems like the right thing to do. I tried your solution, see below: * clr.AddReference("Mapack, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null") from Mapack import ** * #A library that contain classes for working with algebra etc.* . . . *context = {} def inputBox_KeyDown(s, e): key = e.Key.value__ result = root.inputBox.Text if key == 3: #If 'Enter' key is pressed try: try: root.message.Text = eval(result, globals(), locals()) except SyntaxError: exec(result, globals(), locals()) except Exception, e: print 'Unhandled exception', e root.inputBox.Text = "" #Clearing inputBox *If I then define my matrix (as always): I type *m=Matrix(2,2)* in 'inputBox' and I don't receive any exceptions so I assume the definition is ok. But if I type *print m* I get an exception: "m is not defined". Why is that? Michael, What do you mean exec the import * inside the context to poulate it? Something like: *context['Mapack'] = exec "from Mapack import *" #Doesn't work *Hmmm... think I'm getting tired. Anyway thanks for help! 2008/12/16 Michael Foord > Michael Foord wrote: > >> Kristian Jaksch wrote: >> >>> * >>> def inputBox_KeyDown(s, e): >>> key = e.Key.value__ >>> result = root.inputBox.Text >>> if key == 3: #If 'Enter' key is pressed >>> try: >>> try: >>> root.message.Text = eval(result) >>> except SyntaxError: >>> exec result in context >>> except Exception, e: >>> print 'Unhandled exception', e >>> root.inputBox.Text = "" #Clearing inputBox* >>> >>> But this creates a fixed size matrix and I still get an exception if I >>> type for example *m=Matrix(2,2)* in the 'inputBox'. I want to make this as >>> general as possible. Can't I place everything that is imported from 'Mapack' >>> into the 'context' dictionary together with whatever the user types in >>> besides of that? >>> >> >> You can. I'll give you a clue - import * makes it harder. Try importing >> Mapack and then it will be easier to put things from the module into the >> dictionary. >> > > Hmmm - actually you could exec the import * inside the context to populate > it. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kamil at dworakowski.name Tue Dec 16 20:07:40 2008 From: kamil at dworakowski.name (Kamil Dworakowski) Date: Tue, 16 Dec 2008 19:07:40 +0000 Subject: [IronPython] weird performance issue Message-ID: <93fc29d60812161107i691af398w514a20bf11fe2844@mail.gmail.com> We see a very strange side effect of running the follwing code on the performance of recalculations in Resolver One. def Dumbcorator(fn): def _inner(self, *args): return fn(self, *args) return _inner class Locker(object): @property @Dumbcorator def thing(self): return 2 l = Locker() l.thing Specifically, one of the performance test reports results 4 to 8 times worse with this snippet in than without (the clock is turned on after this snippet executes). If I comment out this snippet from the code, it suddenly runs 4 to 8 times faster. The fact that I can comment it out means that it is not used in the test, so it is bizzare that it slows it down. We can't reproduce the slow down in a clean example though. I hope something clicks for somebody and gives me a hint as to what is going on. Tomorrow I'll continue on trying to minimize the code that is being slowed down, and hopefully come up with some decent repro. From kamil at dworakowski.name Tue Dec 16 20:07:55 2008 From: kamil at dworakowski.name (Kamil Dworakowski) Date: Tue, 16 Dec 2008 19:07:55 +0000 Subject: [IronPython] weird performance issue Message-ID: <93fc29d60812161107y79acc3dqbd99391e42f24eed@mail.gmail.com> We see a very strange side effect of running the follwing code on the performance of recalculations in Resolver One. def Dumbcorator(fn): def _inner(self, *args): return fn(self, *args) return _inner class Locker(object): @property @Dumbcorator def thing(self): return 2 l = Locker() l.thing Specifically, one of the performance test reports results 4 to 8 times worse with this snippet in than without (the clock is turned on after this snippet executes). If I comment out this snippet from the code, it suddenly runs 4 to 8 times faster. The fact that I can comment it out means that it is not used in the test, so it is bizzare that it slows it down. We can't reproduce the slow down in a clean example though. I hope something clicks for somebody and gives me a hint as to what is going on. Tomorrow I'll continue on trying to minimize the code that is being slowed down, and hopefully come up with some decent repro. From fuzzyman at voidspace.org.uk Tue Dec 16 20:14:17 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 16 Dec 2008 19:14:17 +0000 Subject: [IronPython] Newbie: convert string to python expression?? In-Reply-To: <1dab55500812161045r175637ddyb89aa37369222c9e@mail.gmail.com> References: <21029759.post@talk.nabble.com> <49479FD8.2030501@voidspace.org.uk> <21033977.post@talk.nabble.com> <4947C80D.1070504@voidspace.org.uk> <4947C924.9030107@voidspace.org.uk> <21036162.post@talk.nabble.com> <4947D4F8.5010600@voidspace.org.uk> <1dab55500812160908s7edb66acg67e61f80357ee652@mail.gmail.com> <4947E1B7.7@voidspace.org.uk> <4947F0F3.6000607@voidspace.org.uk> <1dab55500812161045r175637ddyb89aa37369222c9e@mail.gmail.com> Message-ID: <4947FE09.107@voidspace.org.uk> Kristian Jaksch wrote: > > Michael, > > What do you mean exec the import * inside the context to poulate it? > Something like: > > *context['Mapack'] = exec "from Mapack import *" #Doesn't work > > *Hmmm... think I'm getting tired. > exec doesn't return anything. Try: *exec "from Mapack import *" in context* It looked like from your response to Orestis that you were moving away from using an explicit context - which I think will get you into confusion with local variables created by your user code. Michael > Anyway thanks for help! > > > > 2008/12/16 Michael Foord > > > Michael Foord wrote: > > Kristian Jaksch wrote: > > * > def inputBox_KeyDown(s, e): > key = e.Key.value__ > result = root.inputBox.Text > if key == 3: #If 'Enter' key is pressed > try: > try: > root.message.Text = eval(result) > except SyntaxError: > exec result in context > except Exception, e: > print 'Unhandled exception', e > root.inputBox.Text = "" #Clearing inputBox* > > But this creates a fixed size matrix and I still get an > exception if I type for example *m=Matrix(2,2)* in the > 'inputBox'. I want to make this as general as possible. > Can't I place everything that is imported from 'Mapack' > into the 'context' dictionary together with whatever the > user types in besides of that? > > > You can. I'll give you a clue - import * makes it harder. Try > importing Mapack and then it will be easier to put things from > the module into the dictionary. > > > Hmmm - actually you could exec the import * inside the context to > populate it. > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From kristian.jaksch at gmail.com Tue Dec 16 22:17:24 2008 From: kristian.jaksch at gmail.com (Kristian Jaksch) Date: Tue, 16 Dec 2008 22:17:24 +0100 Subject: [IronPython] Newbie: convert string to python expression?? In-Reply-To: <4947FE09.107@voidspace.org.uk> References: <21029759.post@talk.nabble.com> <4947C80D.1070504@voidspace.org.uk> <4947C924.9030107@voidspace.org.uk> <21036162.post@talk.nabble.com> <4947D4F8.5010600@voidspace.org.uk> <1dab55500812160908s7edb66acg67e61f80357ee652@mail.gmail.com> <4947E1B7.7@voidspace.org.uk> <4947F0F3.6000607@voidspace.org.uk> <1dab55500812161045r175637ddyb89aa37369222c9e@mail.gmail.com> <4947FE09.107@voidspace.org.uk> Message-ID: <1dab55500812161317h19d1899et278e43d2288d6b1c@mail.gmail.com> Michael, Thank you for your help! It finally works. Now there is lots of other things left but this has really helped a lot. 2008/12/16 Michael Foord > Kristian Jaksch wrote: > >> >> Michael, >> >> What do you mean exec the import * inside the context to poulate it? >> Something like: >> >> *context['Mapack'] = exec "from Mapack import *" #Doesn't work >> >> *Hmmm... think I'm getting tired. >> >> exec doesn't return anything. > > Try: > > *exec "from Mapack import *" in context* > > It looked like from your response to Orestis that you were moving away from > using an explicit context - which I think will get you into confusion with > local variables created by your user code. > > Michael > >> Anyway thanks for help! >> >> >> >> 2008/12/16 Michael Foord > fuzzyman at voidspace.org.uk>> >> >> >> Michael Foord wrote: >> >> Kristian Jaksch wrote: >> >> * >> def inputBox_KeyDown(s, e): >> key = e.Key.value__ >> result = root.inputBox.Text >> if key == 3: #If 'Enter' key is pressed >> try: >> try: >> root.message.Text = eval(result) >> except SyntaxError: >> exec result in context >> except Exception, e: >> print 'Unhandled exception', e >> root.inputBox.Text = "" #Clearing inputBox* >> >> But this creates a fixed size matrix and I still get an >> exception if I type for example *m=Matrix(2,2)* in the >> 'inputBox'. I want to make this as general as possible. >> Can't I place everything that is imported from 'Mapack' >> into the 'context' dictionary together with whatever the >> user types in besides of that? >> >> >> You can. I'll give you a clue - import * makes it harder. Try >> importing Mapack and then it will be easier to put things from >> the module into the dictionary. >> >> >> Hmmm - actually you could exec the import * inside the context to >> populate it. >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Wed Dec 17 04:21:17 2008 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 16 Dec 2008 19:21:17 -0800 Subject: [IronPython] weird performance issue In-Reply-To: <93fc29d60812161107y79acc3dqbd99391e42f24eed@mail.gmail.com> References: <93fc29d60812161107y79acc3dqbd99391e42f24eed@mail.gmail.com> Message-ID: <350E7D38B6D819428718949920EC2355564BF25378@NA-EXMSG-C102.redmond.corp.microsoft.com> My guess would be that we're pushing the PythonContext._callSplatSite outside of the sweet spot in DLR site caches. You could check this by putting a breakpoint in PythonContext.Call(object, params object[]). Then look and see if _callSplatSite._rules is an instance of EmptyRuleSet with _supportAdding == false. If this is the cause it should be pretty easy to fix - property's should probably get their own call site object so it'll be specialized to the specific property (maybe we could share a common one of the function is a PythonFunction as these generate highly shareable calls between multiple function instances). We're also doing a params call today which we could stop doing and get a nice perf boost on properties. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Kamil Dworakowski > Sent: Tuesday, December 16, 2008 11:08 AM > To: users at lists.ironpython.com > Subject: [IronPython] weird performance issue > > We see a very strange side effect of running the follwing code on the > performance of recalculations in Resolver One. > > def Dumbcorator(fn): > def _inner(self, *args): > return fn(self, *args) > return _inner > > class Locker(object): > @property > @Dumbcorator > def thing(self): > return 2 > > l = Locker() > l.thing > > Specifically, one of the performance test reports results 4 to 8 times > worse with this snippet in than without (the clock is turned on after > this snippet executes). If I comment out this snippet from the code, > it suddenly runs 4 to 8 times faster. The fact that I can comment it > out means that it is not used in the test, so it is bizzare that it > slows it down. > > We can't reproduce the slow down in a clean example though. I hope > something clicks for somebody and gives me a hint as to what is going > on. Tomorrow I'll continue on trying to minimize the code that is > being slowed down, and hopefully come up with some decent repro. > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From sanxiyn at gmail.com Wed Dec 17 09:04:52 2008 From: sanxiyn at gmail.com (Seo Sanghyeon) Date: Wed, 17 Dec 2008 17:04:52 +0900 Subject: [IronPython] Invalid construct in DLR's MSBuild file? In-Reply-To: References: <5b0248170812100239i2abe78fby4c6c20a7fef6daef@mail.gmail.com> Message-ID: <5b0248170812170004y17a50132j90f09a691f338445@mail.gmail.com> 2008/12/16 Curt Hagenlocher : > This looks like a problem in quite a few of our csproj files. Could you > open up a bug report on CodePlex for this? Done. http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20262 -- Seo Sanghyeon From orestis at resolversystems.com Wed Dec 17 11:14:41 2008 From: orestis at resolversystems.com (Orestis Markou) Date: Wed, 17 Dec 2008 10:14:41 +0000 Subject: [IronPython] Newbie: convert string to python expression?? In-Reply-To: <1dab55500812161317h19d1899et278e43d2288d6b1c@mail.gmail.com> References: <21029759.post@talk.nabble.com> <4947C80D.1070504@voidspace.org.uk> <4947C924.9030107@voidspace.org.uk> <21036162.post@talk.nabble.com> <4947D4F8.5010600@voidspace.org.uk> <1dab55500812160908s7edb66acg67e61f80357ee652@mail.gmail.com> <4947E1B7.7@voidspace.org.uk> <4947F0F3.6000607@voidspace.org.uk> <1dab55500812161045r175637ddyb89aa37369222c9e@mail.gmail.com> <4947FE09.107@voidspace.org.uk> <1dab55500812161317h19d1899et278e43d2288d6b1c@mail.gmail.com> Message-ID: <4948D111.4030203@resolversystems.com> You should definitely use a separate context, or you will get bitten by it later on. To debug similar things, use the tried and true print: print the context before you execute something, and after. In your case: print 'before', context print eval(result, context) print 'after', context Also, in case Silverlight is difficult to debug, you can always rip out snippets and use them in either a text file or in the interactive interpreter. Have fun! Kristian Jaksch wrote: > Michael, > > Thank you for your help! It finally works. Now there is lots of other > things left but this has really helped a lot. > > > > 2008/12/16 Michael Foord > > > Kristian Jaksch wrote: > > > Michael, > > What do you mean exec the import * inside the context to poulate > it? Something like: > > *context['Mapack'] = exec "from Mapack import *" #Doesn't work > > *Hmmm... think I'm getting tired. > > exec doesn't return anything. > > Try: > > *exec "from Mapack import *" in context* > > It looked like from your response to Orestis that you were moving > away from using an explicit context - which I think will get you > into confusion with local variables created by your user code. > > Michael > > Anyway thanks for help! > > > > 2008/12/16 Michael Foord > >> > > > Michael Foord wrote: > > Kristian Jaksch wrote: > > * > def inputBox_KeyDown(s, e): > key = e.Key.value__ > result = root.inputBox.Text > if key == 3: #If 'Enter' key is pressed > try: > try: > root.message.Text = eval(result) > except SyntaxError: > exec result in context > except Exception, e: > print 'Unhandled exception', e > root.inputBox.Text = "" #Clearing inputBox* > > But this creates a fixed size matrix and I still get an > exception if I type for example *m=Matrix(2,2)* in the > 'inputBox'. I want to make this as general as possible. > Can't I place everything that is imported from 'Mapack' > into the 'context' dictionary together with whatever the > user types in besides of that? > > > You can. I'll give you a clue - import * makes it harder. Try > importing Mapack and then it will be easier to put things > from > the module into the dictionary. > > > Hmmm - actually you could exec the import * inside the context to > populate it. > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- Orestis Markou Software Engineer, Resolver Systems Ltd. orestis at resolversystems.com +44 (0) 20 7253 6372 From william at resolversystems.com Wed Dec 17 17:12:29 2008 From: william at resolversystems.com (William Reade) Date: Wed, 17 Dec 2008 16:12:29 +0000 Subject: [IronPython] IronPython and file descriptors In-Reply-To: <49478AD4.1080002@resolversystems.com> References: <49467FDA.5000101@resolversystems.com> <494695C0.9040401@resolversystems.com> <49469F86.8040901@resolversystems.com> <350E7D38B6D819428718949920EC2355564B62EAC4@NA-EXMSG-C102.redmond.corp.microsoft.com> <6f4025010812151252p2bb355d7p1b9d915c0b033016@mail.gmail.com> <350E7D38B6D819428718949920EC2355564B62EC42@NA-EXMSG-C102.redmond.corp.microsoft.com> <4946D288.5020909@voidspace.org.uk> <49478AD4.1080002@resolversystems.com> Message-ID: <494924ED.30604@resolversystems.com> Just a quick note: you can't necessarily just P/invoke out to msvcrt, because CPython was built with msvcr71. Sorry :(. Tom Wright wrote: > I'm not sure about sockets. The only example I have found in the wild > so far is with files in PIL. > > The python implementation seems to have socket.fileno() returning a > file descriptor which comes from 's socketpair function > in the standard C library (see socketmodule.c if you are interested) > > So, again, it would be possible for people to pass this identifier as > an integer directly to C. Whether people do this in practice is a > different question... > > Tom > > > > Michael Foord wrote: >> Dino Viehland wrote: >>> >>> (now I?ve replied to the correct thread?) >>> >>> Can you open a feature request on CodePlex? It's certainly an >>> interesting idea to ponder and I'm leaning towards it but there's >>> lots of details to be gotten right. >>> >>> Do you know if this needs to work w/ sockets as well? (There's also >>> the question of can we make it work with sockets? :)) >>> >>> There'll be a bunch of places we need to update (nt, socket, file, >>> select, etc...) so I think it'll have to wait until 2.1 instead of >>> coming in a minor update like 2.0.1. >>> >> >> Tom will have to comment on whether it is needed for sockets as well. >> Not yet I guess. :-) >> >> Tom created an issue on Codeplex - I've added a comment to that: >> >> http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20242 >> >> Michael >>> >>> *From:* users-bounces at lists.ironpython.com >>> [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Michael >>> Foord >>> *Sent:* Monday, December 15, 2008 12:53 PM >>> *To:* Discussion of IronPython >>> *Subject:* Re: [IronPython] IronPython and file descriptors >>> >>> 2008/12/15 Dino Viehland >> > >>> >>> Presumably CPython is linking against msvcrt and is using the C >>> abstraction rather than calling the Win32 APIs which return handles >>> directly. >>> >>> As Curt said the biggest problem for us is that .NET does not expose >>> C file descriptors. Therefore we could fix this by P/Invoking out to >>> msvcrt. For users on other platforms we'd need to either add support >>> for their platform or hope that their handles == C runtime file >>> descriptors. For something like fileno maybe this is ok because it's >>> an interop point only - or are there any non-interop uses of fileno >>> in the world? >>> >>> What do people think of this? This would be the 1st place where we >>> would add a P/Invoke so I'd want to tread lightly and make sure this >>> is really the right thing to do. >>> >>> >>> >>> Well, some way of doing this is needed if certain Python C >>> extensions are to work with Ironclad. Perhaps a global or per engine >>> setting that allows file handles to be associated with a C >>> descriptor. Users of Ironclad could switch it on if they wished and >>> take the consequences. >>> >>> Michael Foord >>> >>> >>> -----Original Message----- >>> From: users-bounces at lists.ironpython.com >>> >>> [mailto:users-bounces at lists.ironpython.com >>> ] On Behalf Of Slide >>> Sent: Monday, December 15, 2008 10:21 AM >>> To: Discussion of IronPython >>> Subject: Re: [IronPython] IronPython and file descriptors >>> >>> On Mon, Dec 15, 2008 at 11:18 AM, Tom Wright >>> >> > wrote: >>> > Agreed. It is certainly possible with some work to get a file >>> descriptor and >>> > pass it to C code. >>> > >>> > This is not the problem, however. Ironclad's aim (eventually) is >>> to allow >>> > *arbitrary* C extensions to work with Ironpython without >>> changing the >>> > extensions. Ctypes aim is to allow arbitrary C code to be run by >>> python >>> > (possibly in other python libraries which you really don't want >>> to modify). >>> > >>> > In CPython .fileno() is a file descriptor and some modules use >>> this fact >>> > (specifically PIL) by passing file descriptors as integers into >>> C code. I do >>> > not know how one can make this code work in IronPython unless >>> .fileno() >>> > returns a file descriptor. >>> > >>> > The game here is not making a particular C library work with >>> IronPython by >>> > modifying this library but making as many libraries as possible >>> work without >>> > modification. Of course whether this is worthwhile depends on >>> how many >>> > libraries rely on this fact. >>> > >>> > Sorry - I hope this is a little clearer. >>> > >>> > Tom >>> >>> >>> How does CPython get the file descriptor for fileno()? Does it just >>> return the HANDLE on Windows? >>> >>> slide >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >>> >>> >>> -- >>> http://www.ironpythoninaction.com/ >>> >>> ------------------------------------------------------------------------ >>> >>> >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >> >> > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From glenn.k.jones+ipy at gmail.com Wed Dec 17 18:37:41 2008 From: glenn.k.jones+ipy at gmail.com (Glenn Jones) Date: Wed, 17 Dec 2008 17:37:41 +0000 Subject: [IronPython] Change in stack traces Message-ID: <2679f6510812170937wde3d409l8bdddde520166189@mail.gmail.com> Hi all, Another observation from the Resolver One upgrade: When we run the following: engine = Python.CreateEngine() scope = engine.CreateScope() script = """ def Fn(): raise Exception Fn() """ source = engine.CreateScriptSourceFromString(script, 'aname', SourceCodeKind.Statements) code = source.Compile() code.Execute(scope) We get a stacktrace that looks like this: File "stacktrace.py", line 10, in testStackTrace code.Execute(scope) File "aname", line 4, in aname File "aname", line 3, in Fn The equivalent code in IPy1 and Python 2.5, has File "aname", line 4, in instead of File "aname", line 4, in aname When we don't pass the name into the call to CreateScriptSourceFromString, we get: File "stacktrace.py", line 10, in testStackTrace code.Execute(scope) File "", line 4, in File "", line 3, in Fn Is there a way for us to get behaviour like IPy1 and Python 2.5? Is this possibly a bug in the traceback generation of IPy2? Thanks Glenn -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Wed Dec 17 18:51:05 2008 From: dinov at microsoft.com (Dino Viehland) Date: Wed, 17 Dec 2008 09:51:05 -0800 Subject: [IronPython] Change in stack traces In-Reply-To: <2679f6510812170937wde3d409l8bdddde520166189@mail.gmail.com> References: <2679f6510812170937wde3d409l8bdddde520166189@mail.gmail.com> Message-ID: <350E7D38B6D819428718949920EC2355564BF254E7@NA-EXMSG-C102.redmond.corp.microsoft.com> I'm guessing the comparison to CPython here is a comparison to code that has been exec'd or eval'd. You can pass a PythonCompilerOptions to scriptSource.Compile with ModuleOptions.ExecOrEvalCode and you should then get the 1.x/CPython behavior. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Glenn Jones Sent: Wednesday, December 17, 2008 9:38 AM To: Discussion of IronPython Subject: [IronPython] Change in stack traces Hi all, Another observation from the Resolver One upgrade: When we run the following: engine = Python.CreateEngine() scope = engine.CreateScope() script = """ def Fn(): raise Exception Fn() """ source = engine.CreateScriptSourceFromString(script, 'aname', SourceCodeKind.Statements) code = source.Compile() code.Execute(scope) We get a stacktrace that looks like this: File "stacktrace.py", line 10, in testStackTrace code.Execute(scope) File "aname", line 4, in aname File "aname", line 3, in Fn The equivalent code in IPy1 and Python 2.5, has File "aname", line 4, in instead of File "aname", line 4, in aname When we don't pass the name into the call to CreateScriptSourceFromString, we get: File "stacktrace.py", line 10, in testStackTrace code.Execute(scope) File "", line 4, in File "", line 3, in Fn Is there a way for us to get behaviour like IPy1 and Python 2.5? Is this possibly a bug in the traceback generation of IPy2? Thanks Glenn -------------- next part -------------- An HTML attachment was scrubbed... URL: From kamil at dworakowski.name Wed Dec 17 19:02:59 2008 From: kamil at dworakowski.name (Kamil Dworakowski) Date: Wed, 17 Dec 2008 18:02:59 +0000 Subject: [IronPython] weird performance issue In-Reply-To: <350E7D38B6D819428718949920EC2355564BF25378@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <93fc29d60812161107y79acc3dqbd99391e42f24eed@mail.gmail.com> <350E7D38B6D819428718949920EC2355564BF25378@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <93fc29d60812171002r1ff25939v67fbae80be9dee7a@mail.gmail.com> Thanks Dino, it looks like you are right. I print whenever _supportAdding == false. It happens a lot with the snippet executed, whereas it doesn't happen at all with the snippet commented out. We also discovered that the slow down only occurs when we compile code to dlls (no _supportAdding == false if runned from sources). Still can't come up with a repro though. If you provide us with a patch, we can test if it solves the problem in our code. As a short term solution we have removed all the properties from decorated functions. This fixed one performance test. We moved to other performance tests and we still see that some functions are slower when executed from dlls, so the same slow down might be triggered by sth else. On Wed, Dec 17, 2008 at 3:21 AM, Dino Viehland wrote: > My guess would be that we're pushing the PythonContext._callSplatSite outside of the sweet spot in DLR site caches. > > You could check this by putting a breakpoint in PythonContext.Call(object, params object[]). Then look and see if _callSplatSite._rules is an instance of EmptyRuleSet with _supportAdding == false. > > If this is the cause it should be pretty easy to fix - property's should probably get their own call site object so it'll be specialized to the specific property (maybe we could share a common one of the function is a PythonFunction as these generate highly shareable calls between multiple function instances). We're also doing a params call today which we could stop doing and get a nice perf boost on properties. > >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users- >> bounces at lists.ironpython.com] On Behalf Of Kamil Dworakowski >> Sent: Tuesday, December 16, 2008 11:08 AM >> To: users at lists.ironpython.com >> Subject: [IronPython] weird performance issue >> >> We see a very strange side effect of running the follwing code on the >> performance of recalculations in Resolver One. >> >> def Dumbcorator(fn): >> def _inner(self, *args): >> return fn(self, *args) >> return _inner >> >> class Locker(object): >> @property >> @Dumbcorator >> def thing(self): >> return 2 >> >> l = Locker() >> l.thing >> >> Specifically, one of the performance test reports results 4 to 8 times >> worse with this snippet in than without (the clock is turned on after >> this snippet executes). If I comment out this snippet from the code, >> it suddenly runs 4 to 8 times faster. The fact that I can comment it >> out means that it is not used in the test, so it is bizzare that it >> slows it down. >> >> We can't reproduce the slow down in a clean example though. I hope >> something clicks for somebody and gives me a hint as to what is going >> on. Tomorrow I'll continue on trying to minimize the code that is >> being slowed down, and hopefully come up with some decent repro. >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From orestis at resolversystems.com Wed Dec 17 19:15:52 2008 From: orestis at resolversystems.com (Orestis Markou) Date: Wed, 17 Dec 2008 18:15:52 +0000 Subject: [IronPython] weird performance issue In-Reply-To: <93fc29d60812171002r1ff25939v67fbae80be9dee7a@mail.gmail.com> References: <93fc29d60812161107y79acc3dqbd99391e42f24eed@mail.gmail.com> <350E7D38B6D819428718949920EC2355564BF25378@NA-EXMSG-C102.redmond.corp.microsoft.com> <93fc29d60812171002r1ff25939v67fbae80be9dee7a@mail.gmail.com> Message-ID: <494941D8.4090709@resolversystems.com> Also: It seems that even normal properties are slower than methods. This became apparent when we had property access in tight loops. The weird thing is that this also happens only when using compiled dlls. Is there something inherently different with compiled python files? Perhaps some optimization not kicking in? Kamil Dworakowski wrote: > Thanks Dino, it looks like you are right. I print whenever > _supportAdding == false. > It happens a lot with the snippet executed, whereas it doesn't happen > at all with > the snippet commented out. > > We also discovered that the slow down only occurs when we compile code > to dlls (no _supportAdding == false if runned from sources). > Still can't come up with a repro though. If you provide us with a patch, we can > test if it solves the problem in our code. > > As a short term solution we have removed all the properties from > decorated functions. This fixed one performance test. We moved to > other performance tests and we still see that some functions are > slower when executed from dlls, so the same slow down might be > triggered by sth else. > > On Wed, Dec 17, 2008 at 3:21 AM, Dino Viehland wrote: >> My guess would be that we're pushing the PythonContext._callSplatSite outside of the sweet spot in DLR site caches. >> >> You could check this by putting a breakpoint in PythonContext.Call(object, params object[]). Then look and see if _callSplatSite._rules is an instance of EmptyRuleSet with _supportAdding == false. >> >> If this is the cause it should be pretty easy to fix - property's should probably get their own call site object so it'll be specialized to the specific property (maybe we could share a common one of the function is a PythonFunction as these generate highly shareable calls between multiple function instances). We're also doing a params call today which we could stop doing and get a nice perf boost on properties. >> >>> -----Original Message----- >>> From: users-bounces at lists.ironpython.com [mailto:users- >>> bounces at lists.ironpython.com] On Behalf Of Kamil Dworakowski >>> Sent: Tuesday, December 16, 2008 11:08 AM >>> To: users at lists.ironpython.com >>> Subject: [IronPython] weird performance issue >>> >>> We see a very strange side effect of running the follwing code on the >>> performance of recalculations in Resolver One. >>> >>> def Dumbcorator(fn): >>> def _inner(self, *args): >>> return fn(self, *args) >>> return _inner >>> >>> class Locker(object): >>> @property >>> @Dumbcorator >>> def thing(self): >>> return 2 >>> >>> l = Locker() >>> l.thing >>> >>> Specifically, one of the performance test reports results 4 to 8 times >>> worse with this snippet in than without (the clock is turned on after >>> this snippet executes). If I comment out this snippet from the code, >>> it suddenly runs 4 to 8 times faster. The fact that I can comment it >>> out means that it is not used in the test, so it is bizzare that it >>> slows it down. >>> >>> We can't reproduce the slow down in a clean example though. I hope >>> something clicks for somebody and gives me a hint as to what is going >>> on. Tomorrow I'll continue on trying to minimize the code that is >>> being slowed down, and hopefully come up with some decent repro. >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- Orestis Markou Software Engineer, Resolver Systems Ltd. orestis at resolversystems.com +44 (0) 20 7253 6372 From orestis at resolversystems.com Wed Dec 17 19:19:09 2008 From: orestis at resolversystems.com (Orestis Markou) Date: Wed, 17 Dec 2008 18:19:09 +0000 Subject: [IronPython] DLR spec document Message-ID: <4949429D.1070001@resolversystems.com> Hi all, the Hosting API spec from http://blogs.msdn.com/ironpython/archive/2008/03/16/dlr-resources.aspx seems to contain insinuations that it is not up-to-date. I was wondering if this actually stands and how much we should depend on it. Thanks very much, Orestis -- Orestis Markou Software Engineer, Resolver Systems Ltd. orestis at resolversystems.com +44 (0) 20 7253 6372 From dinov at microsoft.com Wed Dec 17 19:32:24 2008 From: dinov at microsoft.com (Dino Viehland) Date: Wed, 17 Dec 2008 10:32:24 -0800 Subject: [IronPython] weird performance issue In-Reply-To: <494941D8.4090709@resolversystems.com> References: <93fc29d60812161107y79acc3dqbd99391e42f24eed@mail.gmail.com> <350E7D38B6D819428718949920EC2355564BF25378@NA-EXMSG-C102.redmond.corp.microsoft.com> <93fc29d60812171002r1ff25939v67fbae80be9dee7a@mail.gmail.com> <494941D8.4090709@resolversystems.com> Message-ID: <350E7D38B6D819428718949920EC2355564BF25527@NA-EXMSG-C102.redmond.corp.microsoft.com> There is one difference between pre-compiled & compiled at runtime: Global accesses will be a little bit slower with compiled files. That's because the files need to support being loaded into multiple ScriptRuntime's where if we compile it they don't. Other than that they should be basically the same. I would expect properties to be a little slower than methods. The reason is that we first dispatch to the property descriptor, and then it dispatches to the function. But I think the perf fix will actually improve this somewhat as well. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Orestis Markou > Sent: Wednesday, December 17, 2008 10:16 AM > To: Discussion of IronPython > Subject: Re: [IronPython] weird performance issue > > Also: It seems that even normal properties are slower than methods. > This > became apparent when we had property access in tight loops. The weird > thing is that this also happens only when using compiled dlls. > > Is there something inherently different with compiled python files? > Perhaps some optimization not kicking in? > > Kamil Dworakowski wrote: > > Thanks Dino, it looks like you are right. I print whenever > > _supportAdding == false. > > It happens a lot with the snippet executed, whereas it doesn't happen > > at all with > > the snippet commented out. > > > > We also discovered that the slow down only occurs when we compile > code > > to dlls (no _supportAdding == false if runned from sources). > > Still can't come up with a repro though. If you provide us with a > patch, we can > > test if it solves the problem in our code. > > > > As a short term solution we have removed all the properties from > > decorated functions. This fixed one performance test. We moved to > > other performance tests and we still see that some functions are > > slower when executed from dlls, so the same slow down might be > > triggered by sth else. > > > > On Wed, Dec 17, 2008 at 3:21 AM, Dino Viehland > wrote: > >> My guess would be that we're pushing the > PythonContext._callSplatSite outside of the sweet spot in DLR site > caches. > >> > >> You could check this by putting a breakpoint in > PythonContext.Call(object, params object[]). Then look and see if > _callSplatSite._rules is an instance of EmptyRuleSet with > _supportAdding == false. > >> > >> If this is the cause it should be pretty easy to fix - property's > should probably get their own call site object so it'll be specialized > to the specific property (maybe we could share a common one of the > function is a PythonFunction as these generate highly shareable calls > between multiple function instances). We're also doing a params call > today which we could stop doing and get a nice perf boost on > properties. > >> > >>> -----Original Message----- > >>> From: users-bounces at lists.ironpython.com [mailto:users- > >>> bounces at lists.ironpython.com] On Behalf Of Kamil Dworakowski > >>> Sent: Tuesday, December 16, 2008 11:08 AM > >>> To: users at lists.ironpython.com > >>> Subject: [IronPython] weird performance issue > >>> > >>> We see a very strange side effect of running the follwing code on > the > >>> performance of recalculations in Resolver One. > >>> > >>> def Dumbcorator(fn): > >>> def _inner(self, *args): > >>> return fn(self, *args) > >>> return _inner > >>> > >>> class Locker(object): > >>> @property > >>> @Dumbcorator > >>> def thing(self): > >>> return 2 > >>> > >>> l = Locker() > >>> l.thing > >>> > >>> Specifically, one of the performance test reports results 4 to 8 > times > >>> worse with this snippet in than without (the clock is turned on > after > >>> this snippet executes). If I comment out this snippet from the > code, > >>> it suddenly runs 4 to 8 times faster. The fact that I can comment > it > >>> out means that it is not used in the test, so it is bizzare that it > >>> slows it down. > >>> > >>> We can't reproduce the slow down in a clean example though. I hope > >>> something clicks for somebody and gives me a hint as to what is > going > >>> on. Tomorrow I'll continue on trying to minimize the code that is > >>> being slowed down, and hopefully come up with some decent repro. > >>> _______________________________________________ > >>> Users mailing list > >>> Users at lists.ironpython.com > >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > >> _______________________________________________ > >> Users mailing list > >> Users at lists.ironpython.com > >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > >> > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -- > Orestis Markou > Software Engineer, > Resolver Systems Ltd. > orestis at resolversystems.com > +44 (0) 20 7253 6372 > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From seshapv at microsoft.com Wed Dec 17 19:21:55 2008 From: seshapv at microsoft.com (Seshadri Pillailokam Vijayaraghavan) Date: Wed, 17 Dec 2008 10:21:55 -0800 Subject: [IronPython] DLR spec document In-Reply-To: <4949429D.1070001@resolversystems.com> References: <4949429D.1070001@resolversystems.com> Message-ID: <4F06AAB8EC03C349A5D6D0A797C4881C6980B04E6C@NA-EXMSG-C112.redmond.corp.microsoft.com> We recently created a separate codeplex project for the DLR and that will host the latest DLR documents (including the Hosting spec). Please see this - http://www.codeplex.com/dlr/Wiki/View.aspx?title=Docs%20and%20specs&referringTitle=Home This page is guaranteed to contain the latest DLR documents from now on. Thanks sesh -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Orestis Markou Sent: Wednesday, December 17, 2008 10:19 AM To: Discussion of IronPython Subject: [IronPython] DLR spec document Hi all, the Hosting API spec from http://blogs.msdn.com/ironpython/archive/2008/03/16/dlr-resources.aspx seems to contain insinuations that it is not up-to-date. I was wondering if this actually stands and how much we should depend on it. Thanks very much, Orestis -- Orestis Markou Software Engineer, Resolver Systems Ltd. orestis at resolversystems.com +44 (0) 20 7253 6372 _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at microsoft.com Wed Dec 17 20:02:18 2008 From: dinov at microsoft.com (Dino Viehland) Date: Wed, 17 Dec 2008 11:02:18 -0800 Subject: [IronPython] weird performance issue In-Reply-To: <93fc29d60812171002r1ff25939v67fbae80be9dee7a@mail.gmail.com> References: <93fc29d60812161107y79acc3dqbd99391e42f24eed@mail.gmail.com> <350E7D38B6D819428718949920EC2355564BF25378@NA-EXMSG-C102.redmond.corp.microsoft.com> <93fc29d60812171002r1ff25939v67fbae80be9dee7a@mail.gmail.com> Message-ID: <350E7D38B6D819428718949920EC2355564BF25555@NA-EXMSG-C102.redmond.corp.microsoft.com> Here's the simplest version of the fix, it's just updating one file so properties get their own call sites. I'll work on a more involved fix that I'll get into 2.1 soon and probably into 2.0.1 a few days later. Note this diff is from 2.1 but I've updated the names of things that have changed since 2.0. File: Descriptors.cs =================================================================== --- Descriptors.cs;C633889 (server) 12/17/2008 10:43 AM +++ Descriptors.cs (local) 12/17/2008 10:43 AM @@ -21,6 +21,10 @@ using IronPython.Runtime.Operations; using IronPython.Runtime.Types; +using IronPython.Runtime.Binding; +using Microsoft.Scripting.Actions; namespace IronPython.Runtime { [PythonType] @@ -92,6 +96,7 @@ [PythonType] public class PythonProperty : PythonTypeSlot { private object _fget, _fset, _fdel, _doc; + private CallSite> _getSite; public PythonProperty() { } @@ -177,7 +182,15 @@ public new object __get__(CodeContext/*!*/ context, object instance, object owner) { if (instance == null) return this; - if (fget != null) return PythonCalls.Call(context, fget, instance); + if (_getSite == null) { + _getSite = CallSite>.Create( + new InvokeBinder( + PythonContext.GetContext(context).DefaultBinderState, + new CallSignature(1) + ) + ); + } + if (fget != null) return _getSite.Target(_getSite, context, fget, instance); throw PythonOps.AttributeError("unreadable attribute"); } > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Kamil Dworakowski > Sent: Wednesday, December 17, 2008 10:03 AM > To: Discussion of IronPython > Subject: Re: [IronPython] weird performance issue > > Thanks Dino, it looks like you are right. I print whenever > _supportAdding == false. > It happens a lot with the snippet executed, whereas it doesn't happen > at all with > the snippet commented out. > > We also discovered that the slow down only occurs when we compile code > to dlls (no _supportAdding == false if runned from sources). > Still can't come up with a repro though. If you provide us with a > patch, we can > test if it solves the problem in our code. > > As a short term solution we have removed all the properties from > decorated functions. This fixed one performance test. We moved to > other performance tests and we still see that some functions are > slower when executed from dlls, so the same slow down might be > triggered by sth else. > > On Wed, Dec 17, 2008 at 3:21 AM, Dino Viehland > wrote: > > My guess would be that we're pushing the PythonContext._callSplatSite > outside of the sweet spot in DLR site caches. > > > > You could check this by putting a breakpoint in > PythonContext.Call(object, params object[]). Then look and see if > _callSplatSite._rules is an instance of EmptyRuleSet with > _supportAdding == false. > > > > If this is the cause it should be pretty easy to fix - property's > should probably get their own call site object so it'll be specialized > to the specific property (maybe we could share a common one of the > function is a PythonFunction as these generate highly shareable calls > between multiple function instances). We're also doing a params call > today which we could stop doing and get a nice perf boost on > properties. > > > >> -----Original Message----- > >> From: users-bounces at lists.ironpython.com [mailto:users- > >> bounces at lists.ironpython.com] On Behalf Of Kamil Dworakowski > >> Sent: Tuesday, December 16, 2008 11:08 AM > >> To: users at lists.ironpython.com > >> Subject: [IronPython] weird performance issue > >> > >> We see a very strange side effect of running the follwing code on > the > >> performance of recalculations in Resolver One. > >> > >> def Dumbcorator(fn): > >> def _inner(self, *args): > >> return fn(self, *args) > >> return _inner > >> > >> class Locker(object): > >> @property > >> @Dumbcorator > >> def thing(self): > >> return 2 > >> > >> l = Locker() > >> l.thing > >> > >> Specifically, one of the performance test reports results 4 to 8 > times > >> worse with this snippet in than without (the clock is turned on > after > >> this snippet executes). If I comment out this snippet from the code, > >> it suddenly runs 4 to 8 times faster. The fact that I can comment it > >> out means that it is not used in the test, so it is bizzare that it > >> slows it down. > >> > >> We can't reproduce the slow down in a clean example though. I hope > >> something clicks for somebody and gives me a hint as to what is > going > >> on. Tomorrow I'll continue on trying to minimize the code that is > >> being slowed down, and hopefully come up with some decent repro. > >> _______________________________________________ > >> Users mailing list > >> Users at lists.ironpython.com > >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at microsoft.com Wed Dec 17 20:04:33 2008 From: dinov at microsoft.com (Dino Viehland) Date: Wed, 17 Dec 2008 11:04:33 -0800 Subject: [IronPython] weird performance issue In-Reply-To: <93fc29d60812171002r1ff25939v67fbae80be9dee7a@mail.gmail.com> References: <93fc29d60812161107y79acc3dqbd99391e42f24eed@mail.gmail.com> <350E7D38B6D819428718949920EC2355564BF25378@NA-EXMSG-C102.redmond.corp.microsoft.com> <93fc29d60812171002r1ff25939v67fbae80be9dee7a@mail.gmail.com> Message-ID: <350E7D38B6D819428718949920EC2355564BF25556@NA-EXMSG-C102.redmond.corp.microsoft.com> Oh, if you also want to get a list of call stacks to PythonContext.Call and send those our way that'd be useful as well. In general we only want to hit that when the overall cost of whatever we're doing will dwarf any overhead of that one call. And we certainly have more calls to it then we should :( > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Kamil Dworakowski > Sent: Wednesday, December 17, 2008 10:03 AM > To: Discussion of IronPython > Subject: Re: [IronPython] weird performance issue > > Thanks Dino, it looks like you are right. I print whenever > _supportAdding == false. > It happens a lot with the snippet executed, whereas it doesn't happen > at all with > the snippet commented out. > > We also discovered that the slow down only occurs when we compile code > to dlls (no _supportAdding == false if runned from sources). > Still can't come up with a repro though. If you provide us with a > patch, we can > test if it solves the problem in our code. > > As a short term solution we have removed all the properties from > decorated functions. This fixed one performance test. We moved to > other performance tests and we still see that some functions are > slower when executed from dlls, so the same slow down might be > triggered by sth else. > > On Wed, Dec 17, 2008 at 3:21 AM, Dino Viehland > wrote: > > My guess would be that we're pushing the PythonContext._callSplatSite > outside of the sweet spot in DLR site caches. > > > > You could check this by putting a breakpoint in > PythonContext.Call(object, params object[]). Then look and see if > _callSplatSite._rules is an instance of EmptyRuleSet with > _supportAdding == false. > > > > If this is the cause it should be pretty easy to fix - property's > should probably get their own call site object so it'll be specialized > to the specific property (maybe we could share a common one of the > function is a PythonFunction as these generate highly shareable calls > between multiple function instances). We're also doing a params call > today which we could stop doing and get a nice perf boost on > properties. > > > >> -----Original Message----- > >> From: users-bounces at lists.ironpython.com [mailto:users- > >> bounces at lists.ironpython.com] On Behalf Of Kamil Dworakowski > >> Sent: Tuesday, December 16, 2008 11:08 AM > >> To: users at lists.ironpython.com > >> Subject: [IronPython] weird performance issue > >> > >> We see a very strange side effect of running the follwing code on > the > >> performance of recalculations in Resolver One. > >> > >> def Dumbcorator(fn): > >> def _inner(self, *args): > >> return fn(self, *args) > >> return _inner > >> > >> class Locker(object): > >> @property > >> @Dumbcorator > >> def thing(self): > >> return 2 > >> > >> l = Locker() > >> l.thing > >> > >> Specifically, one of the performance test reports results 4 to 8 > times > >> worse with this snippet in than without (the clock is turned on > after > >> this snippet executes). If I comment out this snippet from the code, > >> it suddenly runs 4 to 8 times faster. The fact that I can comment it > >> out means that it is not used in the test, so it is bizzare that it > >> slows it down. > >> > >> We can't reproduce the slow down in a clean example though. I hope > >> something clicks for somebody and gives me a hint as to what is > going > >> on. Tomorrow I'll continue on trying to minimize the code that is > >> being slowed down, and hopefully come up with some decent repro. > >> _______________________________________________ > >> Users mailing list > >> Users at lists.ironpython.com > >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From empirebuilder at gmail.com Wed Dec 17 20:59:33 2008 From: empirebuilder at gmail.com (Dody Gunawinata) Date: Wed, 17 Dec 2008 21:59:33 +0200 Subject: [IronPython] ASP.Net IronPython Refresh Message-ID: <8cd017b80812171159l55653792ve4ba9fb5754f24eb@mail.gmail.com> Does anybody know when the IronPython for ASP.Net gets updated for the final version of IronPython 2.0? -- nomadlife.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From jslutter at reactorzero.com Wed Dec 17 21:19:41 2008 From: jslutter at reactorzero.com (Jeff Slutter) Date: Wed, 17 Dec 2008 15:19:41 -0500 Subject: [IronPython] Loading IronPython.dll from memory Message-ID: <49495EDD.1010408@reactorzero.com> [I can work around this, but I'm curious if there is a solution] Due to some crazy requirements, I'm trying to load my assemblies from memory. I have setup an Assembly Resolver with: AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(ResolveInternalAssembly); And it gets called. Inside the ResolveInternalAssembly I do the following: 1) check my Dictionary to see if I have already loaded the assembly, if so I return it, otherwise... 2) I, currently, open the file, read in the file to byte[] and then call 3) AppDomain.CurrentDomain.Load(asmbytes) to load the Assembly, store it to the dictionary and return it. (see: http://weblogs.asp.net/justin_rogers/archive/2004/06/07/149964.aspx) This works well and all until I get to the following code within one of my loaded assemblies: m_engine = m_runtime.GetEngine("Python"); It throws an exception saying: Microsoft.Scripting.InvalidImplementationException Type 'IronPython.Runtime.PythonContext' doesn't provide a suitable public constructor or its implementation is faulty: The type initializer for 'IronPython.Runtime.SysModule' threw an exception. I assume this is some sort of security/permissions problem because that is the main thing that is different when loading an assembly from memory than file. My work around is to pre-load the IronPython.dll assembly before hooking up my AssemblyResolve (its the only one I have to 'preload') dynamicAssemblyHash["IronPython"] = Assembly.LoadFile(System.IO.Path.Combine(assemblyLocation, "IronPython.dll")); Any ideas? -Jeff From fuzzyman at voidspace.org.uk Wed Dec 17 22:37:37 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Wed, 17 Dec 2008 21:37:37 +0000 Subject: [IronPython] Loading IronPython.dll from memory In-Reply-To: <49495EDD.1010408@reactorzero.com> References: <49495EDD.1010408@reactorzero.com> Message-ID: <49497121.9040100@voidspace.org.uk> Jeff Slutter wrote: > [I can work around this, but I'm curious if there is a solution] > > Due to some crazy requirements, I'm trying to load my assemblies from > memory. I have setup an Assembly Resolver with: > > AppDomain.CurrentDomain.AssemblyResolve += new > ResolveEventHandler(ResolveInternalAssembly); > > And it gets called. Inside the ResolveInternalAssembly I do the following: > > 1) check my Dictionary to see if I have already loaded the assembly, if > so I return it, otherwise... > 2) I, currently, open the file, read in the file to byte[] and then call > 3) AppDomain.CurrentDomain.Load(asmbytes) to load the Assembly, store it > to the dictionary and return it. > > (see: http://weblogs.asp.net/justin_rogers/archive/2004/06/07/149964.aspx) > > This works well and all until I get to the following code within one of > my loaded assemblies: > m_engine = m_runtime.GetEngine("Python"); > Is this using the IronPython hosting API? That doesn't look like code that would have worked with any recent version of IronPython. Try: engine = Python.CreateEngine(); Michael > It throws an exception saying: > Microsoft.Scripting.InvalidImplementationException > Type 'IronPython.Runtime.PythonContext' doesn't provide a suitable > public constructor or its implementation is faulty: The type initializer > for 'IronPython.Runtime.SysModule' threw an exception. > > > I assume this is some sort of security/permissions problem because that > is the main thing that is different when loading an assembly from memory > than file. > > My work around is to pre-load the IronPython.dll assembly before hooking > up my AssemblyResolve (its the only one I have to 'preload') > dynamicAssemblyHash["IronPython"] = > Assembly.LoadFile(System.IO.Path.Combine(assemblyLocation, > "IronPython.dll")); > > Any ideas? > -Jeff > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From jslutter at reactorzero.com Thu Dec 18 03:17:10 2008 From: jslutter at reactorzero.com (Jeff Slutter) Date: Wed, 17 Dec 2008 21:17:10 -0500 Subject: [IronPython] Loading IronPython.dll from memory In-Reply-To: <49497121.9040100@voidspace.org.uk> References: <49495EDD.1010408@reactorzero.com> <49497121.9040100@voidspace.org.uk> Message-ID: <4949B2A6.4050400@reactorzero.com> I snipped a little extra - my code is really: Dictionary runtimeOptions = new Dictionary(); runtimeOptions["Debug"] = true; m_runtime = IronPython.Hosting.Python.CreateRuntime(runtimeOptions); m_runtime.LoadAssembly(typeof(String).Assembly); // Add reference to System m_runtime.LoadAssembly(typeof(Uri).Assembly); // Add reference to mscorlib m_runtime.LoadAssembly(System.Reflection.Assembly.GetCallingAssembly()); m_engine = m_runtime.GetEngine("Python"); I've also tried replacing the above with: m_engine = Python.CreateEngine(); and I get the same exception in the call to Python.CreateEngine() (Note: the exception exists without all the extra LoadAssemblys and stripped to the bone). Michael Foord wrote: > Jeff Slutter wrote: >> [I can work around this, but I'm curious if there is a solution] >> >> Due to some crazy requirements, I'm trying to load my assemblies from >> memory. I have setup an Assembly Resolver with: >> >> AppDomain.CurrentDomain.AssemblyResolve += new >> ResolveEventHandler(ResolveInternalAssembly); >> >> And it gets called. Inside the ResolveInternalAssembly I do the >> following: >> >> 1) check my Dictionary to see if I have already loaded the assembly, if >> so I return it, otherwise... >> 2) I, currently, open the file, read in the file to byte[] and then call >> 3) AppDomain.CurrentDomain.Load(asmbytes) to load the Assembly, store it >> to the dictionary and return it. >> >> (see: >> http://weblogs.asp.net/justin_rogers/archive/2004/06/07/149964.aspx) >> >> This works well and all until I get to the following code within one of >> my loaded assemblies: >> m_engine = m_runtime.GetEngine("Python"); >> > > Is this using the IronPython hosting API? That doesn't look like code > that would have worked with any recent version of IronPython. > > Try: > > engine = Python.CreateEngine(); > > Michael > > > >> It throws an exception saying: >> Microsoft.Scripting.InvalidImplementationException >> Type 'IronPython.Runtime.PythonContext' doesn't provide a suitable >> public constructor or its implementation is faulty: The type initializer >> for 'IronPython.Runtime.SysModule' threw an exception. >> >> >> I assume this is some sort of security/permissions problem because that >> is the main thing that is different when loading an assembly from memory >> than file. >> >> My work around is to pre-load the IronPython.dll assembly before hooking >> up my AssemblyResolve (its the only one I have to 'preload') >> dynamicAssemblyHash["IronPython"] = >> Assembly.LoadFile(System.IO.Path.Combine(assemblyLocation, >> "IronPython.dll")); >> >> Any ideas? >> -Jeff >> >> >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > > From dinov at microsoft.com Thu Dec 18 03:17:18 2008 From: dinov at microsoft.com (Dino Viehland) Date: Wed, 17 Dec 2008 18:17:18 -0800 Subject: [IronPython] test... Message-ID: <350E7D38B6D819428718949920EC2355564BF257C2@NA-EXMSG-C102.redmond.corp.microsoft.com> This is just a test... there were some issues with the mailing list today, just verifying that it should be back now. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Thu Dec 18 05:15:08 2008 From: dinov at microsoft.com (Dino Viehland) Date: Wed, 17 Dec 2008 20:15:08 -0800 Subject: [IronPython] Issue about string.upper and string.lower In-Reply-To: <350E7D38B6D819428718949920EC2355564B62EE33@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <2679f6510812120727o58a85ec4ub686aeac4dc4820b@mail.gmail.com> <350E7D38B6D819428718949920EC2355564B62EE33@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <350E7D38B6D819428718949920EC2355564BF257E1@NA-EXMSG-C102.redmond.corp.microsoft.com> There were no issues with making this change revealed by our tests. The change is in our 2.1 branch internally so should so up externally really soon. I suspect we'll discuss backporting it to 2.0.1 at one of our team meetings but unless we hear about some issues this causes then I personally would be pro-backporting. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: Monday, December 15, 2008 11:13 PM To: glenn.k.jones+ipy at gmail.com; Discussion of IronPython Subject: Re: [IronPython] Issue about string.upper and string.lower I've actually looked at this not too long ago and I think your proposal of calling the Invariant functions is the correct solution. I was looking at a few things: This bug http://bugs.python.org/issue1528802, the 3.0 decimal.py module, and also just using Turkish I at the command prompt. If you follow the comments the bug says: "String upper and lower conversion are locale dependent and implemented by the underlying libc, whereas Unicode upper/lower conversion is not and only depends on the Unicode character database." That's a pretty clear statement that we shouldn't be using the current locale for our upper/lower string conversions. It wouldn't surprise me if that breaks something somewhere because we won't be doing locale dependent conversions on what someone expects to its type to be str not unicode but in this case I think it'd be better to be consistent with the Unicode side of Python as that's our future. As for the decimal module it doesn't change from 2.x to 3.0. So .upper() apparently doesn't have this problem when CPython switches to Unicode strings. Or at least no one's hit it, and when they do I think the resolution would be the same as 1528802. Finally at the command prompt I could never get CPython to do a culture-sensitive operation. I hadn't fully convinced myself on that part though because I hadn't yet escalated to a Turkish install of the OS running IronPython. But I'm still pretty confident we're at fault and we should change our lower/upper implementation. Obviously the change is easy but I'll do a full test pass to see if it breaks anything. I also think calling ToUpper to get non-Pythonic results is easy enough (I actually think it's kind of better this way - it saves typing out the framework friendly ToUpperInvariant :)). From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Glenn Jones Sent: Friday, December 12, 2008 7:27 AM To: Discussion of IronPython Subject: [IronPython] Issue about string.upper and string.lower Hello everybody, We ran across http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=13629 (turkish collation issues) today while trying to port Resolver One to IronPython 2.0. This is in a test that tries to import decimal while in the turkish locale (it was actually reported by a user!). It does an .upper on a string with an 'i', and that doesn't give the expected results. This is a very big issue because all the python code out there expects string transformations to be locale-independent, and there may be strange bugs in strange places. Is mapping .upper and .lower to ToUpperInvariant and ToLowerInvariant an acceptable solution? People that want to do locale-dependent transformations can always use the .NET specific ToUpper/ToLower. We can work around the decimal being unimportable by hacking it, but clearly this is not a general solution. We will report other modules that might fail from this as we find them. Thanks, Glenn and Orestis -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom.wright at resolversystems.com Thu Dec 18 13:00:10 2008 From: tom.wright at resolversystems.com (Tom Wright) Date: Thu, 18 Dec 2008 12:00:10 +0000 Subject: [IronPython] IronPython and file descriptors In-Reply-To: <494924ED.30604@resolversystems.com> References: <49467FDA.5000101@resolversystems.com> <494695C0.9040401@resolversystems.com> <49469F86.8040901@resolversystems.com> <350E7D38B6D819428718949920EC2355564B62EAC4@NA-EXMSG-C102.redmond.corp.microsoft.com> <6f4025010812151252p2bb355d7p1b9d915c0b033016@mail.gmail.com> <350E7D38B6D819428718949920EC2355564B62EC42@NA-EXMSG-C102.redmond.corp.microsoft.com> <4946D288.5020909@voidspace.org.uk> <49478AD4.1080002@resolversystems.com> <494924ED.30604@resolversystems.com> Message-ID: <494A3B4A.4030707@resolversystems.com> Before playing with this, it's probably worth knowing that the following can cause exceptions or no exceptions and lost output from the final write. 1 Writing to a PythonFile 2 Getting the PythonFile's stream's file handle 3 Converting the handle to a file descriptor 4 Writing to this file descriptor directly in C using write ---- Fine up to this point 5 Writing to the PythonFile again Since code that does steps 1-4 is likely to also perform 5 it may not be worthwhile having file.fileno() return a valid file descriptor unless step 5 can be made to work. Though I appreciate that this is problematic and that there are good reasons for having PythonFiles wrap FileStreams. Tom William Reade wrote: > Just a quick note: you can't necessarily just P/invoke out to msvcrt, > because CPython was built with msvcr71. Sorry :(. > > Tom Wright wrote: >> I'm not sure about sockets. The only example I have found in the wild >> so far is with files in PIL. >> >> The python implementation seems to have socket.fileno() returning a >> file descriptor which comes from 's socketpair function >> in the standard C library (see socketmodule.c if you are interested) >> >> So, again, it would be possible for people to pass this identifier as >> an integer directly to C. Whether people do this in practice is a >> different question... >> >> Tom >> >> >> >> Michael Foord wrote: >>> Dino Viehland wrote: >>>> >>>> (now I?ve replied to the correct thread?) >>>> >>>> Can you open a feature request on CodePlex? It's certainly an >>>> interesting idea to ponder and I'm leaning towards it but there's >>>> lots of details to be gotten right. >>>> >>>> Do you know if this needs to work w/ sockets as well? (There's also >>>> the question of can we make it work with sockets? :)) >>>> >>>> There'll be a bunch of places we need to update (nt, socket, file, >>>> select, etc...) so I think it'll have to wait until 2.1 instead of >>>> coming in a minor update like 2.0.1. >>>> >>> >>> Tom will have to comment on whether it is needed for sockets as >>> well. Not yet I guess. :-) >>> >>> Tom created an issue on Codeplex - I've added a comment to that: >>> >>> http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20242 >>> >>> Michael >>>> >>>> *From:* users-bounces at lists.ironpython.com >>>> [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Michael >>>> Foord >>>> *Sent:* Monday, December 15, 2008 12:53 PM >>>> *To:* Discussion of IronPython >>>> *Subject:* Re: [IronPython] IronPython and file descriptors >>>> >>>> 2008/12/15 Dino Viehland >>> > >>>> >>>> Presumably CPython is linking against msvcrt and is using the C >>>> abstraction rather than calling the Win32 APIs which return handles >>>> directly. >>>> >>>> As Curt said the biggest problem for us is that .NET does not >>>> expose C file descriptors. Therefore we could fix this by >>>> P/Invoking out to msvcrt. For users on other platforms we'd need to >>>> either add support for their platform or hope that their handles == >>>> C runtime file descriptors. For something like fileno maybe this is >>>> ok because it's an interop point only - or are there any >>>> non-interop uses of fileno in the world? >>>> >>>> What do people think of this? This would be the 1st place where we >>>> would add a P/Invoke so I'd want to tread lightly and make sure >>>> this is really the right thing to do. >>>> >>>> >>>> >>>> Well, some way of doing this is needed if certain Python C >>>> extensions are to work with Ironclad. Perhaps a global or per >>>> engine setting that allows file handles to be associated with a C >>>> descriptor. Users of Ironclad could switch it on if they wished and >>>> take the consequences. >>>> >>>> Michael Foord >>>> >>>> >>>> -----Original Message----- >>>> From: users-bounces at lists.ironpython.com >>>> >>>> [mailto:users-bounces at lists.ironpython.com >>>> ] On Behalf Of Slide >>>> Sent: Monday, December 15, 2008 10:21 AM >>>> To: Discussion of IronPython >>>> Subject: Re: [IronPython] IronPython and file descriptors >>>> >>>> On Mon, Dec 15, 2008 at 11:18 AM, Tom Wright >>>> >>> > wrote: >>>> > Agreed. It is certainly possible with some work to get a file >>>> descriptor and >>>> > pass it to C code. >>>> > >>>> > This is not the problem, however. Ironclad's aim (eventually) is >>>> to allow >>>> > *arbitrary* C extensions to work with Ironpython without >>>> changing the >>>> > extensions. Ctypes aim is to allow arbitrary C code to be run by >>>> python >>>> > (possibly in other python libraries which you really don't want >>>> to modify). >>>> > >>>> > In CPython .fileno() is a file descriptor and some modules use >>>> this fact >>>> > (specifically PIL) by passing file descriptors as integers into >>>> C code. I do >>>> > not know how one can make this code work in IronPython unless >>>> .fileno() >>>> > returns a file descriptor. >>>> > >>>> > The game here is not making a particular C library work with >>>> IronPython by >>>> > modifying this library but making as many libraries as possible >>>> work without >>>> > modification. Of course whether this is worthwhile depends on >>>> how many >>>> > libraries rely on this fact. >>>> > >>>> > Sorry - I hope this is a little clearer. >>>> > >>>> > Tom >>>> >>>> >>>> How does CPython get the file descriptor for fileno()? Does it just >>>> return the HANDLE on Windows? >>>> >>>> slide >>>> _______________________________________________ >>>> Users mailing list >>>> Users at lists.ironpython.com >>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>>> _______________________________________________ >>>> Users mailing list >>>> Users at lists.ironpython.com >>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>>> >>>> >>>> >>>> >>>> -- >>>> http://www.ironpythoninaction.com/ >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> >>>> _______________________________________________ >>>> Users mailing list >>>> Users at lists.ironpython.com >>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From yashgt at gmail.com Thu Dec 18 15:57:54 2008 From: yashgt at gmail.com (Yash Ganthe) Date: Thu, 18 Dec 2008 20:27:54 +0530 Subject: [IronPython] Descriptive reports in unittest module Message-ID: <4f428e7b0812180657v50f7523flb54365b19c7766a4@mail.gmail.com> I am using the unittest module in IronPython 2.0. My TestClass has a function named testLoginWithInvalidUsername. I would like to attach a string to this function so that if the test fails, the string would be printed as: Failed : Testing the login functionality with invalid user name I am not asking for something that will automatically figure out the string to be printed. I am looking for a way for me to attach an attribute to the test function so that the string in the attribute gets printed. Is there something readily avaliable for doing this? Currently my test report comes out as: testDateDiffWeek (PI.GetMessages.GetMessagesTestClass) ... ok testGetMessageGUIDnull (PI.GetMessages.GetMessagesTestClass) ... FAIL Thanks, Yash -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at gmail.com Thu Dec 18 16:09:52 2008 From: fuzzyman at gmail.com (Michael Foord) Date: Thu, 18 Dec 2008 15:09:52 +0000 Subject: [IronPython] Descriptive reports in unittest module In-Reply-To: <4f428e7b0812180657v50f7523flb54365b19c7766a4@mail.gmail.com> References: <4f428e7b0812180657v50f7523flb54365b19c7766a4@mail.gmail.com> Message-ID: <6f4025010812180709qb99239dycbe2a2061aa65a26@mail.gmail.com> 2008/12/18 Yash Ganthe > I am using the unittest module in IronPython 2.0. > > My TestClass has a function named testLoginWithInvalidUsername. I would > like to attach a string to this function so that if the test fails, the > string would be printed as: > Failed : Testing the login functionality with invalid user name > I am not asking for something that will automatically figure out the string > to be printed. I am looking for a way for me to attach an attribute to the > test function so that the string in the attribute gets printed. > > Is there something readily avaliable for doing this? Most unittest assert methods take an optional message parameter - where the message is the failure message. e.g. self.assertEquals('foo', 'bar', 'foo is not equal to bar') Michael > > > Currently my test report comes out as: > testDateDiffWeek (PI.GetMessages.GetMessagesTestClass) ... ok > testGetMessageGUIDnull (PI.GetMessages.GetMessagesTestClass) ... FAIL > > Thanks, > Yash > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -- http://www.ironpythoninaction.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.foord at resolversystems.com Thu Dec 18 18:27:49 2008 From: michael.foord at resolversystems.com (Michael Foord) Date: Thu, 18 Dec 2008 17:27:49 +0000 Subject: [IronPython] The Resolver One Spreadsheet Challenge Message-ID: <494A8815.6090504@resolversystems.com> Resolver One is the Python powered spreadsheet created by Resolver Systems. Resolver One is a highly programmable spreadsheet program built with IronPython. It is capable of creating powerful spreadsheet systems, but is easy to program with Python and .NET libraries. We?re convinced that Resolver One allows people to create astonishing things that simply aren?t possible in a traditional spreadsheet environment. And we want to prove it. Enter the Resolver One Spreadsheet Challenge: http://www.resolversystems.com/competition/ The Resolver One Challenge We're so confident about the revolutionary potential of Resolver One that we've set up the $25,000 Resolver One Challenge. Every month between now and May, we will be giving away $2,000 for the best spreadsheet we receive. And in late May, we'll be handing over $15,000 for the best of the best. Let your imagination run wild Build a blogging engine directly in Resolver One. Hook Resolver One up to existing .NET or Python libraries in unusual ways. Build the game of life, or a Mandelbrot viewer directly into the grid. Get Infocom adventure games running inside a spreadsheet; or for that matter, have a conversation with Eliza. Make a music player that does visualisations in the cells. Or something more businesslike? Use the sophisticated web integration to pull of stock prices, or integrate your spreadsheet with Google Maps. (Perhaps you could build a spreadsheet that plots a map, showing in which part of the country stock or house prices are rising or falling the most.) Build an election predictor (and use a combination of Monte Carlo analysis and the web front end to make it really special). In other words: Resolver One gives you the tools, you just need to use your imagination, and your Python and spreadsheet skills! Resolver One is free to try and for non-commercial and Open Source uses. You can download it from: http://www.resolversystems.com/download/ To get you started with Resolver One we have a new tutorial. It takes you through all the major features, with examples to try: http://www.resolversystems.com/documentation/index.php/Tutorial.html Michael Foord Software Developer Resolver Systems -- Michael Foord Senior Software Engineer, Resolver Systems Ltd. michael.foord at resolversystems.com +44 (0) 20 7253 6372 Try out Resolver One! 17a Clerkenwell Road, London EC1M 5RD, UK VAT No.: GB 893 5643 79 Registered in England and Wales as company number 5467329. Registered address: 843 Finchley Road, London NW11 8NA, UK From kristian.jaksch at gmail.com Fri Dec 19 10:38:04 2008 From: kristian.jaksch at gmail.com (xkrja) Date: Fri, 19 Dec 2008 01:38:04 -0800 (PST) Subject: [IronPython] Online IronPython interpreter and DLRconsole. Message-ID: <21088369.post@talk.nabble.com> I've seen Michael Foord's "Interactive Interpreter" made in Silverlight 2 and the DLRconsole (I assume made by Jimmy Schementi) and I like them a lot. But my question is: What controls have been used to mimic the console "feeling"? I've tried to read the source code but can't find how it's built up. I would like something similar but can't figure out how to do it. Of course I can go with a textblock and textbox but that wouldn't give the real feeling. Thanks for any help! -- View this message in context: http://www.nabble.com/Online-IronPython-interpreter-and-DLRconsole.-tp21088369p21088369.html Sent from the IronPython mailing list archive at Nabble.com. From fuzzyman at voidspace.org.uk Fri Dec 19 13:10:45 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 19 Dec 2008 12:10:45 +0000 Subject: [IronPython] Online IronPython interpreter and DLRconsole. In-Reply-To: <21088369.post@talk.nabble.com> References: <21088369.post@talk.nabble.com> Message-ID: <494B8F45.1070900@voidspace.org.uk> xkrja wrote: > I've seen Michael Foord's "Interactive Interpreter" made in Silverlight 2 and > the DLRconsole (I assume made by Jimmy Schementi) and I like them a lot. > > But my question is: What controls have been used to mimic the console > "feeling"? I've tried to read the source code but can't find how it's built > up. I would like something similar but can't figure out how to do it. > > Of course I can go with a textblock and textbox but that wouldn't give the > real feeling. > > Thanks for any help! > My project ('Python in the Browser') doesn't use any controls. It works with an HTML textarea and Javascript. When I get any time to work on it I will probably change this - but still use HTML components rather than Silverlight controls. You might like to also check out Dan Eloff's very slick Silvershell: http://code.google.com/p/silvershell/ Michael Foord -- http://www.ironpythoninaction.com/ From Jimmy.Schementi at microsoft.com Sat Dec 20 01:43:38 2008 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Fri, 19 Dec 2008 16:43:38 -0800 Subject: [IronPython] ASP.Net IronPython Refresh In-Reply-To: <8cd017b80812171159l55653792ve4ba9fb5754f24eb@mail.gmail.com> References: <8cd017b80812171159l55653792ve4ba9fb5754f24eb@mail.gmail.com> Message-ID: <5283CA0A4168DF4FBBD71AE9ECA5A3284BDEA69D14@NA-EXMSG-C116.redmond.corp.microsoft.com> Hopefully getting a build out soon ... I'll keep this list posted. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata Sent: Wednesday, December 17, 2008 12:00 PM To: Discussion of IronPython Subject: [IronPython] ASP.Net IronPython Refresh Does anybody know when the IronPython for ASP.Net gets updated for the final version of IronPython 2.0? -- nomadlife.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jimmy.Schementi at microsoft.com Sat Dec 20 01:56:04 2008 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Fri, 19 Dec 2008 16:56:04 -0800 Subject: [IronPython] Online IronPython interpreter and DLRconsole. In-Reply-To: <494B8F45.1070900@voidspace.org.uk> References: <21088369.post@talk.nabble.com> <494B8F45.1070900@voidspace.org.uk> Message-ID: <5283CA0A4168DF4FBBD71AE9ECA5A3284BDEA69D1C@NA-EXMSG-C116.redmond.corp.microsoft.com> DLRConsole isn't really reusable today, which is why I've been rewriting it in C# and adding it to Microsoft.Scripting.Silverlight: (http://github.com/jschementi/agdlr). It can be enabled by putting console=true in initParams (http://blog.jimmy.schementi.com/2008/11/repls-in-silverlight.html). It's a HTML based console, with a for input. I tried a