[Ironpython-users] IronPython, Daily Digest 12/1/2011

2011-12-02 Thread no_reply
Hi ironpython,

Here's your Daily Digest of new issues for project "IronPython".

In today's digest:ISSUES

1. [New comment] I can't import PIL module
2. [New issue] Console color choice is bad for bright consoles

--

ISSUES

1. [New comment] I can't import PIL module
http://ironpython.codeplex.com/workitem/31865
User jdhardy has commented on the issue:

"Unfortunately, PIL uses a C extension module, which isn't supported for 
IronPython."-

2. [New issue] Console color choice is bad for bright consoles
http://ironpython.codeplex.com/workitem/31872
User sblom has proposed the issue:

"May not be an IronPython-owned issue, but I can't find an upstream project to 
instead pursue this against.

REPRO
My default console background color is bright white, with black foreground text.

When Microsoft.Scripting.Hosting.Shell.BasicConsole tries to pick a prompt 
color , it looks to see if my background color is exactly ConsoleColor.Gray. 
When it sees that it's not, it sets the foreground text to ConsoleColor.Gray.

OBSERVED
Light gray on white is _very_ hard to read.

EXPECTED
A slightly more sane color choice, perhaps even using my default foreground 
text color for _promptColor. (Sadly, I haven't figured out how to read that 
color correctly on a non-Windows console.)

VERSION
sys.version = '2.7.1 (IronPython 2.7.1 (2.7.0.40) on .NET 4.0.30319.1)'"
--



--
You are receiving this email because you subscribed to notifications on 
CodePlex.

To report a bug, request a feature, or add a comment, visit IronPython Issue 
Tracker. You can unsubscribe or change your issue notification settings on 
CodePlex.com.___
Ironpython-users mailing list
[email protected]
http://mail.python.org/mailman/listinfo/ironpython-users


[Ironpython-users] SciPy for .NET

2011-12-02 Thread Shaheer Zubairi




Hi guys, 
 
I have a query 
regarding the use of SciPy for .NET.  I have existing code written in Visual 
Basic (VB) in Visual Studio 2010.  I would like to use the Singular Value 
Decomposition (SVD) of a non-square matrix using the Scipy library. I have 
downloaded and installed IronPython 2.7.1,  Numpy and SciPy libraries following 
the steps shown on the website (http://www.enthought.com/repo/.iron/).  My 
questions are: 
 
1.  Should there by a 
ScipyDotNet DLL available for me to use in Visual Studio? 
2.  Can I use the code 
found in the directory 
IronPython2.7.1>Lib>site-packages>scipy>linalg to do what I 
want?
3.  Can anyone perhaps 
provide me an example of how to use SciPy SVD from within a Visual Basic script 
in Visual Studio 2010? 
Thank you for giving 
me your valuable time. I look forward to hearing from you soon. 
Kind 
regards, 
Mo___
Ironpython-users mailing list
[email protected]
http://mail.python.org/mailman/listinfo/ironpython-users


Re: [Ironpython-users] SciPy for .NET

2011-12-02 Thread Curt Hagenlocher
NumPy and SciPy aren't particularly suitable for use from non-Python
environments, because a considerable amount of glue logic is actually
implemented in Python. If you do an internet search for "svd .net", there
doesn't seem to be a shortage of other implementations. Two I'm personally
familiar with are

Sho (http://research.microsoft.com/en-us/projects/sho/) -- has a
somewhat-restrictive license
Meta.Numerics (http://metanumerics.codeplex.com/releases/view/63906)


On Fri, Dec 2, 2011 at 5:36 AM, Shaheer Zubairi wrote:

>  Hi guys,
>
>
>
> I have a query regarding the use of SciPy for .NET. I have existing code
> written in Visual Basic (VB) in Visual Studio 2010. I would like to use the
> Singular Value Decomposition (SVD) of a non-square matrix using the Scipy
> library. I have downloaded and installed IronPython 2.7.1, Numpy and SciPy
> libraries following the steps shown on the website (
> http://www.enthought.com/repo/.iron/).
> My questions are:
>
>
>
> 1. Should there by a ScipyDotNet DLL available for me to use in Visual
> Studio?
>
> 2. Can I use the code found in the directory
> IronPython2.7.1>Lib>site-packages>scipy>linalg to do what I want?
>
> 3. Can anyone perhaps provide me an example of how to use SciPy SVD from
> within a Visual Basic script in Visual Studio 2010?
>
>
>
> Thank you for giving me your valuable time. I look forward to hearing from
> you soon.
>
>
>
> Kind regards,
>
>
>
> Mo
>
> ___
> Ironpython-users mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/ironpython-users
>
>
___
Ironpython-users mailing list
[email protected]
http://mail.python.org/mailman/listinfo/ironpython-users


Re: [Ironpython-users] Beginner question.

2011-12-02 Thread Jeff Hardy
I wouldn't be surprised if you were one of the first people to try
this particular combination. However, anything that works from C#
should work from IronPython (except possibly unsafe code).

Translating C# to IronPython is fairly straightforward: remove most of
the punctuation :) You may have to learn a bit of C# to read the
examples, but it's not a hard language to  learn and stack overflow is
great for asking what a particular piece of C# syntax does. If you're
trying to convert C# to Python, use the IronPython tag and someone
will spot it fairly quickly.

I don't know if there are many IronPython game programmers (I do my
game programming in C++, because I'm insane), so anything you can find
out will be appreciated.

- Jeff

On Thu, Dec 1, 2011 at 5:38 PM, Apok  wrote:
> Hi, I’m new in this community, I will try to be brief:
>
> -  Python programmer.
>
> -  0 experience DotNet, CSharp
>
> I have a project for an open source game:.
>
>
>
> IronPython
>
> SlimDX
>
> JigLibSDX (physics engine)
>
>
>
> My question is: does it make sense for a game to use this resources?.
>
> Where I can found information about this “mix” ?.
>
> What I need to do it – all examples are on CSharp.
>
> Any information about this can be helpful, Thanks.
>
>
>
> Please don’t tell me to use pygame or other python game engines J.
>
>
>
> Thanks.
>
>
>
> *** I have used ironpython.info as a start point (slimDX example section).
>
>
> ___
> Ironpython-users mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/ironpython-users
>
___
Ironpython-users mailing list
[email protected]
http://mail.python.org/mailman/listinfo/ironpython-users


Re: [Ironpython-users] abstract class conversion?

2011-12-02 Thread Jeff Hardy
Well, as you guessed, 'Type' and 'function' are both abstract (and
'function' is not static). You can't instantiate an abstract class
directly (i.e., a = Type()). You need to either instantiate a
subclass, or the library you're using may provide a factory function
that does that internally and returns a Type reference.

I can't see how the VB code you gave could work, so if there's
something missing that piece is probably important.

I take it this library is internal so that you can't share what it is?

- Jeff

On Thu, Dec 1, 2011 at 5:28 PM, Michael Colonno  wrote:
>     Thanks for the reply, Jeff.
>
>
>
> ILSpy reports for "Type" (the “IL” version):
>
>
>
>     .class interface public auto ansi abstract import [relevant dll
> name]
>
>   {
>
>   .custom instance void
> [mscorlib]System.Runtime.InteropServices.TypeLibTypeAttribute::.ctor(int16)
> = (
>
>     01 00 50 10 00 00
>
>   )
>
>   .custom instance void
> [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) = (
>
>     01 00 ... (lots of numbers)
>
>
>
>     And for "function":
>
>
>
>     .method public hidebysig newslot abstract virtual
>
>   instance object marshal(idispatch) function (
>
>     [in] string marshal(bstr) Name,
>
>     [in] bool Option,
>
>     [in] [out] int32& Errors
>
>   ) runtime managed internalcall
>
>   {
>
>   .custom instance void
> [mscorlib]System.Runtime.InteropServices.DispIdAttribute::.ctor(int32) = (
>
>     01 00 5b 00 00 00 00 00
>
>   )
>
>
>
>     I confess this does not mean a whole lot to me, though both Type
> and function are declared as abstract. Hopefully this sheds light on the
> behavior in IronPython.
>
>
>
>     Thanks,
>
>     ~Mike C.
>
>
>
> -Original Message-
> From: Jeff Hardy [mailto:[email protected]]
> Sent: Thursday, December 01, 2011 10:36 AM
> To: Michael Colonno
> Cc: [email protected]
> Subject: Re: [Ironpython-users] abstract class conversion?
>
>
>
> On Thu, Dec 1, 2011 at 10:14 AM, Michael Colonno 
> wrote:
>
>>     In VB.NET, this works just fine:
>
>>
>
>>
>
>>
>
>> Dim A As Type
>
>> Dim Name As String
>
>> Dim Option As Boolean
>
>> Dim Err As Integer
>
>> Dim value As Object
>
>>
>
>> value = A.function(Name, Option, Err)
>
>>
>
>>     In IronPython I am trying (pseudo-code):
>
>>
>
>> import clr
>
>> clr.AddReferenceToFileAndPath("relevant dll") from
>
>> API.Interop.whatever import Type
>
>>
>
>> A = Type()
>
>> value = A.function("Name", True, err)
>
>>
>
>>     Two issues / questions:
>
>>
>
>> 1. The IronPython code above produces: TypeError: Cannot create
>
>> instances of Type because it is abstract. Why is an abstract Python
>
>> class being created and do I have any control over this?
>
>
>
> Calling `A = Type()` tries to create an instance of Type, which your VB code
> doesn't do. Is `Type.function` a static method?
>
>
>
>>
>
>> 2. Changing the code to access the functions of Type directly (e.g.
>
>> Type.function()) results in a “self” argument being expressed as the
>
>> first argument in the function. i.e. the syntax expected is now
>
>> Type.function(self, string, boolean, int). I’m familiar with “self”
>
>> only in the context of defining class functions and not outside of a
>
>> class definition.
>
>
>
> It really depends on how what the signature of the function is. If it's
> static, calling `Type.function` from Python shouldn't need a self argument.
> Can you find the signature of `Type.function` (ILSpy is your friend here).
> Feel free to elide the names; they're not really important.
>
>
>
> - Jeff
>
>
> ___
> Ironpython-users mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/ironpython-users
>
___
Ironpython-users mailing list
[email protected]
http://mail.python.org/mailman/listinfo/ironpython-users


Re: [Ironpython-users] Beginner question.

2011-12-02 Thread Doug Blank
On Fri, Dec 2, 2011 at 3:04 PM, Jeff Hardy  wrote:
> I wouldn't be surprised if you were one of the first people to try
> this particular combination. However, anything that works from C#
> should work from IronPython (except possibly unsafe code).
>
> Translating C# to IronPython is fairly straightforward: remove most of
> the punctuation :) You may have to learn a bit of C# to read the
> examples, but it's not a hard language to  learn and stack overflow is
> great for asking what a particular piece of C# syntax does. If you're
> trying to convert C# to Python, use the IronPython tag and someone
> will spot it fairly quickly.
>
> I don't know if there are many IronPython game programmers (I do my
> game programming in C++, because I'm insane), so anything you can find
> out will be appreciated.

We have incorporated the Farseer Physics Engine in Calico, which makes
it available to Python, Ruby, and Scheme on Mac, Windows, and Linux.

Here are a few game-like things in IronPython:

http://www.youtube.com/user/dsblank007?feature=guide#p/a/u/0/L3P5t8hAhe4
- Letter Physics
http://www.youtube.com/user/dsblank007?feature=guide#p/a/u/2/yLZJmyQEALA
- Angy Blocks
http://www.youtube.com/user/dsblank007?feature=guide#p/u/8/GryaCuiaE3o - Art

More info here:

http://calicoproject.org/
http://calicoproject.org/Calico_Graphics

-Doug

> - Jeff
>
> On Thu, Dec 1, 2011 at 5:38 PM, Apok  wrote:
>> Hi, I’m new in this community, I will try to be brief:
>>
>> -  Python programmer.
>>
>> -  0 experience DotNet, CSharp
>>
>> I have a project for an open source game:.
>>
>>
>>
>> IronPython
>>
>> SlimDX
>>
>> JigLibSDX (physics engine)
>>
>>
>>
>> My question is: does it make sense for a game to use this resources?.
>>
>> Where I can found information about this “mix” ?.
>>
>> What I need to do it – all examples are on CSharp.
>>
>> Any information about this can be helpful, Thanks.
>>
>>
>>
>> Please don’t tell me to use pygame or other python game engines J.
>>
>>
>>
>> Thanks.
>>
>>
>>
>> *** I have used ironpython.info as a start point (slimDX example section).
>>
>>
>> ___
>> Ironpython-users mailing list
>> [email protected]
>> http://mail.python.org/mailman/listinfo/ironpython-users
>>
> ___
> Ironpython-users mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/ironpython-users
>
___
Ironpython-users mailing list
[email protected]
http://mail.python.org/mailman/listinfo/ironpython-users


Re: [Ironpython-users] abstract class conversion?

2011-12-02 Thread Michael Colonno
Hi Jeff ~

 

Thanks for your help - it sounds like I have to do a lot more
digging in the library itself to see what's going on. The VB.NET code
(though paraphrased) does work; perhaps there is something internal to the
library taking care of the translation to the subclass. No secret on the
library; I'm working with the SolidWorks API. I felt it would be easier to
understand and more useful to others in the future if I just made the names
generic. In terms of a "missing middle" it's difficult to tell since the API
is usually used via add-ins wizards for Visual Studio that likely take care
of some things under the hood. The instructions for the simplest form of
VB.NET add-in (a stand-alone executable that talks to the application) from
the official documentation are as follows: 

 

Standalone Applications (.exe files)

To create an instance of the SolidWorks software, your project should
contain lines of code similar to the following: 

 

Sub Main

Dim swApp As SldWorks.SldWorks  

swApp = New SldWorks.SldWorks()

  code...

swApp.ExitApp

swApp = Nothing

End Sub

 

Additionally, you must have added references to the SolidWorks type
libraries.

 

The type libraries mentioned are added as COM references through
Visual Studio and then imported, e.g.: 

 

Imports System

Imports SldWorks

Imports SWPublished

Imports SwConst

Imports System.Runtime.InteropServices 

 

  Finally the documentation for the function I was using as an example
is: 

 

Dim instance As ISldWorks

Dim Name As String 

Dim Silent As Boolean 

Dim Errors As Integer 

Dim value As Object 

 

value = instance.ActivateDoc2(Name, Silent, Errors)

 

After this it's quite easy to build up VB.NET programs that talk
to the application. I will try and rebuild a concrete example line by line
to see if I can't identify the abstract from the non-abstract classes. 

 

Thanks,

~Mike C. 

 

-Original Message-
From: Jeff Hardy [mailto:[email protected]] 
Sent: Friday, December 02, 2011 12:08 PM
To: Michael Colonno
Cc: [email protected]
Subject: Re: [Ironpython-users] abstract class conversion?

 

Well, as you guessed, 'Type' and 'function' are both abstract (and
'function' is not static). You can't instantiate an abstract class directly
(i.e., a = Type()). You need to either instantiate a subclass, or the
library you're using may provide a factory function that does that
internally and returns a Type reference.

 

I can't see how the VB code you gave could work, so if there's something
missing that piece is probably important.

 

I take it this library is internal so that you can't share what it is?

 

- Jeff

 

On Thu, Dec 1, 2011 at 5:28 PM, Michael Colonno <
 [email protected]> wrote:

> Thanks for the reply, Jeff.

> 

> 

> 

> ILSpy reports for "Type" (the "IL" version):

> 

> 

> 

> .class interface public auto ansi abstract import 

> [relevant dll name]

> 

>   {

> 

>   .custom instance void

> [mscorlib]System.Runtime.InteropServices.TypeLibTypeAttribute::.ctor(i

> nt16)

> = (

> 

> 01 00 50 10 00 00

> 

>   )

> 

>   .custom instance void

> [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) 

> = (

> 

> 01 00 ... (lots of numbers)

> 

> 

> 

> And for "function":

> 

> 

> 

> .method public hidebysig newslot abstract virtual

> 

>   instance object marshal(idispatch) function (

> 

> [in] string marshal(bstr) Name,

> 

> [in] bool Option,

> 

> [in] [out] int32& Errors

> 

>   ) runtime managed internalcall

> 

>   {

> 

>   .custom instance void

> [mscorlib]System.Runtime.InteropServices.DispIdAttribute::.ctor(int32) 

> = (

> 

> 01 00 5b 00 00 00 00 00

> 

>   )

> 

> 

> 

> I confess this does not mean a whole lot to me, though 

> both Type and function are declared as abstract. Hopefully this sheds 

> light on the behavior in IronPython.

> 

> 

> 

> Thanks,

> 

> ~Mike C.

> 

> 

> 

> -Original Message-

> From: Jeff Hardy  
[mailto:[email protected]]

> Sent: Thursday, December 01, 2011 10:36 AM

> To: Michael Colonno

> Cc:   [email protected]

> Subject: Re: [Ironpython-users] abstract class conversion?

> 

> 

> 

> On Thu, Dec 1, 2011 at 10:14 AM, Michael Colonno 

> <  [email protected]>

> wrote:

> 

>> In VB.NET, this works just fine:

> 

>> 

> 

>> 

> 

>> 

> 

>> Dim A As Type

> 

>> Dim Name As String

> 

>> Dim Option As Boolean

> 

>> Dim Err As Integer

> 

>> Dim value As Object

> 

>> 

> 

>> value = A.function(Name, Option, Err)

> 

>> 

> 

>> In I