[IronPython] word Automation

2005-05-08 Thread kbond
Hello,
First congratulation of all, thank you for the tremendous work that you 
have already done.
I am looking forward the day where I will be able to translate all my MS 
office  automation in python  scripts.

Am I correct I say that iron python will allow it?
So today I try to give it a try but unfortunatly withou success till now.
I am trying to translate this simple vb.net module to iron python, is 
there someone reading this list that can help me?

the VB
Imports word = Microsoft.Office.Interop.word
Module Module1
   Sub Main()
   Dim oWord As Word.ApplicationClass
   'Start Word and open the document.
   oWord = CreateObject("Word.Application")
   oWord.Visible = True
   oWord.Documents.Open("C:\tmp\Doc1.doc")
   'Run the macros.
   'oWord.Run("DoKbTest")
   'oWord.Run("DoKbTestWithParameter", "Hello from VB .NET Client")
   'Quit Word.
   oWord.Quit()
   System.Runtime.InteropServices.Marshal.ReleaseComObject(oWord)
   oWord = Nothing
   End Sub
End Module
Iron Python
import sys
sys.LoadAssemblyByName("Microsoft.Office.Interop.Word")
import Microsoft.Office.Interop.Word as wordApp
oWord = wordApp.ApplicationClass
oWord = CreateObject("wordApp.Application")
oWord.Visible = True
oWord.Documents.Open("C:\tmp\Doc1.doc")
oWord.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComObject(oWord)
oWord = Nothing
thank you
___
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


RE: [IronPython] Pythalon

2005-05-08 Thread John Gossman
Try this:  http://www.johngossman.net/PythalonSample.html 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Keith J. Farmer
Sent: Sunday, May 08, 2005 12:19 PM
To: Discussion of IronPython
Subject: RE: [IronPython] Pythalon

Ask Gossman -- I just forward the URL.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Travis Watkins

Screenshot?

___
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
___
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] lambda form

2005-05-08 Thread Timothy Fitz
On 5/8/05, Luis M. Gonzalez <[EMAIL PROTECTED]> wrote:
> Regarding lambda, map and reduce, Guido Van Rossum has said several times
> that these built-ins are amongst its "Python regrets".
>  
> This is what he said in a recent interview:
>  
> - If you could change some things that have been done in the
>   langage, what would it be ?
> 
> Drop lambda, filter, map and reduce. Make range() behave like xrange(). Make
> keys() and many other methods and built-ins return iterators rather than
> lists.

With respect to IronPython, lambda, filter, map and reduce need to be
implemented, for the same reasons lambda won't go away until python
3.0 if it ever does.

While he Guido dislike lambda, the reasons are particularly about its
implementation and current useage, and if a suitable anonymous
function syntax is found he may accept it.
___
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


RE: [IronPython] Pythalon

2005-05-08 Thread Keith J. Farmer
Ask Gossman -- I just forward the URL.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Travis Watkins

Screenshot?

___
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Pythalon

2005-05-08 Thread Travis Watkins
On 5/8/05, Keith J. Farmer <[EMAIL PROTECTED]> wrote:
>  
>  
> 
> IronPython + Avalon experiment … 
> 
> http://blogs.msdn.com/johngossman/archive/2005/05/08/415505.aspx
> 
>   
> ___
> users-ironpython.com mailing list
> users-ironpython.com@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> 
> 
> 

Screenshot?

-- 
Travis Watkins
http://www.realistanew.com
___
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Pythalon

2005-05-08 Thread Keith J. Farmer








IronPython + Avalon experiment …

http://blogs.msdn.com/johngossman/archive/2005/05/08/415505.aspx

 






___
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] lambda form

2005-05-08 Thread Luis M. Gonzalez



Regarding lambda, map and reduce, Guido Van Rossum 
has said several times that these built-ins are amongst its "Python 
regrets".
 
This is what he said in a recent 
interview:
 
- If you could change some things that have 
been done in the  langage, what would it be ?Drop 
lambda, filter, map and reduce. Make range() behave like xrange(). Make keys() 
and many other methods and built-ins return iterators rather than 
lists.
The interview is here:
http://blogs.nuxeo.com/sections/blogs/tarek_ziade/2005_04_11_guido_van_rossum
___
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] System.Exception: can't convert 66.6 to System.Int32

2005-05-08 Thread Travis Watkins
On 5/8/05, PhiHo Hoang <[EMAIL PROTECTED]> wrote:
> Jim Hugunin wrote:
> 
> > PhiHo Hoang wrote:
> > > Why 66.6 cannot be converted to System.Int32 ?
> > 66.6 can be both explicitly converted to an int and compared to one.
> 
> >>>> int(66.6)
> >66
> >>>> 12 < 66.6
> >True
> >>>> 66.6 < 12
> >False
> 
> > It's a good thing that 66.6 won't be implicitly converted to an int
> > since that would lose precision.
> 
> > > >>> a
> > > [333, 1234.5, 1, 333, -1, 66.6]
> > > >>> a.sort()
> > > System.InvalidOperationException: Failed to compare two elements in
> > > the array. -
> 
> > However, you're right that IronPython doesn't handle this correctly for
> > sorting an array.  We already have one bug for sorting mixed-type arrays
> > (bug #63) but it's nice to add this case as well to the set we need to
> > fix.
> 
> Talking of precision, for sorting, wouldn't it be more precise to
> convert int to float instead of float to int, when there is a mixture ?
> 
> Thanks,
> 
> PhiHo
> 
> ___
> users-ironpython.com mailing list
> users-ironpython.com@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> 

Yeah, you could probably convert all the ints to floats during the
comparison then convert them back afterward.

-- 
Travis Watkins
http://www.realistanew.com
___
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] System.Exception: can't convert 66.6 to System.Int32

2005-05-08 Thread PhiHo Hoang
Jim Hugunin wrote:
PhiHo Hoang wrote:
> Why 66.6 cannot be converted to System.Int32 ?
66.6 can be both explicitly converted to an int and compared to one.

   >>> int(66.6)
   66
   >>> 12 < 66.6
   True
   >>> 66.6 < 12
   False

It's a good thing that 66.6 won't be implicitly converted to an int
since that would lose precision.

> >>> a
> [333, 1234.5, 1, 333, -1, 66.6]
> >>> a.sort()
> System.InvalidOperationException: Failed to compare two elements in
> the array. -

However, you're right that IronPython doesn't handle this correctly for
sorting an array.  We already have one bug for sorting mixed-type arrays
(bug #63) but it's nice to add this case as well to the set we need to 
fix.
   Talking of precision, for sorting, wouldn't it be more precise to 
   convert int to float instead of float to int, when there is a mixture ?

   Thanks,
   PhiHo
___
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] lambda form

2005-05-08 Thread PhiHo Hoang
Jim Hugunin wrote:
March Liu wrote:
> lambda key word may remove from CPython 3.0. Maybe we can replace it
> by the other way as List Comprehensions, funcation Factory...

I like to encourage people who come from a functional background to use
list comprehensions instead of lambda when possible.  I'm not sure that
lambda should go away, but I do wonder if map, filter and reduce
shouldn't be removed from builtins 
   I would gladly trade this trio for  defsyn ( and the crew ;-)
to more strongly encourage the use of
list comprehensions or generator expressions instead.
   Agreed.
[SNIP]
   Thanks for looking into this lambda thingy.
   PhiHo
___
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com