Re: [IronPython] Dealing with exceptions in an extension module

2010-04-30 Thread Lukas Cenovsky
Dino Viehland wrote: Jeff wrote: I'm trying to fix up the exceptions for the _sqlite3 module I'm implementing. The dbapi spec (PEP 249) requires a very specific exception hierarchy, including exceptions derived from StandardError. My initial version just used C# Exception classes, but Standa

Re: [IronPython] IronPython Tools for Visual Studio

2010-04-30 Thread Jimmy Schementi
So can we close the connect bug now? :-P ~Jimmy On Apr 27, 2010, at 8:34 PM, "Hank Fay" mailto:h...@prosysplus.com>> wrote: I've been getting everyone (relatives including kids, anyone, programming experience not necessary ) I can cajole into going to MS Connect to vote up Michael's issue on

Re: [IronPython] Dealing with custom sequence/mapping types from C#

2010-04-30 Thread Jeff Hardy
For the list case, I need the count - it would be nice to get it fast :) but I can work without it. For the dict case, will that handle __missing__? I thought I tried it and it didn't work, but I could have missed something. - Jeff Sent from my Windows® phone. -Original Message- From: D

[IronPython] Announcing IronPython Tools for Visual Studio

2010-04-30 Thread Dino Viehland
Hello Python Community, We are happy to announce the first broadly available release of IronPython Tools for Visual Studio. IronPython Tools for Visual Studio (IPyTools) is a set of extensions available for Visual Studio 2010 which supports development of IronP

Re: [IronPython] Calling explicitly-implemented interface methods

2010-04-30 Thread Dino Viehland
Michael wrote: > On 30/04/2010 23:58, Dino Viehland wrote: > > Michael wrote: > > > >> On 30/04/2010 23:32, Dino Viehland wrote: > >> > >>> Michael wrote: > >>> > >>> > Hey all, > > I'm porting the dotnet-integration document that comes with IronPython > to Try Python. The follo

Re: [IronPython] Dealing with custom sequence/mapping types from C#

2010-04-30 Thread Dino Viehland
Jeff wrote: > Given the following types (from sqlite3's tests): > > class L(object): > def __len__(self): > return 1 > def __getitem__(self, x): > assert x == 0 > return "foo" > > class D(dict): > def __missing__(self, key): >

[IronPython] Dealing with custom sequence/mapping types from C#

2010-04-30 Thread Jeff Hardy
Given the following types (from sqlite3's tests): class L(object): def __len__(self): return 1 def __getitem__(self, x): assert x == 0 return "foo" class D(dict): def __missing__(self, key): return "foo" Instances

Re: [IronPython] Dealing with exceptions in an extension module

2010-04-30 Thread Jeff Hardy
On Fri, Apr 30, 2010 at 4:10 PM, Dino Viehland wrote: > There's a public PythonOps.CreateThrowable.  It just forwards the call > to the internal PythonExceptions.CreateThrowable. Ah, thank you. > Yeah, maybe we should remove the internals visible to and make everything > it relies on public.  I

Re: [IronPython] Calling explicitly-implemented interface methods

2010-04-30 Thread Michael Foord
On 30/04/2010 23:58, Dino Viehland wrote: Michael wrote: On 30/04/2010 23:32, Dino Viehland wrote: Michael wrote: Hey all, I'm porting the dotnet-integration document that comes with IronPython to Try Python. The following example doesn't work, because RegistryKey isn't ava

Re: [IronPython] Calling explicitly-implemented interface methods

2010-04-30 Thread Michael Foord
On 30/04/2010 23:58, Dino Viehland wrote: Michael wrote: On 30/04/2010 23:32, Dino Viehland wrote: Michael wrote: Hey all, I'm porting the dotnet-integration document that comes with IronPython to Try Python. The following example doesn't work, because RegistryKey isn't ava

Re: [IronPython] Calling explicitly-implemented interface methods

2010-04-30 Thread Dino Viehland
Michael wrote: > On 30/04/2010 23:32, Dino Viehland wrote: > > Michael wrote: > > > >> Hey all, > >> > >> I'm porting the dotnet-integration document that comes with IronPython > >> to Try Python. The following example doesn't work, because RegistryKey > >> isn't available on Silverlight. Can anyon

Re: [IronPython] Calling explicitly-implemented interface methods

2010-04-30 Thread Michael Foord
On 30/04/2010 23:32, Dino Viehland wrote: Michael wrote: Hey all, I'm porting the dotnet-integration document that comes with IronPython to Try Python. The following example doesn't work, because RegistryKey isn't available on Silverlight. Can anyone suggest a good alternative of an explici

Re: [IronPython] Writing a Python iterator in C#?

2010-04-30 Thread Dino Viehland
Jeff wrote: > On Fri, Apr 30, 2010 at 4:19 PM, Dino Viehland wrote: > > That's definitely a bug.  We usually check for the interfaces first and > > we have a code path that's assuming we have a user-defined object when > > we're not an enumerable/enumerator but we have __iter__.  It's easy > > en

Re: [IronPython] Calling explicitly-implemented interface methods

2010-04-30 Thread Dino Viehland
Michael wrote: > Hey all, > > I'm porting the dotnet-integration document that comes with IronPython > to Try Python. The following example doesn't work, because RegistryKey > isn't available on Silverlight. Can anyone suggest a good alternative of > an explicitly implemented interface method on a

Re: [IronPython] Writing a Python iterator in C#?

2010-04-30 Thread Jeff Hardy
On Fri, Apr 30, 2010 at 4:19 PM, Dino Viehland wrote: > That's definitely a bug.  We usually check for the interfaces first and > we have a code path that's assuming we have a user-defined object when > we're not an enumerable/enumerator but we have __iter__.  It's easy > enough to fix we're just

[IronPython] Calling explicitly-implemented interface methods

2010-04-30 Thread Michael Foord
Hey all, I'm porting the dotnet-integration document that comes with IronPython to Try Python. The following example doesn't work, because RegistryKey isn't available on Silverlight. Can anyone suggest a good alternative of an explicitly implemented interface method on a class in Silverlight?

Re: [IronPython] Writing a Python iterator in C#?

2010-04-30 Thread Dino Viehland
Jeff wrote: > I'm trying to implement a Python iterator in C# without also > implementing IEnumerator/IEnumerable (I'm also assuming it's even > possible, of course). When trying to use the class in a for loop (`cu` > is a Cursor instance): > > >>> for row in cu: > print cu > > TypeErro

Re: [IronPython] Dealing with exceptions in an extension module

2010-04-30 Thread Dino Viehland
Jeff wrote: > I'm trying to fix up the exceptions for the _sqlite3 module I'm > implementing. The dbapi spec (PEP 249) requires a very specific > exception hierarchy, including exceptions derived from StandardError. > > My initial version just used C# Exception classes, but StandardError > is not

[IronPython] Writing a Python iterator in C#?

2010-04-30 Thread Jeff Hardy
I'm trying to implement a Python iterator in C# without also implementing IEnumerator/IEnumerable (I'm also assuming it's even possible, of course). When trying to use the class in a for loop (`cu` is a Cursor instance): >>> for row in cu: print cu TypeError: Unable to cast object of ty

[IronPython] Dealing with exceptions in an extension module

2010-04-30 Thread Jeff Hardy
I'm trying to fix up the exceptions for the _sqlite3 module I'm implementing. The dbapi spec (PEP 249) requires a very specific exception hierarchy, including exceptions derived from StandardError. My initial version just used C# Exception classes, but StandardError is not a normal class, so that

Re: [IronPython] Strange IPY / WPF behavior on a ListBox

2010-04-30 Thread Ken MacDonald
Failing being able to get this working, is there a way in IPY/WPF to manually scroll a ListBox? I could theoretically do something like this pseudo-code: while True: if my_selected_item.IsHitTestVisible(): break else: my_selected.item.ScrollDown <= anything like

[IronPython] Strange IPY / WPF behavior on a ListBox

2010-04-30 Thread Ken MacDonald
I'm seeing some weirdness - I had a small popup dialog working in WPF/IPY where I had a ListBox with way too many elements to display, say about 30 or so where the available space would hold 4 or 5. I selected one of the elements (a ListBoxItem in the single selection ListBox), and executed BringIn

Re: [IronPython] Open source project developed in IronPython

2010-04-30 Thread David DiCato
One starting point is the set of samples we release with IronPython. Go to the 2.6 release page at http://ironpython.codeplex.com/releases/view/12482, and take a look at IronPython-2.6-Samples.zip. The 2.6.1 release page (http://ironpython.codeplex.com/releases/view/36280) includes 2 more sampl

Re: [IronPython] Dirstributing scripts as Exe

2010-04-30 Thread David DiCato
These assemblies should automatically be loaded by the CLR before the IronPython engine is ever started. If you're able to execute "import clr", then they have already been loaded successfully. The purpose of clr.AddReference is to make assemblies available from Python, so it is only necessary

Re: [IronPython] Distributing scripts as Exe

2010-04-30 Thread David DiCato
How does your program figure out where to find the standard library? Is it relying on the IRONPYTHONPATH environment variable to point to the location of the standard lib? If so, this is currently broken in pyc.py-generated executables and is a known bug: http://ironpython.codeplex.com/WorkItem

Re: [IronPython] Ironpython delegates never get called

2010-04-30 Thread Curt Hagenlocher
Underlying the event, there's usually a nullable backing field which contains a Delegate that holds on to the subscribed delegates. If you can get at the field, you call GetInvocationList() to return the subscribers. Getting at the field is not possible in all cases because it's not actually requir

Re: [IronPython] Ironpython delegates never get called

2010-04-30 Thread jon vs. python
I finally found it!!! Thanks your help, I apologize 'cause my delegate subscription was wrong. But I'm still interested in my last question though... How can I list subscriptors to a given event? On Fri, Apr 30, 2010 at 5:34 PM, jon vs. python wrote: > This may seem an stupid question, but... Ho

Re: [IronPython] Load an Ironpython dump

2010-04-30 Thread jon vs. python
Thanks Dino, I've tried this... try: mst.reconnect() except Exception as inst: print type(inst) But it didn't catch any exception. On Fri, Apr 30, 2010 at 5:36 PM, Dino Viehland wrote: > You might changing the except to “except Exception

Re: [IronPython] Load an Ironpython dump

2010-04-30 Thread Dino Viehland
You might changing the except to “except Exception:” to see if an exception other than SocketException is being thrown. From: users-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] On Behalf Of jon vs. python Sent: Friday, April 30, 2010 2:57 AM To: Discussion of IronPyth

Re: [IronPython] Ironpython delegates never get called

2010-04-30 Thread jon vs. python
This may seem an stupid question, but... How can I list subscriptors to a given event? ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Re: [IronPython] Ironpython delegates never get called

2010-04-30 Thread jon vs. python
On Fri, Apr 30, 2010 at 4:32 PM, Curt Hagenlocher wrote: > How is the Master object you create from Python shared back with the C# > code? (I'm assuming that the event is being triggered from C#.) How did you > check to see that the events were processed? Does the event-triggering code > swallow e

Re: [IronPython] Ironpython delegates never get called

2010-04-30 Thread Curt Hagenlocher
How is the Master object you create from Python shared back with the C# code? (I'm assuming that the event is being triggered from C#.) How did you check to see that the events were processed? Does the event-triggering code swallow exceptions? On Fri, Apr 30, 2010 at 7:00 AM, jon vs. python wrote:

[IronPython] Ironpython delegates never get called

2010-04-30 Thread jon vs. python
Hi, I've a couple of events in a C# assembly... public class Master { ... public delegate voidResponseData(int id, byte function, byte[] data); public eventResponseDataOnResponseData; public delegate voidExceptionData(int id, byte fun

Re: [IronPython] Load an Ironpython dump

2010-04-30 Thread jon vs. python
I do believe that the problem lies in an assembly that's being used. I'm running the script from IronPython Console, so I guess I'm not doing poor exception handling. import timer import fl def main(): mst = fl.FireLaser() def poll(src, args): try: mst.ReadBrokenFiber(

Re: [IronPython] Load an Ironpython dump

2010-04-30 Thread Lukas Cenovsky
jon vs. python wrote: Hi all, My program is crashing and I'm getting this message: "The program [...\IronPython 2.6\ipy.exe] caused a problem an is going to close. Would you like to save a dump file?" How can I load the dump file generated in order to track the error? Thanks, Jon. Run the p

[IronPython] Load an Ironpython dump

2010-04-30 Thread jon vs. python
Hi all, My program is crashing and I'm getting this message: "The program [...\IronPython 2.6\ipy.exe] caused a problem an is going to close. Would you like to save a dump file?" How can I load the dump file generated in order to track the error? Thanks, Jon. _

[IronPython] Open source project developed in IronPython

2010-04-30 Thread jon vs. python
Hi all, I'm new to IronPython and .NET and I'm looking for an open source project developed in IronPython to browse in order to learn. Any advice? Thanks, Jon. ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/user

[IronPython] Wrong line numbers in traceback when ecoding is specified

2010-04-30 Thread Lukas Cenovsky
Hi all, there is a bug in IronPython 2.6.1 (and 2.6 too) that line numbers in tracebacks are wrong: === file t.py === # encoding: utf-8 print 1/0 C:\IronPython-2.6.1>ipy.exe t.py Traceback (most recent call last): File "t.py", line 1, in ZeroDivisionError: Attempted to divide by zero. The