Re: [IronPython] multiprocessing in 2.7

2011-03-23 Thread Davy Mitchell
If it is a 'C' based extension then it won't directly work with IronPython.

Maybe someone has a workaround / alternative?

Cheers,
Davy

On 23 March 2011 10:23, Romain Gilles romain.gil...@gmail.com wrote:
 Hi,
 First of all thanks for your answer :). But after updated
 my IRONPYTHONPATH as follow:
 set IRONPYTHONPATH=c:\Python27\Lib
 I get this error:
 -
 c:\tempipy test-ipy-multiprocessing.py
 Traceback (most recent call last):
   File test-ipy-multiprocessing.py, line 1, in module
   File c:\Python27\Lib\multiprocessing\__init__.py, line 63, in module
   File c:\Python27\Lib\multiprocessing\process.py, line 286, in module
   File c:\Python27\Lib\multiprocessing\process.py, line 283, in __init__
 TypeError: expected IList[Byte], got str
 -
 2011/3/23 Oleksii Bidiuk oleksii.bid...@gmail.com

 Hi Romain,
 AFAIK you have to download the Python standard library separately. See
 e.g. http://www.ironpython.info/index.php/Using_the_Python_Standard_Library for
 examples (I've done it a while ago, so had to Google around a bit).

 2011/3/23 Romain Gilles romain.gil...@gmail.com

 Hi all,
 I'm trying to use this feature in ironpython. I just follow the first
 sample:
 
 from multiprocessing import Process
 def f(name):
     print 'hello', name
 if __name__ == '__main__':
     p = Process(target=f, args=('bob',))
     p.start()
     p.join()
 
 But I get the following error when I'm executing it:
 
 c:\tempipy test-ipy-multiprocessing.py
 Traceback (most recent call last):
   File test-ipy-multiprocessing.py, line 1, in module
 ImportError: No module named multiprocessing
 
 Thanks for any help.
 Regards.
 Romain.
 PS: I have just installed the last release of IronPython 2.7
 
 c:\tempipy -V
 PythonContext 2.7.0.40 on .NET 4.0.30319.1
 
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com




 --
 oleksii


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





-- 
--
  Davy's Blog - http://daftspaniel.wordpress.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] How to connect to SQL Server 2008?

2010-05-27 Thread Davy Mitchell
From http://www.ironpython.info/index.php/Accessing_SQL_Server

import clr
clr.AddReference('System.Data')
from System.Data import *

TheConnection =
SqlClient.SqlConnection(server=yourserver;database=News;uid=sa;password=password)
TheConnection.Open()

MyAction = SqlClient.SqlCommand(Select Headline from News, TheConnection)
MyReader = MyAction.ExecuteReader()

while MyReader.Read():
print MyReader[0]

MyReader.Close()
TheConnection.Close()

http://www.ironpython.info/index.php/Accessing_SQL_ServerDavy

On Thu, May 27, 2010 at 3:54 PM, Matthew Wilson m...@tplus1.com wrote:

 I want to connect with IronPython to SQLServer 2008.  I found some SAS
 code (SAS is another programming language) that uses OLEDB and I have a
 connection string with the server name and credentials.

 In IronPython in Action, there's an example of how to connect to a
 Postgresql database, and that example has this section:

 import clr
 clr.AddReference('Npgsql')
 import Npgsql as pgsql
 connection = pgsql.NpgsqlConnection('')

 What do I need to use for my clr.AddReference and my import?

 Thanks in advance.

 Matt



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




-- 
--
 Davy Stuff  - http://daftspaniel.blogspot.com
 Geeky Stuff  - http://daftpython.blogspot.com
 Davy's Ironpython Editor - http://code.google.com/p/davysironpythoneditor/
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Calling a query from .MDB (Access stored procedure) by name:

2010-05-25 Thread Davy Mitchell
Just a guess but could try 'select * from  queryname'?

Davy

On Mon, May 24, 2010 at 8:55 PM, Peter Masiar peter.mas...@gmail.comwrote:

 So I can connect to my little database now, thanks.

 I have a query in Access - I believe it's an Access term for a
 stored procedure.
 I'd like to call that stored procedure by name from my IronPython
 code. SQL text is huge (it inserts data from a Sharepoint list,
 linked as access table, to real Access table for processing), ugly and
 hairy...

 I found command.ExecuteNonQuery(), but it checks for a valid SQL
 statement, and is unhappy with me providing just a query name. It
 says: Expected DELETE, INSERT, PROCEDURE, SELECT or UPDATE.

 I found also docs
 http://msdn.microsoft.com/en-us/library/yy6y35y8%28VS.71%29.aspx and
 OleDbCommand.CommandType but I am not sure how to set CommandType to
 Stored procedure. Any suggestions?

 Is there a way to execute Access query by name? Last resort would be
 copy-pasting the whole SQL enchilada from my query to IronPython as
 text SQL command.

 Thanks again

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




-- 
--
 Davy Stuff  - http://daftspaniel.blogspot.com
 Geeky Stuff  - http://daftpython.blogspot.com
 Davy's Ironpython Editor - http://code.google.com/p/davysironpythoneditor/
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Davy's IronPython Editor

2010-04-27 Thread Davy Mitchell
Hi Folks,

I haven't worked on DIE for a good while now due to the usual pressures and
changes in interest. Also the IronPython editor/IDE situation has moved on
quite a bit since in started.

So anyone wanting to pick this project up? I don't want it to get too stale
and put people off IronPython like Ironpython Studio does ;-) There is a
basis for a good editor in there (maybe move to Scintilla.net?), some fixes
sitting in SVN ready to go and it has had a fair few downloads.

Davy's Ironpython Editor - http://code.google.com/p/davysironpythoneditor/

Oh yes, you can change the name :-)

Thanks,
Davy
--
 Davy Stuff  - http://daftspaniel.blogspot.com
 Geeky Stuff  - http://daftpython.blogspot.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] VS IronPython

2010-04-22 Thread Davy Mitchell
Hey Folks,

Has anyone got the new link for this answer?
stackoverflow.com/questions/1904681/there-is-any-python-syntax-highlighter-for-visual-studio-2010-beta-2/1906833#1906833

http://stackoverflow.com/questions/1904681/there-is-any-python-syntax-highlighter-for-visual-studio-2010-beta-2/1906833#1906833
Thanks,
Davy

--
 Davy Stuff  - http://daftspaniel.blogspot.com
 Geeky Stuff  - http://daftpython.blogspot.com
 Davy's Ironpython Editor - http://code.google.com/p/davysironpythoneditor/
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] VS IronPython

2010-04-22 Thread Davy Mitchell
Thanks for the update Jeff. I've updated the original answer.
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] CallTargetX delegates

2009-09-02 Thread Davy Mitchell
Could someone pop an example of this on http://www.ironpython.info?
Sounds like it could be a common 'gotcha' especially for newbies
running old example code.

Cheers,
Davy

On Wed, Sep 2, 2009 at 6:38 AM, David Escobardavidesco...@ieee.org wrote:
 Ok cool. I've used Func from C# before. That did the trick. Thanks.


 On Tue, Sep 1, 2009 at 6:19 PM, Dino Viehland di...@microsoft.com wrote:

 Yes.  CallTarget’s were really a part of IronPython’s internal calling
 convention for used defined functions.  We kept CallTarget0 around because
 we knew lots of users had come to depend on that one when they needed a
 delegate type.  But we removed all the others and switched to using Func…
 internally.  Ideally you can switch to using Func as well.



 From: users-boun...@lists.ironpython.com
 [mailto:users-boun...@lists.ironpython.com] On Behalf Of David Escobar
 Sent: Tuesday, September 01, 2009 5:41 PM
 To: Discussion of IronPython
 Subject: [IronPython] CallTargetX delegates



 In IronPython 2.6 beta 2, did the CallTargetX delegates get moved to
 another module or were they simply removed altogether? The only delegate in
 IronPython.Compiler is CallTarget0. I checked IronPython 2.0.2 and it has up
 to CallTarget16.

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





-- 
--
  Davy Stuff  - http://daftspaniel.blogspot.com
  Geeky Stuff  - http://daftpython.blogspot.com
  Davy's Ironpython Editor - http://code.google.com/p/davysironpythoneditor/
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] IP B2 Issue

2009-07-23 Thread Davy Mitchell
Hi Guys,

Don't have much time to look into this right now but thought I would
share it right away as it seems low level :-)
Changes to CallTarget0?

I was just running DIE on PY and it was capturing output from a script
in the usual manner when...


Unhandled Exception: Unhandled Exception: Microsoft.Scripting.ArgumentTypeExcept
ion: unsupported operand type(s) for +: 'NoneType' and 'str'
   at CallSite.Target(Closure , CallSite , Object , String )
   at Microsoft.Scripting.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite
 site, T0 arg0, T1 arg1)
   at IronPython.Runtime.Binding.PythonBinaryOperationBinder.StringAdd(CallSite
site, Object self, String other)
   at ProcessOutputHandler$300(Closure , PythonFunction , Object , Object , Obje
ct )
   at IronPython.Runtime.PythonFunction.FunctionCaller`3.Call3(CallSite site, Co
deContext context, Object func, T0 arg0, T1 arg1, T2 arg2)
   at CallSite.Target(Closure , CallSite , Object , Object , DataReceivedEventAr
gs )
   at _Scripting_(Object[] , Object , DataReceivedEventArgs )
   at System.Diagnostics.Process.OutputReadNotifyUser(String data)
   at System.Diagnostics.AsyncStreamReader.FlushMessageQueue()
   at System.Diagnostics.AsyncStreamReader.ReadBuffer(IAsyncResult ar)
   at System.Runtime.Remoting.Messaging.AsyncResult.SyncProcessMessage(IMessage
msg)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMe
ssage msg, IMessageSink replySink)
   at System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.DoAsyncCall()
   at System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.ThreadPoolCallBack(Ob
ject o)
   at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state
)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, C
ontextCallback callback, Object state)
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_Thre
adPoolWaitCallback tpWaitCallBack)
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)

--
  Davy Stuff  - http://daftspaniel.blogspot.com
  Geeky Stuff  - http://daftpython.blogspot.com
  Davy's Ironpython Editor - http://code.google.com/p/davysironpythoneditor/
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] IP B2 Issue

2009-07-23 Thread Davy Mitchell
Thanks Dino - will look into it.

On Thu, Jul 23, 2009 at 7:33 PM, Dino Viehlanddi...@microsoft.com wrote:
 This looks like it's due to a bug fix and is correct behavior - we used to
 allow None + abc but we've fixed the issue and it now throws an exception
 as expected.

 Note CallTarget0 is no longer used by IronPython at all.  We keep it around
 though for backwards compatibility because people seem to like it :)

 But I would generally recommend using Funcobject instead.

 -Original Message-
 From: users-boun...@lists.ironpython.com [mailto:users-
 boun...@lists.ironpython.com] On Behalf Of Davy Mitchell
 Sent: Thursday, July 23, 2009 11:29 AM
 To: Discussion of IronPython
 Subject: [IronPython] IP B2 Issue

 Hi Guys,

 Don't have much time to look into this right now but thought I would
 share it right away as it seems low level :-)
 Changes to CallTarget0?

 I was just running DIE on PY and it was capturing output from a script
 in the usual manner when...


 Unhandled Exception: Unhandled Exception:
 Microsoft.Scripting.ArgumentTypeExcept
 ion: unsupported operand type(s) for +: 'NoneType' and 'str'
    at CallSite.Target(Closure , CallSite , Object , String )
    at
 Microsoft.Scripting.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallS
 ite
  site, T0 arg0, T1 arg1)
    at
 IronPython.Runtime.Binding.PythonBinaryOperationBinder.StringAdd(CallSi
 te
 site, Object self, String other)
    at ProcessOutputHandler$300(Closure , PythonFunction , Object ,
 Object , Obje
 ct )
    at IronPython.Runtime.PythonFunction.FunctionCaller`3.Call3(CallSite
 site, Co
 deContext context, Object func, T0 arg0, T1 arg1, T2 arg2)
    at CallSite.Target(Closure , CallSite , Object , Object ,
 DataReceivedEventAr
 gs )
    at _Scripting_(Object[] , Object , DataReceivedEventArgs )
    at System.Diagnostics.Process.OutputReadNotifyUser(String data)
    at System.Diagnostics.AsyncStreamReader.FlushMessageQueue()
    at System.Diagnostics.AsyncStreamReader.ReadBuffer(IAsyncResult ar)
    at
 System.Runtime.Remoting.Messaging.AsyncResult.SyncProcessMessage(IMessa
 ge
 msg)
    at
 System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(
 IMe
 ssage msg, IMessageSink replySink)
    at
 System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.DoAsyncCall()
    at
 System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.ThreadPoolCallBack
 (Ob
 ject o)
    at
 System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object
 state
 )
    at System.Threading.ExecutionContext.Run(ExecutionContext
 executionContext, C
 ontextCallback callback, Object state)
    at
 System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_T
 hre
 adPoolWaitCallback tpWaitCallBack)
    at
 System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object
 state)

 --
   Davy Stuff  - http://daftspaniel.blogspot.com
   Geeky Stuff  - http://daftpython.blogspot.com
   Davy's Ironpython Editor -
 http://code.google.com/p/davysironpythoneditor/
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com




-- 
--
  Davy Stuff  - http://daftspaniel.blogspot.com
  Geeky Stuff  - http://daftpython.blogspot.com
  Davy's Ironpython Editor - http://code.google.com/p/davysironpythoneditor/
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] PYC Bug in 2.6

2009-05-30 Thread Davy Mitchell
Thanks for the new PYC - much appreciated.

There's a bug in there that affects anyone building a winexe.

I've raised a while ago it on a comment on another bug (not a good idea):
http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=19409

Just comment out the line shown below.
if arg.startswith(/main:):
main_name = main = arg[6:]
#target = System.Reflection.Emit.PEFileKinds.ConsoleApplication

Cheers,
Davy

--
  Davy Stuff  - http://daftspaniel.blogspot.com
  Geeky Stuff  - http://daftpython.blogspot.com
  Davy's Ironpython Editor - http://code.google.com/p/davysironpythoneditor/
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] ANN - DIE 00.01.71 Released

2009-05-28 Thread Davy Mitchell
DIE 00.01.71 Released

Davy's Ironpython Editor (DIE) is a clutter free IronPython editor
written in IronPython with some basic IDE features.
http://code.google.com/p/davysironpythoneditor/

Here's the detail in what has changed in 00.01.71:

+ Mobile Version which stores options in same dir.
+ Installed version stores in User Profile. (Existing Settings files
don't transfer over - sorry).
+ 'Find in Files' feature added.
+ Much much Improved Capture of output from running Python scripts.
+ Click on error output now opens file and goes to line.
+ Resources - MSDN links area now low bandwith versions, Python links
and Powershell launch menu.
+ Added CheckBox and Listbox control to gen_GUI.
+ Syntax Box -Exposed new property to get Caret Screen position.
+ Autocomplete option added - default to OFF. Experimental parsing for
strings, lists and dictionaries.
+ Bug fixes and performance updates.

Thanks
Davy M

--
  Davy Stuff  - http://daftspaniel.blogspot.com
  Geeky Stuff  - http://daftpython.blogspot.com
  Davy's Ironpython Editor - http://code.google.com/p/davysironpythoneditor/
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] ironpython compared to powershell

2009-05-26 Thread Davy Mitchell
Ironpython is a general purpose programming language whereas
Powershell is primarily to replace the 'command prompt', batch file
and vbscript within Windows system administration, though it appears
in SQL Server 2008.

Both have good .Net integration so you you could administer a network
with either. Ironically IronPython is far more easy to deploy (xcopy)
than Powershell which is a key factor in big tightly controlled
networks.

Cheers,
Davy Mitchell

--
  Davy Stuff  - http://daftspaniel.blogspot.com
  Geeky Stuff  - http://daftpython.blogspot.com
  Davy's Ironpython Editor - http://code.google.com/p/davysironpythoneditor/
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Inspect Module

2009-05-19 Thread Davy Mitchell
On Wed, May 13, 2009 at 10:23 PM, Dino Viehland di...@microsoft.com wrote:
 This will should be fixed in tomorrow's source drop.  I have a check-in which 
 removes sys._getframe unless the
 -X:Frames or -X:FullFrames options are passed.

Thanks Dino - sounds good. One question, (how) can the -X options be
used in a pyc compiled EXE?

I don't think we have a module status page yet.

Would be nice to have module changes in the read me :-)

Take care,
Davy Mitchell

--
  Davy Stuff  - http://daftspaniel.blogspot.com
  Geeky Stuff  - http://daftpython.blogspot.com
  Davy's Ironpython Editor - http://code.google.com/p/davysironpythoneditor/
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Inspect Module

2009-05-19 Thread Davy Mitchell
Thanks Dino + Michael.

On Tue, May 19, 2009 at 4:26 PM, Michael Foord
fuzzy...@voidspace.org.uk wrote:
 What you might find helpful is to use a similar technique for compilation
 that we do for Resolver One.

Sounds like a good approach especially for getting a splash screen up
early :-).

For DIE, it doesn't use the py stdlib so some stuff sys.path is less
important right now. I do like pyc and may eventually form part of a
'build' feature in DIE. Definitely consider the hosting technique it
as the project grows though.

Cheers,
Davy

 --
  Davy Stuff  - http://daftspaniel.blogspot.com
  Geeky Stuff  - http://daftpython.blogspot.com
  Davy's Ironpython Editor - http://code.google.com/p/davysironpythoneditor/
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Autocomplete for .NET Types from IronPython with Wing IDE (update - better return type and parameter name handling)

2009-05-19 Thread Davy Mitchell
Sorry for slow reply on this :-)

Yes looks like I would be mad to reimplement something like Pysmell +
PI for Wing. The next version of DIE *may* have very simple
autocomplete enabled for strings, dictionaries and lists. It is more
of a GUI exercise. Personally, I find an object browser more useful
than autocomplete so I more likely to add write that first but, as the
recent discussion on this list showed, it is a non-starter for many if
an editor does not have autocomplete.

Cheers,
Davy

--
  Davy Stuff  - http://daftspaniel.blogspot.com
  Geeky Stuff  - http://daftpython.blogspot.com
  Davy's Ironpython Editor - http://code.google.com/p/davysironpythoneditor/
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Autocomplete for .NET Types from IronPython with Wing IDE (update - better return type and parameter name handling)

2009-05-17 Thread Davy Mitchell
Thanks Michael - looks really good and useful as I have started to
look into this for autocomplete in DIE.

30mb eh? That will be interesting :-)

Cheers,
Davy

--
  Davy Stuff  - http://daftspaniel.blogspot.com
  Geeky Stuff  - http://daftpython.blogspot.com
  Davy's Ironpython Editor - http://code.google.com/p/davysironpythoneditor/
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Inspect Module

2009-05-13 Thread Davy Mitchell
Thanks for the info and update Dave.

 Is there a page on codeplex for the 2.6 modules status?

The 2.01 version of inspect seems to work ok so far in 2.6 so will do
for now :-)

Thanks,
Davy Mitchell

--
  Davy Stuff  - http://daftspaniel.blogspot.com
  Geeky Stuff  - http://daftpython.blogspot.com
  Davy's Ironpython Editor - http://code.google.com/p/davysironpythoneditor/

On Wed, May 13, 2009 at 5:11 PM, Dave Fugate dfug...@microsoft.com wrote:
 It's because we strip out CPython modules that aren't importable by ipy. That 
 is, the sys._getframe issue I talked about at 
 http://knowbody.livejournal.com/13271.html is the underlying culprit here:
    C:\Program Files\IronPython 2.6ipy.exe
    IronPython 2.6 Alpha 1 (2.6.0.1) on .NET 2.0.50727.3053
    Type help, copyright, credits or license for more information.
     import inspect
    Traceback (most recent call last):
      File stdin, line 1, in module
      File C:\Program Files\IronPython 2.6\Lib\inspect.py, line 262, in 
 inspect
      File C:\Program Files\IronPython 2.6\Lib\collections.py, line 106, in 
 namedtuple
    ValueError: _getframe is not implemented for non-zero depth
    

 We should have this fixed in one form or another before the final version of 
 2.6 ships.

 Dave

 -Original Message-
 From: users-boun...@lists.ironpython.com 
 [mailto:users-boun...@lists.ironpython.com] On Behalf Of Davy Mitchell
 Sent: Tuesday, May 12, 2009 10:12 PM
 To: Discussion of IronPython
 Subject: [IronPython] Inspect Module

 Hi Folks,

 Is there a reason why Inspect is missing from the 2.6 msi? It is
 present in 2.01.

 Thanks,
 Davy Mitchell

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

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

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


[IronPython] Inspect Module

2009-05-12 Thread Davy Mitchell
Hi Folks,

Is there a reason why Inspect is missing from the 2.6 msi? It is
present in 2.01.

Thanks,
Davy Mitchell

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


Re: [IronPython] MissingMemberException on 2.6

2009-05-11 Thread Davy Mitchell
Hi Curt,

Sorry reported the wrong version there. I run the 2.6 interpreter but
have hard coded the build scripts to 2.01 ipy and the target folder
has the 2.01 binaries.
So it is all 2.01. Just tried the (same) compiled version on XP with
the same result. I built a console app without issue which ran so
looks like my code is doing something different :-)

Seems like I need to spend time narrowing down what is new since my
last build. I have introduced threading, use of dir (for autocomplete)
and changed external process handling so there is potential for
something to be up there.

Thanks.
Davy Mitchell

On Sun, May 10, 2009 at 9:19 PM, Curt Hagenlocher c...@hagenlocher.org wrote:
 I don't think that this:
   DataMicrosoft.Scripting/Data
   Data0.9.0.0/Data
 is the right AssemblyVersion for the 2.6 alpha. I would expect something
 like 0.9.5.1. Is it possible that you're compiling with a different
 version of IronPython than you think?


 On Sun, May 10, 2009 at 12:27 PM, Davy Mitchell daftspan...@gmail.com
 wrote:

 Hi Guys,

 I am on 2.6 Beta on Windows 7 7100 and getting MissingMemberException
 when I compile to an EXE.

 http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20623

 I've tried adding the references suggest on the mailing list:
 clr.AddReference('System')
 clr.AddReference('mscorlib')
 But they were already there which suggests I have hit this before.
 This all compiled and ran fine before I reinstalled the OS.

 Anything else I can look at?

 - Event xmlns=http://schemas.microsoft.com/win/2004/08/events/event;
 - System
  Provider Name=Windows Error Reporting /
  EventID Qualifiers=01001/EventID
  Level4/Level
  Task0/Task
  Keywords0x80/Keywords
  TimeCreated SystemTime=2009-05-10T19:16:21.0Z /
  EventRecordID2149/EventRecordID
  ChannelApplication/Channel
  Computerkennel/Computer
  Security /
  /System
 - EventData
  Data566025849/Data
  Data5/Data
  DataCLR20r3/Data
  DataNot available/Data
  Data0/Data
  Datadie.exe/Data
  Data0.0.0.0/Data
  Data4a0727eb/Data
  DataMicrosoft.Scripting/Data
  Data0.9.0.0/Data
  Data49906349/Data
  Data812/Data
  Data144/Data
  DataSystem.MissingMemberException/Data
  Data /

  DataC:\Users\daftspaniel\AppData\Local\Temp\WERC11B.tmp.WERInternalMetadata.xml/Data

  DataC:\Users\daftspaniel\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_die.exe_a64e2c7542736d65947d996e2ce5fb7d5b383d1_10b50642/Data
  Data /
  Data0/Data
  Data008e52f9-3d97-11de-9bf6-0019b95c9ce7/Data
  Data0/Data
  /EventData
  /Event

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


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


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


Re: [IronPython] MissingMemberException on 2.6

2009-05-11 Thread Davy Mitchell
Right. Going a bit mad trying to fix this :-) Tried a bit of
reinstalling and rebooting to no avail.

Log Name:  Application
Source:Application Error
Date:  11/05/2009 20:22:23
Event ID:  1000
Task Category: (100)
Level: Error
Keywords:  Classic
User:  N/A
Computer:  kennel
Description:
Faulting application name: DIE.exe, version: 0.0.0.0, time stamp: 0x4a0878d9
Faulting module name: KERNELBASE.dll, version: 6.1.7100.0, time stamp:
0x49eea60f
Exception code: 0xe0434f4d
Fault offset: 0xb4f4
Faulting process id: 0x%9
Faulting application start time: 0x%10
Faulting application path: %11
Faulting module path: %12
Report Id: %13
Event Xml:
Event xmlns=http://schemas.microsoft.com/win/2004/08/events/event;
  System
Provider Name=Application Error /
EventID Qualifiers=01000/EventID
Level2/Level
Task100/Task
Keywords0x80/Keywords
TimeCreated SystemTime=2009-05-11T19:22:23.0Z /
EventRecordID2273/EventRecordID
ChannelApplication/Channel
Computerkennel/Computer
Security /
  /System
  EventData
DataDIE.exe/Data
Data0.0.0.0/Data
Data4a0878d9/Data
DataKERNELBASE.dll/Data
Data6.1.7100.0/Data
Data49eea60f/Data
Datae0434f4d/Data
Datab4f4/Data
  /EventData
/Event

Interestingly if I try to ngen IronPython.dll I get:

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\M
icrosoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure lo
gging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fus
ion!EnableLog].
 while resolving 0x100014e - Microsoft.Linq.Expressions.ArgumentType.
Warning: System.IO.FileNotFoundException: Could not load file or assembly 'Micro
soft.Scripting.Core, Version=0.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad
364e35' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.Scripting.Core, Version=0.9.0.0, Culture=neutral, PublicKe
yToken=31bf3856ad364e35'

Any suggestions appreciated!! Carrying on...

Thanks,
Davy

On Mon, May 11, 2009 at 7:21 AM, Davy Mitchell daftspan...@gmail.com wrote:
 Hi Curt,

 Sorry reported the wrong version there. I run the 2.6 interpreter but
 have hard coded the build scripts to 2.01 ipy and the target folder
 has the 2.01 binaries.
 So it is all 2.01. Just tried the (same) compiled version on XP with
 the same result. I built a console app without issue which ran so
 looks like my code is doing something different :-)

 Seems like I need to spend time narrowing down what is new since my
 last build. I have introduced threading, use of dir (for autocomplete)
 and changed external process handling so there is potential for
 something to be up there.

 Thanks.
 Davy Mitchell

 On Sun, May 10, 2009 at 9:19 PM, Curt Hagenlocher c...@hagenlocher.org 
 wrote:
 I don't think that this:
   DataMicrosoft.Scripting/Data
   Data0.9.0.0/Data
 is the right AssemblyVersion for the 2.6 alpha. I would expect something
 like 0.9.5.1. Is it possible that you're compiling with a different
 version of IronPython than you think?


 On Sun, May 10, 2009 at 12:27 PM, Davy Mitchell daftspan...@gmail.com
 wrote:

 Hi Guys,

 I am on 2.6 Beta on Windows 7 7100 and getting MissingMemberException
 when I compile to an EXE.

 http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20623

 I've tried adding the references suggest on the mailing list:
 clr.AddReference('System')
 clr.AddReference('mscorlib')
 But they were already there which suggests I have hit this before.
 This all compiled and ran fine before I reinstalled the OS.

 Anything else I can look at?

 - Event xmlns=http://schemas.microsoft.com/win/2004/08/events/event;
 - System
  Provider Name=Windows Error Reporting /
  EventID Qualifiers=01001/EventID
  Level4/Level
  Task0/Task
  Keywords0x80/Keywords
  TimeCreated SystemTime=2009-05-10T19:16:21.0Z /
  EventRecordID2149/EventRecordID
  ChannelApplication/Channel
  Computerkennel/Computer
  Security /
  /System
 - EventData
  Data566025849/Data
  Data5/Data
  DataCLR20r3/Data
  DataNot available/Data
  Data0/Data
  Datadie.exe/Data
  Data0.0.0.0/Data
  Data4a0727eb/Data
  DataMicrosoft.Scripting/Data
  Data0.9.0.0/Data
  Data49906349/Data
  Data812/Data
  Data144/Data
  DataSystem.MissingMemberException/Data
  Data /

  DataC:\Users\daftspaniel\AppData\Local\Temp\WERC11B.tmp.WERInternalMetadata.xml/Data

  DataC:\Users\daftspaniel\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_die.exe_a64e2c7542736d65947d996e2ce5fb7d5b383d1_10b50642/Data
  Data /
  Data0/Data
  Data008e52f9-3d97-11de-9bf6-0019b95c9ce7/Data
  Data0/Data
  /EventData
  /Event

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

Re: [IronPython] MissingMemberException on 2.6

2009-05-11 Thread Davy Mitchell
Hi Dino,

 When you say you're running the 2.6 interpreter does that mean you're using 
 2.6 to compile
 and then run against 2.0?  If so that probably won't work.

No - all building is done using 2.01 and 2.01 assemblies are used in
the target bin folder. I've uninstalled 2.6 now just to rule it out
altogether.

 Is there any chance you could attach a debugger to the dieing process
 and get the managed stack trace where things are blowing up?

Think I've narrowed it down partly to the use of __name__ in the main
script (which is not set to '__main__' when compiled) - easy to avoid
that one. This would explain why the app sometimes did nothing! As I
kept getting different results when troubleshooting this with
different errors I suspect something was up with this PC install also.
Can't get a repro or the real thing to consistently write an error to
the event log so nothing to report for now :-)

Thanks for the suggestions,
Davy Mitchell
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] IronPython on Win7 Build7100

2009-05-02 Thread Davy Mitchell
Well it seems normal now :-)

Maybe a setup something was churning away in the background...

Sorry for the noise!

Davy

On Sat, May 2, 2009 at 6:47 AM, Davy Mitchell daftspan...@gmail.com wrote:
 Hi Folks,

 Just upgraded from the Beta to RC for Win7. The OS is snappier than
 ever. Good stuff.

 However I've noticed IP (2.01 and 2.6) running a good bit slower since
 the Beta. Does anyone have any suggestions to why this might be or
 what I can look into?

 Thanks,
 Davy Mitchell

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


[IronPython] IronPython on Win7 Build7100

2009-05-01 Thread Davy Mitchell
Hi Folks,

Just upgraded from the Beta to RC for Win7. The OS is snappier than
ever. Good stuff.

However I've noticed IP (2.01 and 2.6) running a good bit slower since
the Beta. Does anyone have any suggestions to why this might be or
what I can look into?

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


Re: [IronPython] Using Wing IDE with IronPython - autocomplete for .NET objects (PI file generator)

2009-04-30 Thread Davy Mitchell
On Thu, Apr 30, 2009 at 12:43 AM, Jimmie Houchin jlhouc...@gmail.com wrote:
 This sounds great. I am new to both IronPython, WingIDE and Windows
 development in general.

Interesting to see how much developers want autocomplete! I tried to
start adding this to DIE tonight but was struggling with the code
editor component. Unfortunately the project looks a little stagnant.

Does anyone know of any other good free syntax highlighting .net
editor components?

Thanks,
Davy Mitchell

http://code.google.com/p/davysironpythoneditor/
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] IDLE like functionality

2009-04-29 Thread Davy Mitchell
Hi Harriv,

You could start by looking at
http://www.ironpython.info/index.php/Contents#Tools_and_Utilities

There's a couple of web and desktop IronPython shells there.

Davy

On Wed, Apr 29, 2009 at 9:21 AM, Harriv har...@gmail.com wrote:
 Hi,
  A beginner's question: Is there a tutorial/demo/sample project to show how
 embed IDLE like functionality in C# WinForms application?
  So basically I'd like to add interactive command line to my application,
 but of course all other features of IDLE (eg debugging, code editors etc)
 must be left out.
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


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


Re: [IronPython] IDLE like functionality

2009-04-29 Thread Davy Mitchell
MFC is a C++ wrapper for Win32. Made it more OO.

Ah takes me back :-) !!

Cheers,
Davy
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Modifying The PYC Stub EXE

2009-04-09 Thread Davy Mitchell
For the archives, this is raised as:
http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=21987

On Thu, Apr 9, 2009 at 4:42 PM, Dave Fugate dfug...@microsoft.com wrote:
 Pyc.py is now in TFS on CodePlex, 
 $/IronPython/IronPython_Main/Tools/Scripts/pyc.py, and a few related tests 
 have been added to our checkin system ensuring this doesn't get broken in the 
 future.

 Dave

 -Original Message-
 From: users-boun...@lists.ironpython.com 
 [mailto:users-boun...@lists.ironpython.com] On Behalf Of Davy Mitchell
 Sent: Wednesday, April 08, 2009 1:39 PM
 To: Discussion of IronPython
 Subject: Re: [IronPython] Modifying The PYC Stub EXE

 Dave - +1 :-)

 On Wed, Apr 8, 2009 at 9:19 PM, Dave Fugate dfug...@microsoft.com wrote:
 I've been working on making this happen for a few days now.  It should be 
 available in the IronPython_Main branch on CodePlex's TFS server within a 
 day or so.

 Dave

 -Original Message-
 From: users-boun...@lists.ironpython.com 
 [mailto:users-boun...@lists.ironpython.com] On Behalf Of Davy Mitchell
 Sent: Wednesday, April 08, 2009 1:11 PM
 To: Discussion of IronPython
 Subject: Re: [IronPython] Modifying The PYC Stub EXE

 SNIP
 Is PYC ever likely to become part of the standard install?
 /SNAP

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

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

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

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


Re: [IronPython] Modifying The PYC Stub EXE

2009-04-08 Thread Davy Mitchell
Hi Dino,

Thanks works great - you confused me with the semi-colons :-) Thanks
Bruce too - your posts
re:sys.argv were useful in looking at this.

I'll raise a feature request of some sort. Is PYC ever likely to
become part of the standard install?

In case it is of use to anyone, I've put my modified PYC on my
skydrive. Also has a modification for STA as I use the webcontrol in
DIE.

http://cid-1c5b93086198f54e.skydrive.live.com/self.aspx/Public/pyc.py

Regards,
Davy Mitchell

On Tue, Apr 7, 2009 at 3:33 AM, Dino Viehland di...@microsoft.com wrote:
 Ahh, I see, you want to add something like:

    gen.EmitCall(OpCodes.Call, 
 clr.GetClrType(Assembly).GetMethod(GetEntryAssembly), ());
    gen.EmitCall(OpCodes.Call, 
 clr.GetClrType(Assembly).GetMethod(get_CodeBase), ());
    gen.Emit(OpCodes.Newobj, clr.GetClrType(System.Uri).GetConstructor( (str, 
 ) ));
    gen.EmitCall(OpCodes.Call, 
 clr.GetClrType(System.Uri).GetMethod(get_LocalPath), ());
    gen.Emit(OpCodes.Newobj, 
 clr.GetClrType(System.IO.FileInfo).GetConstructor( (str, ) ))
    gen.EmitCall(OpCodes.Call, 
 clr.GetClrType(System.IO.FileInfo).GetMethod(get_Directory), ())
    gen.EmitCall(OpCodes.Call, 
 clr.GetClrType(System.IO.DirectoryInfo).GetMethod(get_FullName), ())
    gen.EmitCall(OpCodes.Call, 
 clr.GetClrType(System.Environment).GetMethod(set_CurrentDirectory), ())

 right before we get the ScriptCode assembly in GenerateExe.

 It's really unfortunate that this is necessary.  In theory we can burn a 
 reference from your DLL into your EXE and have the CLR load the assembly and 
 it should be able to pick it up w/o changing the CWD.  The problem seems to 
 be that we end up with DIE.EXE and DIE.DLL and it would appear the CLR 
 always loads DIE.EXE and then it doesn't find the types in DIE.DLL.  
 Presumably if we named them different this would work.  Maybe we should 
 enable naming them differently or maybe we should enable generating just one 
 EXE instead of the wrapper EXE.

 Feel free to open a feature request - at the very least we can make an option 
 to insert the above code :)

 -Original Message-
 From: users-boun...@lists.ironpython.com [mailto:users-
 boun...@lists.ironpython.com] On Behalf Of Davy Mitchell
 Sent: Monday, April 06, 2009 10:57 AM
 To: Discussion of IronPython
 Subject: Re: [IronPython] Modifying The PYC Stub EXE

 Hi Dino,

 All the DLLs are in the Build directory. Everything runs great if the
 CWD is the folder containing
 the EXE. If you try and run it from another folder things go wrong
 (File Not Found Exception).

 I've posted a basic repro on my Skydrive
 http://cid-
 1c5b93086198f54e.skydrive.live.com/self.aspx/Public/hello.zip

 cd hello\build\ and die.exe will run
 cd hello and run .\build\die.exe and it will fail

 Thanks,
 Davy Mitchell

 On Mon, Apr 6, 2009 at 4:18 PM, Dino Viehland di...@microsoft.com
 wrote:
  What DLLs you want to be loaded?  The reason I ask is that .NET
 assembly
  loading doesn't really work on the basis of the current working
 directory -
  instead it looks at the app base which by default is where your EXE
 is
  located.  We do modify sys.path so that IronPython can load things
 outside
  of the app base but I wouldn't suggest pushing this too far.  Instead
 I'd
  propose doing what a normal build process does and copy the DLLs into
 the
  build directory.
 
 
 
  From: users-boun...@lists.ironpython.com
  [mailto:users-boun...@lists.ironpython.com] On Behalf Of Davy
 Mitchell
  Sent: Sunday, April 05, 2009 3:55 AM
  To: Discussion of IronPython
  Subject: [IronPython] Modifying The PYC Stub EXE
 
 
 
  Hi Folks,
 
 
 
  I am looking to modify the EXE stub generated by PYC so that it will
 set the
  current working directory to the location of the EXE
 
  before loading its assemblies.
 
 
 
  The problem I am having is I build my EXE to a sub-folder called
 BUILD. If I
  call it in the form .\build\die.exe then it can't find the DLLs.
 
  This can be worked around with shortcuts setting the working dir etc
 but
  having this option in code in PYC would be useful.
 
 
 
  Forgive me if I am very very muddled up about something :-)
 
 
 
  Thanks,
 
  Davy Mitchell
 
 
 
 
 
  ___
  Users mailing list
  Users@lists.ironpython.com
  http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
 
 
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

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

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


Re: [IronPython] Modifying The PYC Stub EXE

2009-04-08 Thread Davy Mitchell
Dave - +1 :-)

On Wed, Apr 8, 2009 at 9:19 PM, Dave Fugate dfug...@microsoft.com wrote:
 I've been working on making this happen for a few days now.  It should be 
 available in the IronPython_Main branch on CodePlex's TFS server within a day 
 or so.

 Dave

 -Original Message-
 From: users-boun...@lists.ironpython.com 
 [mailto:users-boun...@lists.ironpython.com] On Behalf Of Davy Mitchell
 Sent: Wednesday, April 08, 2009 1:11 PM
 To: Discussion of IronPython
 Subject: Re: [IronPython] Modifying The PYC Stub EXE

 SNIP
 Is PYC ever likely to become part of the standard install?
 /SNAP

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

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


Re: [IronPython] Modifying The PYC Stub EXE

2009-04-06 Thread Davy Mitchell
Hi Dino,

All the DLLs are in the Build directory. Everything runs great if the
CWD is the folder containing
the EXE. If you try and run it from another folder things go wrong
(File Not Found Exception).

I've posted a basic repro on my Skydrive
http://cid-1c5b93086198f54e.skydrive.live.com/self.aspx/Public/hello.zip

cd hello\build\ and die.exe will run
cd hello and run .\build\die.exe and it will fail

Thanks,
Davy Mitchell

On Mon, Apr 6, 2009 at 4:18 PM, Dino Viehland di...@microsoft.com wrote:
 What DLLs you want to be loaded?  The reason I ask is that .NET assembly
 loading doesn’t really work on the basis of the current working directory –
 instead it looks at the app base which by default is where your EXE is
 located.  We do modify sys.path so that IronPython can load things outside
 of the app base but I wouldn’t suggest pushing this too far.  Instead I’d
 propose doing what a normal build process does and copy the DLLs into the
 build directory.



 From: users-boun...@lists.ironpython.com
 [mailto:users-boun...@lists.ironpython.com] On Behalf Of Davy Mitchell
 Sent: Sunday, April 05, 2009 3:55 AM
 To: Discussion of IronPython
 Subject: [IronPython] Modifying The PYC Stub EXE



 Hi Folks,



 I am looking to modify the EXE stub generated by PYC so that it will set the
 current working directory to the location of the EXE

 before loading its assemblies.



 The problem I am having is I build my EXE to a sub-folder called BUILD. If I
 call it in the form .\build\die.exe then it can't find the DLLs.

 This can be worked around with shortcuts setting the working dir etc but
 having this option in code in PYC would be useful.



 Forgive me if I am very very muddled up about something :-)



 Thanks,

 Davy Mitchell





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


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


[IronPython] Modifying The PYC Stub EXE

2009-04-05 Thread Davy Mitchell
Hi Folks,

I am looking to modify the EXE stub generated by PYC so that it will set the
current working directory to the location of the EXE
before loading its assemblies.

The problem I am having is I build my EXE to a sub-folder called BUILD. If I
call it in the form .\build\die.exe then it can't find the DLLs.
This can be worked around with shortcuts setting the working dir etc but
having this option in code in PYC would be useful.

Forgive me if I am very very muddled up about something :-)

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


Re: [IronPython] PYC and 2.6 A1

2009-04-02 Thread Davy Mitchell
Thanks Dino - no urgency for me. I usually compile DIE for my own use but
under 2.6A1 it runs fairly snappily even when run from ipy :-)

Thanks,
Davy

On Tue, Mar 31, 2009 at 11:54 PM, Dino Viehland di...@microsoft.com wrote:

  Yeah there is apparently an issue here, Resolver reported it to me the
 other day off-line.  We’ve been changing our code gen rather significantly
 and it looks like our existing test coverage isn’t hitting whatever the
 issue is here.  I’ll probably look at it tomorrow.



 *From:* users-boun...@lists.ironpython.com [mailto:
 users-boun...@lists.ironpython.com] *On Behalf Of *Davy Mitchell
 *Sent:* Tuesday, March 31, 2009 1:52 PM
 *To:* Discussion of IronPython
 *Subject:* [IronPython] PYC and 2.6 A1



 Hi Guys,



 Are there known issues with PYC and IPY 2.6 A1?



 When my exe compiles, I get:


 Unhandled Exception: Microsoft.Scripting.Runtime.UnboundNameException: name
 'ThreadExceptionEventArgs' is not defined
at Microsoft.Scripting.Actions.Calls.MethodTarget.Caller.Call(Object[]
 args, Boolean shouldOptimize)
at
 IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`6.Call5(CallSite
 site, CodeContext context, TFuncType func, T0 arg0, T1 arg1, T2 arg2, T3
 arg3, T4 arg4)
at
 Microsoft.Scripting.UpdateDelegates.UpdateAndExecute7[T0,T1,T2,T3,T4,T5,T6,TRet](CallSite
 site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
at IronPython.Runtime.Importer.Import(CodeContext context, String
 fullName, PythonTuple from, Int32 level)
at IronPython.Runtime.Operations.PythonOps.InitializeModule(Assembly
 precompiled, String main, String[] references)
at PythonMain.Main()

 Works fine in 2.01.



 Thanks,

 Davy Mitchell

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


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


[IronPython] PYC and 2.6 A1

2009-03-31 Thread Davy Mitchell
Hi Guys,

Are there known issues with PYC and IPY 2.6 A1?

When my exe compiles, I get:

Unhandled Exception: Microsoft.Scripting.Runtime.UnboundNameException: name
'ThreadExceptionEventArgs' is not defined
   at Microsoft.Scripting.Actions.Calls.MethodTarget.Caller.Call(Object[]
args, Boolean shouldOptimize)
   at
IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`6.Call5(CallSite
site, CodeContext context, TFuncType func, T0 arg0, T1 arg1, T2 arg2, T3
arg3, T4 arg4)
   at
Microsoft.Scripting.UpdateDelegates.UpdateAndExecute7[T0,T1,T2,T3,T4,T5,T6,TRet](CallSite
site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
   at IronPython.Runtime.Importer.Import(CodeContext context, String
fullName, PythonTuple from, Int32 level)
   at IronPython.Runtime.Operations.PythonOps.InitializeModule(Assembly
precompiled, String main, String[] references)
   at PythonMain.Main()
Works fine in 2.01.

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


Re: [IronPython] Compiled WPF applications with pyc on ipy 2.0 - STA problem?

2009-02-12 Thread Davy Mitchell
 Hi Chris,

Have a look at
http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=19409

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


Re: [IronPython] ANN : Davy's IronPython Editor

2008-12-26 Thread Davy Mitchell
On Tue, Dec 23, 2008 at 11:40 AM, Michael Foord
fuzzy...@voidspace.org.ukwrote:

 Awesome! You should look at PySmell for autocomplete. It won't run under
 IronPython but is intended to be run with CPython called as a subprocess
 anyway. I'm sure Orestis will be happy to give you some pointers if you go
 down this route.


I am trying to avoid CPython as a dependency but may be worth it as an
option for autocomplete. Thanks for the suggestion.

it's a good tool but in my opinion the name 'DIE' is not good, isn't it?

LOL - maybe I should stay out of marketing :-) !!! Seriously though,
avoiding the TLA or a new name may be a good idea!

Take care,
Davy Mitchell
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] ANN : Davy's IronPython Editor

2008-12-20 Thread Davy Mitchell
Hi Folks,
I've made a small start on an IronPython Editor in WinForms using
SyntaxBox.  The project intentions is to create an editor along the lines of
SPE or DrPython.

If you want to take a look there are a couple of screen shots - please
visit:
http://code.google.com/p/davysironpythoneditor/

Code in SVN only at the moment. DIE does benefit from being compiled. Maybe
once I stop sniffing and coughing so much it will get done and uploaded !
:-)

It's not production ready yet so please, please be careful with your
precious source code. I've not tried it on Mono yet.

Feedback and ideas appreciated.

Thanks  Merry Christmas,
Davy Mitchell
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] ActiveX STA Issue in compiled Winforms EXE

2008-11-08 Thread Davy Mitchell
IPY 2.0 RC1

ActiveX Issue in a pyc compiled Winforms EXE which uses the WebBrowser
control.

Unhandled Exception: System.Threading.ThreadStateException: ActiveX control
'8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the
current thread is not in a single-threaded apartment.
   at System.Windows.Forms.WebBrowserBase..ctor(String clsidString)
   at System.Windows.Forms.WebBrowser..ctor()
   at _stub_$643##332(Closure , CallSite , CodeContext , Object )
   at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4
target, C

Help!! :-)

Any thoughts before I delve further into this?

Thanks
Davy Mitchell
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] ActiveX STA Issue in compiled Winforms EXE

2008-11-08 Thread Davy Mitchell
Hi Michael

Are you doing this from a separate thread?

No.

It's a couple of modules deep from the 'main' script. Was going to try
a single py file to repro.

 I assume it works fine when run uncompiled?

Yep, runs great.
Cheers,
Davy


On 11/8/08, Michael [EMAIL PROTECTED] wrote:
 Are you doing this from a separate thread? I assume it works fine when
 run uncompiled?


 Michael

 http://www.ironpythoninaction.com

 On 8 Nov 2008, at 12:10, Davy Mitchell [EMAIL PROTECTED] wrote:

 IPY 2.0 RC1


 ActiveX Issue in a pyc compiled Winforms EXE which uses the
 WebBrowser control.

 Unhandled Exception: System.Threading.ThreadStateException: ActiveX
 control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be
 instantiated because the current thread is not in a single-threaded
 apartment.
at System.Windows.Forms.WebBrowserBase..ctor(String clsidString)
at System.Windows.Forms.WebBrowser..ctor()
at _stub_$643##332(Closure , CallSite , CodeContext , Object )
at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet]
 (Func`4 target, C

 Help!! :-)

 Any thoughts before I delve further into this?

 Thanks
 Davy Mitchell
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

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


Re: [IronPython] ActiveX STA Issue in compiled Winforms EXE

2008-11-08 Thread Davy Mitchell
Thanks Dino - here's the info:
Unhandled Exception: System.Threading.ThreadStateException: ActiveX control
'8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the
current thread is not in a single-threaded apartment.
   at System.Windows.Forms.WebBrowserBase..ctor(String clsidString)
   at System.Windows.Forms.WebBrowser..ctor()
   at _stub_$24##21(Closure , CallSite , CodeContext , Object )
   at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4
target, CallSite site, Object[] args)
   at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args)
   at
Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite
site, T0 arg0, T1 arg1)
   at S$1.__init__$7(Closure , Object self)
   at _stub_$18##15(Closure , CallSite , CodeContext , Object , Object )
   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 _stub_$17##14(Closure , CallSite , CodeContext , Object )
   at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4
target, CallSite site, Object[] args)
   at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args)
   at
Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite
site, T0 arg0, T1 arg1)
   at _stub_$16##13(Closure , CallSite , CodeContext , Object )
   at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4
target, CallSite site, Object[] args)
   at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args)
   at
Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite
site, T0 arg0, T1 arg1)
   at S$1.Initialize(Scope $scope, LanguageContext $language)
   at
Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpression
code, Scope scope)
   at Microsoft.Scripting.ScriptCode.Run(Scope scope)
   at IronPython.Runtime.PythonContext.CreateModule(String fileName, Scope
scope, ScriptCode scriptCode, ModuleOptions options)
   at IronPython.Runtime.PythonContext.CompileModule(String fileName, String
moduleName, SourceUnit sourceCode, ModuleOptions options, ScriptCode
scriptCode)
   at IronPython.Runtime.PythonContext.CompileModule(String fileName, String
moduleName, SourceUnit sourceCode, ModuleOptions options)
   at IronPython.Runtime.Importer.LoadFromSourceUnit(CodeContext context,
SourceUnit sourceCode, String name, String path)
   at IronPython.Runtime.Importer.LoadModuleFromSource(CodeContext context,
String name, String path)
   at IronPython.Runtime.Importer.LoadFromDisk(CodeContext context, String
name, String fullName, String str)
   at IronPython.Runtime.Importer.ImportFromPathHook(CodeContext context,
String name, String fullName, List path, Func`5 defaultLoader)
   at IronPython.Runtime.Importer.ImportFromPath(CodeContext context, String
name, String fullName, List path)
   at IronPython.Runtime.Importer.ImportTopAbsolute(CodeContext context,
String name)
   at IronPython.Runtime.Importer.ImportModule(CodeContext context, Object
globals, String modName, Boolean bottom, Int32 level)
   at IronPython.Runtime.Builtin.__import__(CodeContext context, String
name, Object globals, Object locals, Object fromlist, Int32 level)
   at _stub_$1##1(Closure , CallSite , CodeContext , Object , String ,
IAttributesCollection , IAttributesCollection , PythonTuple , Int32 )
   at
Microsoft.Scripting.Actions.MatchCaller.Call7[T0,T1,T2,T3,T4,T5,T6,TRet](Func`9
target, CallSite site, Object[] args)
   at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args)
   at
Microsoft.Scripting.Actions.UpdateDelegates.Update7[T,T0,T1,T2,T3,T4,T5,T6,TRet](CallSite
site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6
rg6)
   at IronPython.Runtime.Importer.Import(CodeContext context, String
fullName, PythonTuple from, Int32 level)
   at IronPython.Runtime.Operations.PythonOps.InitializeModule(Assembly
precompiled, String main, String[] references)
   at PythonMain.Main()

Repro code is:

import clr
clr.AddReference('System.Windows.Forms')
from System.Windows.Forms import *

class MainForm(Form):
def __init__(self):
self.Dock = DockStyle.Fill
self.Controls.Add(WebBrowser())
form = MainForm()
Application.Run(form)

Compiled with:
ipy pyc.py /out:wf /target:winexe /main:repro.py

-X:ExceptionDetail didn't alter the output from the exe. Run from ipy there
was no issue.

Cheers,
Davy

On Sat, Nov 8, 2008 at 5:39 PM, Dino Viehland [EMAIL PROTECTED] wrote:

 I'd start w/ -X:ExceptionDetail to get the full stack trace.  Presumably
 there's something higher up the stack then the MatchCaller on the stack.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:
 [EMAIL PROTECTED] On Behalf Of Davy Mitchell
 Sent: Saturday, November 08, 2008 6:19 AM
 To: Discussion

Re: [IronPython] ActiveX STA Issue in compiled Winforms EXE

2008-11-08 Thread Davy Mitchell
Thanks Dino - works great now. Runtime speed is much snappier when compiled.

One other thing I spotted is that pyc always builds a console app if /main
is specified.

elif arg.startswith(/main:):
main_name = main = arg[6:]
target = System.Reflection.Emit.PEFileKinds.ConsoleApplication

Confused me for a bit :-) Have added this to Codeplex issue.

Cheers,Davy Mitchell

On Sat, Nov 8, 2008 at 10:13 PM, Dino Viehland [EMAIL PROTECTED] wrote:

  Oh, the problem is that pyc.py doesn't mark the thread as STA.  You can
 add this line to pyc.py right after mainMethod = …



 mainMethod.SetCustomAttribute(clr.GetClrType(System.STAThreadAttribute).GetConstructor(()),
 System.Array[System.Byte](()))



 and it should work.  We should do that by default for winexe's and probably
 offer an option to control STA/MTA for non-WinEXEs.



 Thanks for reporting this.  I've opened a bug (
 http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=19409)
 and we can probably refresh the sample.



 *From:* [EMAIL PROTECTED] [mailto:
 [EMAIL PROTECTED] *On Behalf Of *Davy Mitchell
 *Sent:* Saturday, November 08, 2008 1:59 PM

 *To:* Discussion of IronPython
 *Subject:* Re: [IronPython] ActiveX STA Issue in compiled Winforms EXE



 Thanks Dino - here's the info:



 Unhandled Exception: System.Threading.ThreadStateException: ActiveX control
 '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the
 current thread is not in a single-threaded apartment.

at System.Windows.Forms.WebBrowserBase..ctor(String clsidString)

at System.Windows.Forms.WebBrowser..ctor()

at _stub_$24##21(Closure , CallSite , CodeContext , Object )

at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4
 target, CallSite site, Object[] args)

at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[]
 args)

at
 Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite
 site, T0 arg0, T1 arg1)

at S$1.__init__$7(Closure , Object self)

at _stub_$18##15(Closure , CallSite , CodeContext , Object , Object )

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 _stub_$17##14(Closure , CallSite , CodeContext , Object )

at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4
 target, CallSite site, Object[] args)

at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[]
 args)

at
 Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite
 site, T0 arg0, T1 arg1)

at _stub_$16##13(Closure , CallSite , CodeContext , Object )

at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4
 target, CallSite site, Object[] args)

at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[]
 args)

at
 Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite
 site, T0 arg0, T1 arg1)

at S$1.Initialize(Scope $scope, LanguageContext $language)

at
 Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpression
 code, Scope scope)

at Microsoft.Scripting.ScriptCode.Run(Scope scope)

at IronPython.Runtime.PythonContext.CreateModule(String fileName, Scope
 scope, ScriptCode scriptCode, ModuleOptions options)

at IronPython.Runtime.PythonContext.CompileModule(String fileName,
 String moduleName, SourceUnit sourceCode, ModuleOptions options, ScriptCode
 scriptCode)

at IronPython.Runtime.PythonContext.CompileModule(String fileName,
 String moduleName, SourceUnit sourceCode, ModuleOptions options)

at IronPython.Runtime.Importer.LoadFromSourceUnit(CodeContext context,
 SourceUnit sourceCode, String name, String path)

at IronPython.Runtime.Importer.LoadModuleFromSource(CodeContext context,
 String name, String path)

at IronPython.Runtime.Importer.LoadFromDisk(CodeContext context, String
 name, String fullName, String str)

at IronPython.Runtime.Importer.ImportFromPathHook(CodeContext context,
 String name, String fullName, List path, Func`5 defaultLoader)

at IronPython.Runtime.Importer.ImportFromPath(CodeContext context,
 String name, String fullName, List path)

at IronPython.Runtime.Importer.ImportTopAbsolute(CodeContext context,
 String name)

at IronPython.Runtime.Importer.ImportModule(CodeContext context, Object
 globals, String modName, Boolean bottom, Int32 level)

at IronPython.Runtime.Builtin.__import__(CodeContext context, String
 name, Object globals, Object locals, Object fromlist, Int32 level)

at _stub_$1##1(Closure , CallSite , CodeContext , Object , String ,
 IAttributesCollection , IAttributesCollection , PythonTuple , Int32 )

at
 Microsoft.Scripting.Actions.MatchCaller.Call7[T0,T1,T2,T3

[IronPython] Problem Importing WinForms IPY2.0 B5

2008-10-08 Thread Davy Mitchell
Hi All,
Basic Repro is...

-form.py---
import clr
clr.AddReference('System.Windows.Forms')
from System.Windows.Forms import *
print len(dir(Form))
-test.py
from forms import *
print len(dir(Form))

Output:
538
443

My real world case is a subclass of Form is in another module. The module
that uses it tries to do mainform.KeyDown += self.DoSomething and fails as
KeyDown has vanished.
Yet if you copy and paset the subclass Form code into the same file it
works!

Forgive me if I am missing something obvious in the import mechanism :-)

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


Re: [IronPython] Problem Importing WinForms IPY2.0 B5

2008-10-08 Thread Davy Mitchell
Same code on IP 1.1.2 outputs:699
696

Cheers,
Davy

On Wed, Oct 8, 2008 at 7:34 AM, Davy Mitchell [EMAIL PROTECTED] wrote:

 Hi All,
 Basic Repro is...

 -form.py---
 import clr
 clr.AddReference('System.Windows.Forms')
 from System.Windows.Forms import *
 print len(dir(Form))
 -test.py
 from forms import *
 print len(dir(Form))

 Output:
 538
 443

 My real world case is a subclass of Form is in another module. The module
 that uses it tries to do mainform.KeyDown += self.DoSomething and fails as
 KeyDown has vanished.
 Yet if you copy and paset the subclass Form code into the same file it
 works!

 Forgive me if I am missing something obvious in the import mechanism :-)

 Thanks,
 Davy Mitchell

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


Re: [IronPython] Documentation for CallTarget0

2008-08-12 Thread Davy Mitchell
Thanks Curt.

The sample I was looking at (
http://www.ironpython.info/index.php/Invoking_onto_the_GUI_(Control)_Thread)
was
using:

   from IronPython.Runtime.Calls import CallTarget0

Poking around IronPython assemblies I found the following worked on 2.0B4:

  import clr
  clr.AddReference('IronPython')
  from IronPython.Compiler import CallTarget0

Thanks,

Davy Mitchell

On Mon, Aug 11, 2008 at 9:27 PM, Curt Hagenlocher [EMAIL PROTECTED]wrote:

 It's defined in PythonCallTargets.cs; the definition is simply public
 delegate object CallTarget0();.  That is, it's a delegate with no
 arguments.
 On Mon, Aug 11, 2008 at 1:00 PM, Davy Mitchell [EMAIL PROTECTED]wrote:

 Hi Folks,

 Sorry Google is failing me... is there Documentation for CallTarget0
 somewhere?

 Thanks,
 Davy

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



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


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


[IronPython] Documentation for CallTarget0

2008-08-11 Thread Davy Mitchell
Hi Folks,

Sorry Google is failing me... is there Documentation for CallTarget0
somewhere?

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


[IronPython] Deprecation warning on Windows Form Double Buffered

2008-08-07 Thread Davy Mitchell
Hi All,

With the following code I am getting a warning:

DeprecationWarning: Accessing protected method DoubleBuffered from
non-derived type Form

*import clr
clr.AddReference('System.Windows.Forms')
from System import *
from System.Windows.Forms import *
class LDForm(Form):

def __init__(self):
self.DoubleBuffered = True
def __call__(self):
Application.EnableVisualStyles()
Application.Run(self)

LDForm()()*

Is this related to the import changes? I've not been doing much Pythoning
lately so sorry if I have missed something...

Thanks,
Davy

-- 
Davy Mitchell
Blog - http://daftspaniel.blogspot.com
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Deprecation warning on Windows Form Double Buffered

2008-08-07 Thread Davy Mitchell
Thanks Dino - that's good to know!

On Thu, Aug 7, 2008 at 9:09 PM, Dino Viehland
[EMAIL PROTECTED]wrote:

  The warning is overly aggressive in this case – the warning is removed
 for the next release and your code will still work so you can ignore it.



 *From:* [EMAIL PROTECTED] [mailto:
 [EMAIL PROTECTED] *On Behalf Of *Davy Mitchell
 *Sent:* Thursday, August 07, 2008 12:54 PM
 *To:* Discussion of IronPython
 *Subject:* [IronPython] Deprecation warning on Windows Form Double
 Buffered



 Hi All,

 With the following code I am getting a warning:

 DeprecationWarning: Accessing protected method DoubleBuffered from
 non-derived type Form

 *import clr
 clr.AddReference('System.Windows.Forms')
 from System import *
 from System.Windows.Forms import *
 class LDForm(Form):

 def __init__(self):
 self.DoubleBuffered = True
 def __call__(self):
 Application.EnableVisualStyles()
 Application.Run(self)

 LDForm()()*

 Is this related to the import changes? I've not been doing much Pythoning
 lately so sorry if I have missed something...

 Thanks,
 Davy

 --
 Davy Mitchell
 Blog - http://daftspaniel.blogspot.com
 Twitter - http://twitter.com/daftspaniel
 Skype - daftspaniel http://needgod.com

 --
 Sample disclaimer text

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




-- 
Davy Mitchell
Blog - http://daftspaniel.blogspot.com
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] 2.0 Beta 4 MSI setup error.

2008-08-06 Thread Davy Mitchell
Ditto here. XP SP3 .Net 2.0 SP1 and 3.5

Cheers,
Davy

-- 
Davy Mitchell
Blog - http://daftspaniel.blogspot.com
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Should DBNull treat as false ?

2008-05-15 Thread Davy Mitchell
DBNull is a type. Appears all .Net types evaluate to False.
e.g.
from System import DBNull, Char
print Char==True
print DBNull==True

both will print False.

On Thu, May 15, 2008 at 9:09 AM, Sakesun Roykiattisak 
[EMAIL PROTECTED] wrote:


 Should DBNull treat as False ?

 Just a thought.
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com




-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Slightly OT: VBX Release?

2008-05-15 Thread Davy Mitchell
Thanks Jimmy - that's interesting to know. Guess it builds more of a case
for IronPython :-) !!

Davy

On Wed, May 14, 2008 at 6:27 PM, Jimmy Schementi 
[EMAIL PROTECTED] wrote:

  VBx was an implementation of Visual Basic on the DLR. It was first meant
 to be in Silverlight, but the VB team decided they'd rather put VB.NET in
 Silverlight rather than build a new implementation up from scratch. So, VBx
 is on hold.



 ~js



 *From:* [EMAIL PROTECTED] [mailto:
 [EMAIL PROTECTED] *On Behalf Of *Davy Mitchell
 *Sent:* Wednesday, May 14, 2008 6:28 AM
 *To:* Discussion of IronPython
 *Subject:* [IronPython] Slightly OT: VBX Release?



 Hi List,

 Sorry if this is OT slightly but Jim showing off  a VBX console (CLR VB I
 guess) in a screen cast got me interested.

 Is there a public release of this or is it coming soon?

 Thanks,
 Davy

 --
 Davy Mitchell
 Blog - http://www.latedecember.co.uk/sites/personal/davy/
 Twitter - http://twitter.com/daftspaniel
 Skype - daftspaniel http://needgod.com

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




-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Should DBNull treat as false ?

2008-05-15 Thread Davy Mitchell
Hi there,

I *think* this may be related to the Closed issue
http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=14605

Dino stated at the time (with the last point being relevant here):
NET conventions say that enum's should generally have a zero value
(FxCop CA1008 :)).  Because of that we can safely define __nonzero__ on
enums and have that return true/false based upon if the value is
zero/non-zero.  Otherwise Python says all expressions otherwise defined
return true,

So I think the behaviour is correct though slightly counter intuitive in the
case of Null.

Cheers,
Davy

On Thu, May 15, 2008 at 11:51 AM, Sakesun Roykiattisak 
[EMAIL PROTECTED] wrote:


 Some disambitguity is needed here.

 when  eval(a == True)  is False does not implied a is False.
 a is just not equal to True.

 All .NET types actually consider nonzero which in turn will be treat as
 True in conditional expression.


  if System.DBNull: print 'I am something'

 ...
 I am something




  if None: print This won't show anything

 ...



 What I'm asking here is whether should DBNull.Value be considered as False
 in conditional expression.



 On Thu, 15 May 2008 15:48:37 +0700, Davy Mitchell [EMAIL PROTECTED]
 wrote:

  DBNull is a type. Appears all .Net types evaluate to False.
 e.g.
 from System import DBNull, Char
 print Char==True
 print DBNull==True

 both will print False.

 On Thu, May 15, 2008 at 9:09 AM, Sakesun Roykiattisak 
 [EMAIL PROTECTED] wrote:


 Should DBNull treat as False ?

 Just a thought.
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com






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




-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Slightly OT: VBX Release?

2008-05-14 Thread Davy Mitchell
Hi List,

Sorry if this is OT slightly but Jim showing off  a VBX console (CLR VB I
guess) in a screen cast got me interested.

Is there a public release of this or is it coming soon?

Thanks,
Davy

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Downloader in Silverlight2

2008-05-11 Thread Davy Mitchell
Hi List,

I am trying out Silverlight examples (
http://www.voidspace.org.uk/python/weblog/arch_d7_2007_08_18.shtml#e799) and
this line is failing in Silverlight 2

from System.Windows import Downloader
ImportException: Cannot import name Downloader
Can't seem to find any docs on this? Guess it is to do with security?

Thanks,
Davy Mitchell

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Downloader in Silverlight2

2008-05-11 Thread Davy Mitchell
Thanks!

On Sun, May 11, 2008 at 11:19 AM, Michael Foord [EMAIL PROTECTED]
wrote:

 Hello Davy,

 Downloader is gone, gone, gone

 Use WebClient instead.


 http://www.voidspace.org.uk/ironpython/silverlight/silverlight_api.shtml#accessing-server-resources-with-the-webclient

 Michael

 Davy Mitchell wrote:

 Hi List,

 I am trying out Silverlight examples (
 http://www.voidspace.org.uk/python/weblog/arch_d7_2007_08_18.shtml#e799)
 and this line is failing in Silverlight 2

 from System.Windows import Downloader


ImportException: Cannot import name Downloader


 Can't seem to find any docs on this? Guess it is to do with security?

 Thanks,
 Davy Mitchell

 --
 Davy Mitchell
 Blog - http://www.latedecember.co.uk/sites/personal/davy/
 Twitter - http://twitter.com/daftspaniel
 Skype - daftspaniel http://needgod.com
 

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



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




-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] WPF Question

2008-05-03 Thread Davy Mitchell
Thanks Curt - turns out the selected listbox entry in the VB app was a
ListBoxItem (added in the designer),so of course they would be different. I
forgot to check the XAML file... Doh! :-)

Davy

On Sat, May 3, 2008 at 3:46 AM, Curt Hagenlocher [EMAIL PROTECTED]
wrote:

 If you add strings to the Items collection, then SelectedItem will contain
 strings.  If you want the ListBoxItem, you have to do something like this:
 listbox.ItemContainerGenerator.ContainerFromIndex(listbox.SelectedIndex)

 This is true for both VB and IronPython because it's a function of the WPF
 control.

 On Fri, May 2, 2008 at 12:49 PM, Davy Mitchell [EMAIL PROTECTED]
 wrote:

  First - yay a new release well done ;-)
 
  Now a WPF Question...
 
  I am using a listbox and in VB.net used TheLisbox.SelectedItem.Content
  to get the string selected.
 
  Try this with IronPython (and after an impressively long traceback) the
  error is 'AttributeError: 'str' object has no attribute 'Content''.
 
  So IP has converted the 'Object' of SelectedItem straight to a string -
  handy for me but shouldn't it be a ListBoxItem?
 
  Thanks,
  Davy
 
  --
  Davy Mitchell
  Blog - http://www.latedecember.co.uk/sites/personal/davy/
  Twitter - http://twitter.com/daftspaniel
  Skype - daftspaniel http://needgod.com
  ___
  Users mailing list
  Users@lists.ironpython.com
  http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
 
 

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




-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] WPF Question

2008-05-02 Thread Davy Mitchell
First - yay a new release well done ;-)

Now a WPF Question...

I am using a listbox and in VB.net used TheLisbox.SelectedItem.Content to
get the string selected.

Try this with IronPython (and after an impressively long traceback) the
error is 'AttributeError: 'str' object has no attribute 'Content''.

So IP has converted the 'Object' of SelectedItem straight to a string -
handy for me but shouldn't it be a ListBoxItem?

Thanks,
Davy

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] PreferComDispatch - Odd Behaviour

2008-04-14 Thread Davy Mitchell
Thanks for the response Shri.

Sounds like the default interface should be fine. The 'real' objects I want
to introspect are COM dll's intended for ASP so shouldn't hit this issue.

Thanks,
Davy Mitchell

On Mon, Apr 14, 2008 at 8:28 PM, Shri Borde [EMAIL PROTECTED]
wrote:

  We infer that the object implements IWshShell3 which declared the
 CurrentDirectory property. From the TLB info, we know about CurrentDirectory
 right away. However, SpecialFolders is declared on the base interface
 IWhsShell. Looks like we just need to walk up the class hierarchy. We
 currently don't do this. I have opened
 http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=16107 to
 track this.



 SpecialFolders does appear when you use it because we use
 IDispatch.GetIDsOfNames on it, and it is there ofcourse.



 Thanks,

 Shri

 Want to work on IronPython, IronRuby, 
 F#http://blogs.msdn.com/ironpython/archive/2008/02/25/ironpython-ironruby-and-f-openings-in-dev-test-and-pm.aspx?
 Visit http://blogs.msdn.com/ironpython/



 *From:* [EMAIL PROTECTED] [mailto:
 [EMAIL PROTECTED] *On Behalf Of *Davy Mitchell
 *Sent:* Saturday, April 12, 2008 11:53 PM
 *To:* Discussion of IronPython
 *Subject:* [IronPython] PreferComDispatch - Odd Behaviour



 IP2.0.0.1000
 from System import Type, Activator
 wb = Activator.CreateInstance(Type.GetTypeFromProgID(WScript.Shell))
 print dir(wb)
 print wb.CurrentDirectory()
 print wb.SpecialFolders(Desktop)
 print dir(wb)

 The first dir of wb is missing a method which appears as soon as a call is
 made to it.
 Interestingly CurrentDirectory is listed in the first dir without being
 called.

 ['CreateObjRef', 'CurrentDirectory', 'Equals', 'Exec', 'Finalize',
 'GetAttrNames
 ', 'GetHashCode', 'GetLifetimeService', 'GetMemberNames', 'GetType',
 'Initialize
 LifetimeService', 'MemberwiseClone', 'ReferenceEquals', 'ToString',
 '__class__',
  '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__',
 '__new__'
 , '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__']
 c:\code\comtry
 c:\users\daftspaniel\desktop
 ['CreateObjRef', 'CurrentDirectory', 'Equals', 'Exec', 'Finalize',
 'GetAttrNames
 ', 'GetHashCode', 'GetLifetimeService', 'GetMemberNames', 'GetType',
 'Initialize
 LifetimeService', 'MemberwiseClone', 'ReferenceEquals', '*SpecialFolders*',
 'ToStr
 ing', '__class__', '__delattr__', '__doc__', '__getattribute__',
 '__hash__', '__
 init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
 '__setattr__', '_
 _str__']

 Thanks,
 Davy Mitchell

 --
 Davy Mitchell
 Blog - http://www.latedecember.co.uk/sites/personal/davy/
 Twitter - http://twitter.com/daftspaniel
 Skype - daftspaniel http://needgod.com

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




-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] PreferComDispatch - Odd Behaviour

2008-04-13 Thread Davy Mitchell
IP2.0.0.1000
from System import Type, Activator
wb = Activator.CreateInstance(Type.GetTypeFromProgID(WScript.Shell))
print dir(wb)
print wb.CurrentDirectory()
print wb.SpecialFolders(Desktop)
print dir(wb)

The first dir of wb is missing a method which appears as soon as a call is
made to it.
Interestingly CurrentDirectory is listed in the first dir without being
called.

['CreateObjRef', 'CurrentDirectory', 'Equals', 'Exec', 'Finalize',
'GetAttrNames
', 'GetHashCode', 'GetLifetimeService', 'GetMemberNames', 'GetType',
'Initialize
LifetimeService', 'MemberwiseClone', 'ReferenceEquals', 'ToString',
'__class__',
 '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__',
'__new__'
, '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__']
c:\code\comtry
c:\users\daftspaniel\desktop
['CreateObjRef', 'CurrentDirectory', 'Equals', 'Exec', 'Finalize',
'GetAttrNames
', 'GetHashCode', 'GetLifetimeService', 'GetMemberNames', 'GetType',
'Initialize
LifetimeService', 'MemberwiseClone', 'ReferenceEquals', '*SpecialFolders*',
'ToStr
ing', '__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__',
'__
init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
'__setattr__', '_
_str__']

Thanks,
Davy Mitchell

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] COM Late Binding in IronPython

2008-04-11 Thread Davy Mitchell
Thanks very much Shri - this is a really good explanation.

Particulary happy about wider DLR support as easier to sell the dynamic
approach if other languages a possibility. I could see members of my team
being cautious about using a 'off by default' feature in a beta of a strange
language (to some!). A feature 'Coming soon' for the entire DLR is much more
appealing though we would probably start with IronPython.

Regards,
Davy Mitchell

On Thu, Apr 10, 2008 at 11:16 PM, Shri Borde [EMAIL PROTECTED]
wrote:

  I am not sure what the exact question is. However, I have posted the
 following at
 http://blogs.msdn.com/shrib/archive/2008/04/10/ole-automation-idispatch-support-in-ironpython.aspxto
  help understand what –X:PreferComDispatch does.



 *OLE automation (IDispatch) support in IronPython **[image:
 http://blogs.msdn.com/Themes/default/images/common/star-left-off.gif][image:
 http://blogs.msdn.com/Themes/default/images/common/star-right-off.gif][image:
 http://blogs.msdn.com/Themes/default/images/common/star-left-off.gif][image:
 http://blogs.msdn.com/Themes/default/images/common/star-right-off.gif][image:
 http://blogs.msdn.com/Themes/default/images/common/star-left-off.gif][image:
 http://blogs.msdn.com/Themes/default/images/common/star-right-off.gif][image:
 http://blogs.msdn.com/Themes/default/images/common/star-left-off.gif][image:
 http://blogs.msdn.com/Themes/default/images/common/star-right-off.gif][image:
 http://blogs.msdn.com/Themes/default/images/common/star-left-off.gif][image:
 http://blogs.msdn.com/Themes/default/images/common/star-right-off.gif]***

 IronPython 1.X supported COM interop by building on top of the COM 
 interophttp://msdn2.microsoft.com/en-us/library/6bw51z5z%28VS.80%29.aspxsupport
  built into the CLR. This relies on the use of interop assemblies for
 managed code to access COM objects. The interop assembly can be accessed in
 different ways:

 1.   clr.AddReference(interopAssembly) - This is the preferred
 mechanism so that the interop assembly does not have to be created multiple
 times. The down-side is that it complicates deployment. You have to 
 ensurehttp://msdn2.microsoft.com/en-us/library/697w37zd%28VS.80%29.aspxthat 
 the interop assembly exists on the machine.

 2.   Having IronPython automatically generate it on the fly - if you
 have a OLE automation object, IronPython tries to find its type library
 (TLB) and then to convert the TLB to an interop assembly on the fly using
 the 
 TypeLibConverterhttp://msdn2.microsoft.com/en-us/library/system.runtime.interopservices.typelibconverter%28VS.80%29.aspxclass.
  The advantage is that this works seamlessly as long as there is a
 type library on the machine. The down-side is that this conversion can take
 a long time for large TLB files.

 This is how Word could be accessed. It requires the interop assembly
 Microsoft.Office.Interop.Word.dll to be available on the machine.

 c:\ipy.exe
 IronPython 2.0 Beta (2.0.0.1000) on .NET 2.0.50727.1433
 Copyright (c) Microsoft Corporation. All rights reserved.
  import clr
  clr.AddReference(Microsoft.Office.Interop.Word)
  from Microsoft.Office.Interop.Word import ApplicationClass
  word = ApplicationClass()
  word.Visible = True
  doc = word.Documents.Add()
  doc.Range().Text = Hello from IronPython
  word.Quit()
 

 IronPython 2.0 has added support for interacting with OLE automation
 objects using the IDispatch interface. This completely eliminates the need
 for interop assemblies. This is the same mechanism that 
 VBAhttp://msdn2.microsoft.com/en-us/isv/bb190538.aspxlate-bound code and 
 also
 WSH http://msdn2.microsoft.com/en-us/library/9bbdkx3k.aspx use to
 interact with OLE automation object. This feature can currently be accessed
 using the -X:PreferComDispatch command line option. Here is an interactive
 session showing access to Word. There are no interop assemblies in the
 picture.

 c:\ipyd -X:PreferComDispatch
 IronPython 2.0 Beta (2.0.0.1000) on .NET 2.0.50727.1433
 Copyright (c) Microsoft Corporation. All rights reserved.
  import clr
  import System
  wordTypeLibGuid = System.Guid(00020905---C000-0046)
  clr.AddReferenceToTypeLibrary(wordTypeLibGuid)
  from Word import Application
  word = Application()
  word.Visible = True
  doc = word.Documents.Add()
  doc.Range().Text = Hello from IronPython
  word.Quit()
 

 The feature is not complete yet, and so is not currently (April 08)
 enabled by default. I cant say for sure when we will enable it by default,
 but its already quite stable for many real-world uses. We run all of our COM
 tests in both modes - using interop assemblies and using IDispatch. There
 are a few differences between the two cases in the minute details, but the
 mainline scenarios work well in both. This feature is implemented in the
 DLR, and so should be accessible from all DLR-based languages with little
 effort.



 Thanks,

 Shri

 Want to work on IronPython, IronRuby, 
 F#?http://blogs.msdn.com/ironpython

[IronPython] Late Binding in IronPython

2008-04-09 Thread Davy Mitchell
Hi List,

It seems odd posting here with my work hat on but here goes... :-) !!

I've been looking at using IronPython and COM to work with some COM objects
with VB6 (Project Compatibility - a *TOTAL* nightmare for interop).
In VB.net we get round this with CreateObject which works well though
somewhat limit.

Is –X:PreferComDispatch flag intended to be an equivalent for IronPython and
any other DLR languages? VBX?

Thanks,
Davy Mitchell

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] False? with Unit Test

2008-04-07 Thread Davy Mitchell
Thanks Dave. Doesn't impact me me right now so I won't vote :-) !!

On Mon, Apr 7, 2008 at 4:47 PM, Dave Fugate [EMAIL PROTECTED] wrote:

  Thanks for reporting this!  I believe we do already have an internal bug
 report on this, and I've now created a public bug on CodePlex (
 http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=15972) so
 it can be voted on.



 *From:* [EMAIL PROTECTED] [mailto:
 [EMAIL PROTECTED] *On Behalf Of *Curt Hagenlocher
 *Sent:* Saturday, April 05, 2008 10:16 AM
 *To:* Discussion of IronPython
 *Subject:* Re: [IronPython] False? with Unit Test



 It's the call to sys.exit that does this.

 There's a subtle difference between IronPython 2.0B1 and CPython 2.5 when
 sys.exit is called with a boolean parameter.  CPython doesn't print the
 value of the parameter if it's boolean, while IronPython does.  Presumably,
 CPython does this for backwards compatibility with a time when it didn't
 have a boolean data type. I'd guess that sys.exit(False) gets the same
 behavior as sys.exit(0) while sys.exit(True) is the same as sys.exit(1).
 But I haven't checked the CPython source to confirm that guess.

 On Sat, Apr 5, 2008 at 6:06 AM, Davy Mitchell [EMAIL PROTECTED]
 wrote:

 Hello List,

 Found a little funny on the latest IPY.

 import unittest

 class ATest(unittest.TestCase):
 def setUp(self):
 self.pop = 
 def test_blog(self):
 print test

 if __name__ == '__main__':
 unittest.main()

 Runs fine but under IPY there's a extra line with 'False' output:

 test
 .
 --
 Ran one test in 0.096s

 OK
 False

 Anyone had more experience with this module?

 Davy

 --
 Davy Mitchell
 Blog - http://www.latedecember.co.uk/sites/personal/davy/
 Twitter - http://twitter.com/daftspaniel
 Skype - daftspaniel http://needgod.com
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



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




-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] False? with Unit Test

2008-04-05 Thread Davy Mitchell
Hello List,

Found a little funny on the latest IPY.

import unittest

class ATest(unittest.TestCase):
def setUp(self):
self.pop = 
def test_blog(self):
print test

if __name__ == '__main__':
unittest.main()

Runs fine but under IPY there's a extra line with 'False' output:

test
.
--
Ran one test in 0.096s

OK
False

Anyone had more experience with this module?

Davy

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] URLLIB Issue

2008-04-04 Thread Davy Mitchell
Hello List,

Has this been covered before? Trailed Codeplex and mailing list :-)

import encodings
import twitter
api = twitter.Api()
statuses = api.GetPublicTimeline()
print [s.user.name for s in statuses]

Produces:

Traceback (most recent call last):
  File it.py, line 4, in Initialize
  File C:\Code\OSProjects\twitter.py, line 923, in GetPublicTimeline
  File C:\Code\OSProjects\twitter.py, line 1435, in _FetchUrl
  File C:\python25\lib\urllib2.py, line 381, in open
  File C:\python25\lib\urllib2.py, line 398, in _open
  File Snippets.debug, line unknown, in _call_chain
  File C:\python25\lib\urllib2.py, line 360, in _call_chain
  File C:\python25\lib\urllib2.py, line 1107, in http_open
  File C:\python25\lib\urllib2.py, line 1096, in do_open
TypeError: _fileobject() got an unexpected keyword argument 'close'

CPython works as expected.

Thanks,
Davy

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Snippets in Trackback

2008-03-30 Thread Davy Mitchell
Hi Curt,

Yeah the errors are pretty trivial to fix - usually XAML typos and the
.Net detail is fine to fix it. I was just a little confused about
Snippets in the traceback but no reference to my 'test.py' file.

A better example is the single line 'self.test' saved to to test2.py

python test2.py
C:\Code\OSProjectspython test2.py
Traceback (most recent call last):
  File test2.py, line 1, in module
self.test
NameError: name 'self' is not defined

ipy test2.py
C:\Code\OSProjectsipy test2.py
Traceback (most recent call last):
  File Snippets, line unknown, in Initialize
NameError: name 'self' is not defined

Cpython does a bit better there in callstack detail :-)

Davy

On Sun, Mar 30, 2008 at 12:41 PM, Curt Hagenlocher [EMAIL PROTECTED] wrote:
 This works for me once I fix the mismatched XML tag (and the mail-induced
 line breaks).  And when I don't, I get pretty explicit error messages as the
 text of the exception:

 SystemError: The 'DockPanel' start tag on line 4 does not match the end tag
 of 'DockPanelTest'. Line 5, position 3.
 -or-
 SyntaxError: EOL while scanning single-quoted string

 What was the exception that you were getting?


 On Sat, Mar 29, 2008 at 11:42 PM, Davy Mitchell [EMAIL PROTECTED]
 wrote:

  This has the desired effect:
 
  import clr
  clr.AddReference(System.Xml)
  clr.AddReference(PresentationFramework, Version=3.0.0.0,
  Culture=neutral, PublicKeyToken=31bf3856ad364e35)
  clr.AddReference(PresentationCore, Version=3.0.0.0, Culture=neutral,
  PublicKeyToken=31bf3856ad364e35)
  from System.IO import StringReader
  from System.Xml import XmlReader
  from System.Windows.Markup import XamlReader, XamlWriter
  from System.Windows import Window, Application
 
  xaml = 
  Window xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation;
 Title=Test Width=600 Height=400
  DockPanel
  /DockPanelTest
  /Window
  
 
  xr = XmlReader.Create(StringReader(xaml))
  win = XamlReader.Load(xr)
  Application().Run(win)
 
 
 
 
  On Sat, Mar 29, 2008 at 8:34 PM, Curt Hagenlocher [EMAIL PROTECTED]
 wrote:
   The snippets represent executable code that's generated dynamically by
 the
   DLR from your Python source.  Do you have a small piece of sample code
 that
   reproduces the failure?
  
  
  
   On Sat, Mar 29, 2008 at 1:28 PM, Davy Mitchell [EMAIL PROTECTED]
   wrote:
  
   
   
   
Hi All,
   
IPY2.0 B1 Vista SP1
   
I keep seeing reference to 'Snippets' in IP Tracebacks on different
bits of code. Can't find anything on codeplex so assume it *probably*
something wrong this end.
I don't have a 'Snippets' module AFAIK.
   
Typical example
C:\Code\OSProjectsipy wpf5.py
Traceback (most recent call last):
 File Snippets, line unknown, in Initialize
 File PresentationFramework, line unknown, in Load
   
Is it just me or :-)
   
--
   
   
   
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
   
  
  
   ___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
  
  
 
 
 
  --
 
 
 
  Davy Mitchell
  Blog - http://www.latedecember.co.uk/sites/personal/davy/
  Twitter - http://twitter.com/daftspaniel
  Skype - daftspaniel needgod.com
  ___
  Users mailing list
  Users@lists.ironpython.com
  http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
 


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





-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Slow Performance of CPython libs?

2008-02-21 Thread Davy Mitchell
On Thu, Feb 21, 2008 at 12:35 PM, Birsch [EMAIL PROTECTED] wrote:
 quite a few [python] exceptions during __init__. Does IronPython handle
 exceptions significantly slower than CPtyhon?

This has been my experience - I've worked round it by editing modules
to avoid nasty bits.
Not always practical but saved many seconds in my case.

Cheers,
Davy

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Bug Query - dict(...) broken on new style class dictionaries

2008-02-20 Thread Davy Mitchell
Hi Dino,

Will this bug make it to the next release?
http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=14501

Thanks,
Davy

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Bug Query - dict(...) broken on new style class dictionaries

2008-02-20 Thread Davy Mitchell
Thanks Dino! :-)

On Wed, Feb 20, 2008 at 9:38 PM, Dino Viehland
[EMAIL PROTECTED] wrote:
 Sure, I can fix that one at the same time I'm doing the other dictionary 
 stuff.



  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Davy Mitchell
  Sent: Wednesday, February 20, 2008 1:22 PM
  To: Discussion of IronPython
  Subject: [IronPython] Bug Query - dict(...) broken on new style class 
 dictionaries

  Hi Dino,

  Will this bug make it to the next release?
  http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=14501

  Thanks,
  Davy

  --
  Davy Mitchell
  Blog - http://www.latedecember.co.uk/sites/personal/davy/
  Twitter - http://twitter.com/daftspaniel
  Skype - daftspaniel needgod.com
  ___
  Users mailing list
  Users@lists.ironpython.com
  http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
  ___
  Users mailing list
  Users@lists.ironpython.com
  http://lists.ironpython.com/listinfo.cgi/users-ironpython.com




-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Encoding Issue with Hex

2008-01-07 Thread Davy Mitchell
Thanks for the workaround Seo :-)

On Jan 7, 2008 12:00 AM, Sanghyeon Seo [EMAIL PROTECTED] wrote:
 2008/1/7, Davy Mitchell [EMAIL PROTECTED]:
  There's a few encoding issues on CodePlex. Does this fall under one of them?
 
  IronPython console: IronPython 2.0A6 (2.0.11102.00) on .NET 2.0.50727.1433
  Copyright (c) Microsoft Corporation. All rights reserved.
   _BYTES = '7FF87FF0'.decode('hex')
  Traceback (most recent call last):
File , line 0, in ##233
  LookupError: unknown encoding: hex

 Yes. But import encodings should make hex encoding available.

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




-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel  needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] [python] Import Performance

2007-12-27 Thread Davy Mitchell
Hi All,

Okay had a go at narrowing down the issue - appears to be the 'import
compiler' line taking around 2 seconds. The importing seems pretty
fast - possibly the exceptions in IronPython being generated causing
the slowdown.

Here's the test code I used:
import sys
import datetime
print datetime.datetime.now()
try:
import antigravity
except ImportError:
pass
print datetime.datetime.now()
try:
import compiler
except ImportError:
print  Error \n, sys.exc_info()[0]
for line in sys.exc_info():
print line
print datetime.datetime.now()

CPython:
2007-12-27 17:35:57.279000
2007-12-27 17:35:57.284000
2007-12-27 17:35:57.316000

IronPython:
2007-12-27 17:37:59.502000
2007-12-27 17:37:59.528000
 Error
exceptions.ImportError
exceptions.ImportError
No module named parser
traceback object at 0x002B
2007-12-27 17:38:01.664000

Both cope with unknown modules fast but it appears the exception
condition causes the slowdown.

This is a common way for optional or preferred modules to be imported
so I would say this is probably an issue though not having worked on
anything large enough in IronPython to draw firm conclusions!! CPython
seems to be about 10 times faster importing modules from the various
benchmarks I have run.

Easy workaround for me is to remove the import from configobj - hurrah :-)

Cheers,
Davy

On Dec 26, 2007 9:56 PM, Michael Foord [EMAIL PROTECTED] wrote:
 Davy Mitchell wrote:
  I was curious as to why one of my apps was taking so long to start up.
  Sure it loaded up some RSS feeds but it shouldn't take *that* long.
  Anyway turns out to be 4-5 seconds importing configobj
 
  import datetime
  print datetime.datetime.now()
  from configobj import ConfigObj
  print datetime.datetime.now()
 
  Repeated with consistent results in seconds:
  IPY2.0  4.0 (A6 and A7)
  IPY1.1  1.9
  Cpython0.1
 
  Not a huge issue for me but for large apps, this could be quite
  significant for startup times.
 

 Can you benchmark which bits of the import take how much time?

 Michael

  Cheers,
  Davy
 
 

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




-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel  needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Import Performance

2007-12-26 Thread Davy Mitchell
I was curious as to why one of my apps was taking so long to start up.
Sure it loaded up some RSS feeds but it shouldn't take *that* long.
Anyway turns out to be 4-5 seconds importing configobj

import datetime
print datetime.datetime.now()
from configobj import ConfigObj
print datetime.datetime.now()

Repeated with consistent results in seconds:
IPY2.0  4.0 (A6 and A7)
IPY1.1  1.9
Cpython0.1

Not a huge issue for me but for large apps, this could be quite
significant for startup times.

Cheers,
Davy

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel  needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Difference in 1.1 and 2.0 with Dialog Result

2007-12-23 Thread Davy Mitchell
import clr
clr.AddReference('System.Windows.Forms')
from System.Windows.Forms import DialogResult
if DialogResult.OK:
print Boo!

The above prints Boo! in 1.1 and early 2.0 Alphas i.e. DialogResult.OK
resolves to TRUE.

A6 and A7 (didn't try any others!) nothing is printed i.e.
DialogResult.OK resolves to FALSE.

Now, I am changing my dialog code anyway but is this a deliberate change?

Cheers,
Davy

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel  needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] [python] Difference in 1.1 and 2.0 with Dialog Result

2007-12-23 Thread Davy Mitchell
Yes my initial code was flat wrong :-)

I was using
   if fbd.ShowDialog():
  etc...

For reference, the IPY1.1 result:
  bool(DialogResult.OK)
False
  DialogResult.OK.value__
1

 but it is still odd that this enumeration now evaluates to False.
Yes, very odd but I guess it is never safe to rely on the value of an enum.

Davy

On Dec 23, 2007 5:05 PM, Michael Foord [EMAIL PROTECTED] wrote:
 Davy Mitchell wrote:
  import clr
  clr.AddReference('System.Windows.Forms')
  from System.Windows.Forms import DialogResult
  if DialogResult.OK:
  print Boo!
 
  The above prints Boo! in 1.1 and early 2.0 Alphas i.e. DialogResult.OK
  resolves to TRUE.
 
  A6 and A7 (didn't try any others!) nothing is printed i.e.
  DialogResult.OK resolves to FALSE.
 
  Now, I am changing my dialog code anyway but is this a deliberate change?
 
 

 Hmm.. (IP2.0 A7)

   import clr
   clr.AddReference('System.Windows.Forms')
   from System.Windows.Forms import DialogResult
   bool(DialogResult.OK)
 False
   DialogResult.OK.value__
 1

 Odd.

 Of course the right thing to be doing is:

 if result == DialogResult.OK:

 but it is still odd that this enumeration now evaluates to False.

 Michael
 http://www.manning.com/foord
  Cheers,
  Davy
 
 

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




-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel  needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] IronPython 2.0 Alpha 7

2007-12-20 Thread Davy Mitchell
Thanks Dave - appreciate the hard work.

I have been using the module querypy.py (Attached) with previous releases.

Think I have found an issue in the latest release.


def __make_tag__(name, **kwargs):
  class tmp: pass
  tmp_dict = dict(Tag.__dict__)  # This is 232 the problem line.
  tmp.__name__ = name
---

Traceback (most recent call last):

  File ldservergui.py, line 8, in Initialize

  File , line 0, in _stub_##2

  File c:\Code\MN2\moodnews.py, line 9, in Initialize

  File , line 0, in _stub_##2

  File c:\Code\MN2\querypy.py, line 241, in Initialize

  File querypy, line unknown, in __make_tag__

  File c:\Code\MN2\querypy.py, line 232, in __make_tag__

NotImplementedError: The method or operation is not implemented.

On Dec 20, 2007 7:57 PM, Dave Fugate [EMAIL PROTECTED] wrote:




 Hello IronPython Community,



 Just in time for the holidays we have released IronPython 2.0 Alpha 7!
 There's been numerous changes to IronPython in the past month and a half.
 Most notably a lot of work has been done to get usage of the 'yield'
 statement compatible with CPython 2.5.  There might be a few more changes
 that need to be made, but by and far IP now adheres to PEP 342.  Another
 notable change brings the code closer to the new hosting API spec we
 published on this mailing list.  The next couple of releases should finish
 that work.



 After careful consideration of your valuable feedback we've determined that
 2.0A7 will be the last 2.0 release to be built and fully tested by us under
 Visual Studio 2005 tools.  Beginning with 2.0 Alpha 8, IronPython.sln
 (included in the source zip file) will be upgraded to VS 2008 format and we
 will only run our full test suite against binaries built from this.  The
 2005 version of IronPython.sln will then be deprecated although it will
 remain in the source zip file alongside IronPython.sln under the new name of
 IronPython2005.sln for some time.  At this point it's unclear whether we'll
 continue to update IronPython2005.sln.



 Last but not least, a number of bugs have been closed:

 10581 - Python25: Characters of hex values are uppercase in IP while they're
 lowercase in CPython 2.5

 8961 - Cannot run globals().keys() after accessing the dictionary keys
 method of a function

 12965 - __doc__ broken

 1689 - Raising attribute error from __getattr__ doesn't propagate out,
 instead we throw a new attribute error

 11491 - problem parsing conditional expression

 8074 - ipy hangs if imported namespaces contain numbers

 4716 - items = globals().items() in a module (not at console)

 10637 - Function object missing func_closure Closed

 6707 - Trivial: IronPython.Hosting.PythonEngine().Sys.prefix is set to None

 6770 - callable(__builtins__) has different results in ipy and Cpy

 3953 - Trivial: Can convert float infinity to long in IronPython

 11103 - Trivial: 'ipy.exe -c something' prints out the results of
 something to stdout

 10856 - __doc__ does not show up in dir() output on load (and has wrong
 contents)

 2267 - sys.winver missing?

 1352 - Trivial: Open paren at end-of-line raises SyntaxError in interactive
 console

 12141 - Microsoft.Scripting.MethodBinder.ToString()

 5446 - socket.getaddrinfo(...) proto parameter

 5757 - PythonFile is not thread-safe

 10474 - Need to ignore null paths in sys.path



 We'd like to thank everyone in the community who reported these to make a
 better release: Jan Szumiec, arman0, orbital56, Seo Sanghyeon, glchapman,
 tscottw, jacobg23, brucec, leppie, and Christopher Baus.



 You can download IronPython 2.0 Alpha 7 at:
 https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=IronPythonReleaseId=8189



 The IronPython Team





 IMPORTANT NOTES

 ToyScript, a small scripting language built on top of the DLR, is merely a
 DLR sample and not some new scripting language Microsoft has created.  Also,
 ToyScript is not intended to be distributed with IronPython on a permanent
 basis.
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com





-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel  needgod.com

* Copyright (c) 2007, Bjorn Kempen
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
  * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  * * Neither the name of Bjorn Kempen nor the
  *   names of its contributors may

Re: [IronPython] [python] Using IP with Idle

2007-10-17 Thread Davy Mitchell
Sorry if this shows up twice :-)

Komodo Edit should suit a Unix minded person - it has autocompletion,
strong macros and you can run a command shell interactively from within the
interface.

Cheers,
Davy Mitchell

On 10/17/07, Michael Foord [EMAIL PROTECTED] wrote:
 Allison Day wrote:
  I have been using python in a unix environment for years and am a
  complete noob to iron python, windows, and .net as of yesterday
  (GCK! says the Linux Guy :-) so please be patient.
 
  I was looking to use Idle with Ironpython but am not sure how to do
  this or if it can be done.  I saw a reference or two to Idle in the
  archives, but nothing concrete.  I've set the windows path to:
 
  C:\Program Files\activeTcl\bin;C:\Program Files\MTS
  793\ntbin;C:\Program Files\Common Files\MTS
  Shared;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\IronPython-1.1;
 
  I was reading a few IP articles and they mentioned setting the path,
  so I tried that and then importing System, but System isn't found.  I
  don't yet understand the relationship between CPython and IP, so maybe
  idle can't be used.  I want idle for the editing capabilities and so
  on that I'm used to using in the unix environment.
 
  So can Idle be used and if not, what else has the formatting that idle
  does?  One guy here using a regular text editor and runs a batch file,
  but I'm hoping for a little more interactive environment.  For
  licensing reasons, visual studio is a not an option for me at the
  moment but might be in the future.

 Well, you can edit IronPython code with IDLE - but I don't think you'll
 be able to run it.

 Keeping a command line window opening whilst editing with IDLE is pretty
 easy. Alternatively use a slightly more 'featured' editor that allows
 you to run files with an external command (most text editors will do
 this - plus it can be done with Python IDEs like SPE, Wing and probably
 Komodo).

 Michael
 http://www.manning.com/foord

 
  Again, I'm a complete Noob so forgive me if this question is too
  easy.  Thanks.
 
  A.D.
 
  __
  Do You Yahoo!?
  Tired of spam? Yahoo! Mail has the best spam protection around
  http://mail.yahoo.com
 
  
 
  ___
  Users mailing list
  Users@lists.ironpython.com
  http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
 

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



-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Announcement: Project to get some CPython C extensions running under IronPython

2007-10-16 Thread Davy Mitchell
  What would the issues be with NumPy - just the size of the API that

I was most concerned with data types (and converting) which for
statistical based computing needs to be exact. It is a great plus for
DotNet to have common types between languages. After working for years
in mixed VB6/C++ COM applications I really appreciate that :-)

Are Resolver Users looking to reuse their existing code in
spreadsheets or just have the same facilities? If the latter then SWIG
for Dotnet seems a better option than COM and is more Mono friendly.

Cheers,
Davy

On 10/15/07, Giles Thomas [EMAIL PROTECTED] wrote:

  Davy,

  What would the issues be with NumPy - just the size of the API that would
 have to be wrapped?  I must admin that my biggest concern with this would be
 getting everything running under Mono...


  Cheers,

  Giles


  Davy Mitchell wrote:
  On 10/12/07, Giles Thomas
 [EMAIL PROTECTED] wrote:


  Python and .NET, but also the existing CPython C extensions.

  Hi Giles,

 Sounds like a good idea and the approaches mentioned seemed solid.

 One strategy I was considering for a port of my Mood News site to
 Ironpython (but not tried yet!) is wrapping a CPython Lib into a COM
 object using the win32 stuff and getting it into .Net via the COM
 interop support.

 Maybe not practical for Numpy :-) Does have the advantage of not
 having to modify the original lib...

 Cheers,
 Davy



  --
 Giles Thomas
 MD  CTO, Resolver Systems Ltd.
 [EMAIL PROTECTED]
 +44 (0) 20 7253 6372

 We're hiring! http://www.resolversystems.com/jobs/

 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

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




-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] IP2A4 - Bug when Exception thrown on worker thread

2007-10-09 Thread Davy Mitchell
Hi - the following snippit crashes IP2A4.

import clr
from System.Threading import ApartmentState,Thread, ThreadStart

def Run():
print wibble

t = Thread(ThreadStart(Run))
t.ApartmentState = ApartmentState.STA
t.Start()
Thread.Sleep(9)

Unhandled Exception: Microsoft.Scripting.UnboundNameException: name 'wibble' is
not defined
   at IronPython.Runtime.PythonContext.MissingName(SymbolId name)
   at Microsoft.Scripting.ModuleGlobalWrapper.GetCachedValue()
   at Microsoft.Scripting.ModuleGlobalWrapper.get_CurrentValue()
   at __main__$mod_2.Run$1() in bug.py:line 5
   at _stub_##17(Object[] , DynamicSite`2 , CodeContext , Object )
   at Microsoft.Scripting.Actions.DynamicSite`2.UpdateBindingAndInvoke(CodeConte
xt context, T0 arg0)
   at Microsoft.Scripting.Actions.DynamicSiteHelpers.UninitializedTargetHelper`7
.Invoke1(DynamicSite`2 site, CodeContext context, T0 arg0)
   at Microsoft.Scripting.Actions.DynamicSite`2.Invoke(CodeContext context, T0 a
rg0)
   at System.Void(), using PythonBinder##9(Object[] )
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, C
ontextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] [python] IP2A4 - Bug when Exception thrown on worker thread

2007-10-09 Thread Davy Mitchell
Thanks Dino and Michael. Just remembered I had the opposite issue with
the WinForms Timer a while ago so I guess it makes sense :-) !

Looks like I should be something like...

import clr
from System.Threading import ApartmentState,Thread, ThreadStart

def Run():
try:
print wibble
except:
print phew!

t = Thread(ThreadStart(Run))
t.ApartmentState = ApartmentState.STA
t.Start()
Thread.Sleep(9)

Thanks,
Davy Mitchell

On 10/9/07, Dino Viehland [EMAIL PROTECTED] wrote:
 Well, just to be pedantic, in CPython you get:

  import clr
 Traceback (most recent call last):
   File stdin, line 1, in module
 ImportError: No module named clr
  from System.Threading import ApartmentState,Thread, ThreadStart
 Traceback (most recent call last):
   File stdin, line 1, in module
 ImportError: No module named System.Threading
 
  def Run():
 ... print wibble
 ...
  t = Thread(ThreadStart(Run))
 Traceback (most recent call last):
   File stdin, line 1, in module
 NameError: name 'Thread' is not defined
  t.ApartmentState = ApartmentState.STA
 Traceback (most recent call last):
   File stdin, line 1, in module
 NameError: name 'ApartmentState' is not defined
  t.Start()
 Traceback (most recent call last):
   File stdin, line 1, in module
 NameError: name 't' is not defined
  Thread.Sleep(9)
 Traceback (most recent call last):
   File stdin, line 1, in module
 NameError: name 'Thread' is not defined

 On the other hand if you do the same thing in both IronPython  CPython:

 import thread
 def Run():
 print wibble

 thread.start_new_thread(Run, ())

 you get the same results.

 This is because in .NET threads don't have a backstop for unhandled 
 exceptions (and it's generally considered a good thing, and a positive change 
 in v2.0 - this helps prevent unhandled exceptions from going unnoticed).  
 Obviously Python has made a different choice here (as did .NET v1.x) and so 
 we respect that choice when you use the standard Python functionality.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Foord
 Sent: Tuesday, October 09, 2007 12:07 PM
 To: Discussion of IronPython
 Subject: Re: [IronPython] [python] IP2A4 - Bug when Exception thrown on 
 worker thread

 Davy Mitchell wrote:
  Hi - the following snippit crashes IP2A4.
 

 It crashes 1.1 as well. We just kind of accepted that unhandled
 exceptions on threads cause app domain errors.

 In CPython it just raises an exception and terminates the thread.

 Michael
 http://www.manning.com/foord

  import clr
  from System.Threading import ApartmentState,Thread, ThreadStart
 
  def Run():
  print wibble
 
  t = Thread(ThreadStart(Run))
  t.ApartmentState = ApartmentState.STA
  t.Start()
  Thread.Sleep(9)
 
  Unhandled Exception: Microsoft.Scripting.UnboundNameException: name 
  'wibble' is
  not defined
 at IronPython.Runtime.PythonContext.MissingName(SymbolId name)
 at Microsoft.Scripting.ModuleGlobalWrapper.GetCachedValue()
 at Microsoft.Scripting.ModuleGlobalWrapper.get_CurrentValue()
 at __main__$mod_2.Run$1() in bug.py:line 5
 at _stub_##17(Object[] , DynamicSite`2 , CodeContext , Object )
 at 
  Microsoft.Scripting.Actions.DynamicSite`2.UpdateBindingAndInvoke(CodeConte
  xt context, T0 arg0)
 at 
  Microsoft.Scripting.Actions.DynamicSiteHelpers.UninitializedTargetHelper`7
  .Invoke1(DynamicSite`2 site, CodeContext context, T0 arg0)
 at Microsoft.Scripting.Actions.DynamicSite`2.Invoke(CodeContext context, 
  T0 a
  rg0)
 at System.Void(), using PythonBinder##9(Object[] )
 at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
 at System.Threading.ExecutionContext.Run(ExecutionContext 
  executionContext, C
  ontextCallback callback, Object state)
 at System.Threading.ThreadHelper.ThreadStart()
 
 

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



-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Import Now

2007-10-07 Thread Davy Mitchell
IronPython console: IronPython 2.0A4 (2.0.10904.02) on .NET 2.0.50727.312
Copyright (c) Microsoft Corporation. All rights reserved.
 from System.DateTime import Now
 print Now
07/10/2007 21:23:20
 print a few seconds later + Now.ToString()
a few seconds later07/10/2007 21:23:20
 from System.DateTime import Now
 print Now
07/10/2007 21:24:02


Huh?!??! :-)

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] [python] Import Now

2007-10-07 Thread Davy Mitchell
Yeah sounds reasonable but a little clunky :-)

Davy

On 10/7/07, Michael Foord [EMAIL PROTECTED] wrote:
 Davy Mitchell wrote:
  IronPython console: IronPython 2.0A4 (2.0.10904.02) on .NET 2.0.50727.312
  Copyright (c) Microsoft Corporation. All rights reserved.
 
  from System.DateTime import Now
  print Now
 
  07/10/2007 21:23:20
 
  print a few seconds later + Now.ToString()
 
  a few seconds later07/10/2007 21:23:20
 
  from System.DateTime import Now
  print Now
 
  07/10/2007 21:24:02
 
 
  Huh?!??! :-)
 
 

 That's kind of what I would expect. :-)

 Now is actually a (static) member of the DateTime class - but in .NET
 you can do this kind of import.

 DateTime instances are immutable - so accessing 'Now' returns the
 current one (which doesn't then change). When you import again you
 look-up the new current time.

 Just import DateTime and access 'Now' whenever you need it...

 Michael
 http://www.manning.com/foord
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] COM Interop - Dot net Interface Support in 2.0A4

2007-10-05 Thread Davy Mitchell
Sorry if I have missed this, but are COM Interfaces supported in
Interop? I guess this would be a DotNet interface at this stage?

import clr
clr.AddReferenceToFile(Interop.Microsoft.Feeds.Interop.dll)
from Microsoft.Feeds.Interop import *
t = FeedsManagerClass()
print t.RootFolder
u = t.RootFolder
print u
print u.TotalItemCount

results in

__ComObject object at 0x002B
__ComObject object at 0x002C

SystemError: Could not load type 'Feeds.IFeedFolder' from assembly
'Feeds, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

Thanks
Davy
-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Bug in Alpha4 with __class__.__name__ ?

2007-10-03 Thread Davy Mitchell
Thanks Dave - looking forward to the next release :-)

Davy

On 10/2/07, Dave Fugate [EMAIL PROTECTED] wrote:
 Thanks for the report Davy.  Looks like it's been fixed with some recent 
 changes in the last month (see below), but I'll be sure to add a test against 
 this.

 E:\ ipy
 IronPython console: IronPython 2.0 (2.0.0.00) on .NET 2.0.50727.1416
 Copyright (c) Microsoft Corporation. All rights reserved.
  import clr
  clr.AddReference(System.Windows.Forms)
  from System.Windows.Forms import *
  control = TextBox()
  print control.__class__.__name__
 TextBox
 

 Dave

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Davy Mitchell
 Sent: Tuesday, October 02, 2007 3:17 PM
 To: Discussion of IronPython
 Subject: [IronPython] Bug in Alpha4 with __class__.__name__ ?

 IronPython console: IronPython 2.0A4 (2.0.10904.02) on .NET 2.0.50727.31
 Copyright (c) Microsoft Corporation. All rights reserved.
  import clr
  clr.AddReference(System.Windows.Forms)
  from System.Windows.Forms import *
  control = TextBox()
  print control.__class__.__name__
 Traceback (most recent call last):
   File , line 0, in ##19
   File , line 0, in _stub_##21
 AttributeError: 'DynamicTypeTypeSlot' object has no attribute '__name__'

 IronPython console: IronPython 2.0A3 (2.0.10724.00) on .NET 2.0.50727.312
 Copyright (c) Microsoft Corporation. All rights reserved.
  import clr
  clr.AddReference(System.Windows.Forms)
  from System.Windows.Forms import *
  control = TextBox()
  print control.__class__.__name__
 TextBox

 Cheers,
 Davy

 --
 Davy Mitchell
 Blog - http://www.latedecember.co.uk/sites/personal/davy/
 Twitter - http://twitter.com/daftspaniel
 Skype - daftspaniel
 needgod.com
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] INI File For IronPython

2007-10-02 Thread Davy Mitchell
On 10/2/07, JoeSox [EMAIL PROTECTED] wrote:
 Feel free to look at pswrdgeniron (IronPython GUI for pswrdgen).
 http://www.codeproject.com/useritems/pswrdgeniron.asp
 The module opens itself and reads in the first few lines, which each
 setting is defined in order on a line.  I used format of
 VARNAME::value with the value encoded as a string so it is easy to
 split and assign to a self.VARNAME. From there it's easy to bridge to
 IronPython.

Interesting - reminds me of Pythoncard's resource file. Well a little :-)

 Why not just use ConfigObj ?

I am using ConfigObj :-) Just considering losing the CPython
dependency if there was a drop-in DotNet replacement...

Cheers,
Davy

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] [python] Re: INI File For IronPython

2007-10-02 Thread Davy Mitchell
On 10/2/07, Michael Foord [EMAIL PROTECTED] wrote:
 I mean that ConfigObj should work with IronPython - if it doesn't I'll
 fix it.

It is working great with IP :-)

Davy

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Bug in Alpha4 with __class__.__name__ ?

2007-10-02 Thread Davy Mitchell
IronPython console: IronPython 2.0A4 (2.0.10904.02) on .NET 2.0.50727.31
Copyright (c) Microsoft Corporation. All rights reserved.
 import clr
 clr.AddReference(System.Windows.Forms)
 from System.Windows.Forms import *
 control = TextBox()
 print control.__class__.__name__
Traceback (most recent call last):
  File , line 0, in ##19
  File , line 0, in _stub_##21
AttributeError: 'DynamicTypeTypeSlot' object has no attribute '__name__'

IronPython console: IronPython 2.0A3 (2.0.10724.00) on .NET 2.0.50727.312
Copyright (c) Microsoft Corporation. All rights reserved.
 import clr
 clr.AddReference(System.Windows.Forms)
 from System.Windows.Forms import *
 control = TextBox()
 print control.__class__.__name__
TextBox

Cheers,
Davy

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] INI File For IronPython

2007-10-01 Thread Davy Mitchell
Hey Folks,

Just wanted to pick a few brains...

I was working on storage for GUI applications using INI files and
CPython libs. I am looking to remove the dependency on Python 2 and do
it all in DotNet. However as far as I can see there is not direct
support for settings files - at least this is what I gather from all
the implementations on the web of various XML/registry solutions none
of which look too polished next to ConfigObj or the Python standard
lib.

How have other people solved this? Just need the basic name/value pair
to sart with.

Thanks,
Davy

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Newbie Q - Simple HTTP XML Capture?

2007-09-27 Thread Davy Mitchell
On 9/27/07, S C [EMAIL PROTECTED] wrote:
  What steps should I take to convert this to something working?

You can use the .Net webclient
example
 http://www.ironpython.info/index.php/Talking_Twitter

Cheers,
Davy

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Application?

2007-08-02 Thread Davy Mitchell
Thanks Dino.

Yes the Application does work but all the paths point to the
PythonConsoleHost folder name and version so are not much use.

The version and app name seem to be set in AssemblyInfo file in a VS
project. Is this achievable with IronPython?

Thanks,
Davy

On 8/2/07, Dino Viehland [EMAIL PROTECTED] wrote:
 This works for me:

  import System
  import clr
  clr.AddReference('System.Windows.Forms')
  from System.Windows.Forms import Application
  dir(Application)
 ['AddMessageFilter', 'AllowQuit', 'ApplicationExit', 'CommonAppDataPath', 
 'CommonAppDataRegistry', 'CompanyName', 'CurrentCulture', 
 'CurrentInputLanguage',
  'DoEvents', 'EnableVisualStyles', 'EnterThreadModal', 'Equals', 
 'ExecutablePath', 'Exit', 'ExitThread', 'FilterMessage', 'Finalize', 
 'GetHashCode', 'GetTy
 pe', 'Idle', 'LeaveThreadModal', 'LocalUserAppDataPath', 'MakeDynamicType', 
 'MemberwiseClone', 'MessageLoop', 'MessageLoopCallback', 'OleRequired', 
 'OnThre
 adException', 'OpenForms', 'ProductName', 'ProductVersion', 'RaiseIdle', 
 'Reduce', 'ReferenceEquals', 'RegisterMessageLoop', 'RemoveMessageFilter', 
 'Render
 WithVisualStyles', 'Restart', 'Run', 'SafeTopLevelCaptionFormat', 
 'SetCompatibleTextRenderingDefault', 'SetSuspendState', 
 'SetUnhandledExceptionMode', 'Sta
 rtupPath', 'ThreadException', 'ThreadExit', 'ToString', 
 'UnregisterMessageLoop', 'UseWaitCursor', 'UserAppDataPath', 
 'UserAppDataRegistry', 'VisualStyleSta
 te', '__class__', '__doc__', '__init__', '__module__', '__new__', 
 '__reduce__', '__reduce_ex__', '__repr__', 'add_ApplicationExit', 
 'add_EnterThreadModal',
  'add_Idle', 'add_LeaveThreadModal', 'add_ThreadException', 'add_ThreadExit', 
 'remove_ApplicationExit', 'remove_EnterThreadModal', 'remove_Idle', 'remove_L
 eaveThreadModal', 'remove_ThreadException', 'remove_ThreadExit']
  Application.CommonAppDataPath
 'C:\\ProgramData\\Microsoft\\IronPython\\1.1'
 






 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Davy Mitchell
 Sent: Wednesday, August 01, 2007 3:34 PM
 To: Discussion of IronPython
 Subject: [IronPython] Application?

 Is there a way to use the Application namespace in IronPython?

 Hoping to use methods like Application.CommonAppDataPath but they all
 seem assembly focussed?

 Thanks,
 Davy

 --
 Davy Mitchell
 Blog - http://www.latedecember.co.uk/sites/personal/davy/
 Twitter - http://twitter.com/daftspaniel
 Skype - daftspaniel
 needgod.com
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Application?

2007-08-02 Thread Davy Mitchell
Thanks Dino - didn't think it quite fitted the IronPython model.

Looks like I can get the path from Enviroment module.

from System import Environment
print Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)

Cheers,
Davy Mitchell

On 8/2/07, Dino Viehland [EMAIL PROTECTED] wrote:
 Ahh, I see.  It looks like this info ultimately comes from custom attributes 
 exposed off of Assembly.GetEntryAssembly().  Therefore w/ the VS SDK sample 
 (which I assume is where the VS side of things come in) and the IronPython 
 command line these are both going to reflect the hosting app.

 It would be theoretically possible to do this w/ the pyc sample and some 
 changes to the PythonCompiler class.  The PythonCompiler class would need to 
 expose the AssemblyGen object and set the appropriate custom attributes on it 
 via, something like:

 ag.myAssembly.SetCustomAttribute(new CustomAttributeBuilder(

 typeof(AssemblyInformationalVersionAttribute).GetConstructor(new 
 Type[]{typeof(string)}), 2.0)
);

 That has the downside of requiring you to compile your code (or at least your 
 main EXE).  But basically it looks like we have no good support for this 
 right now.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Davy Mitchell
 Sent: Thursday, August 02, 2007 1:05 AM
 To: Discussion of IronPython
 Subject: Re: [IronPython] Application?

 Thanks Dino.

 Yes the Application does work but all the paths point to the
 PythonConsoleHost folder name and version so are not much use.

 The version and app name seem to be set in AssemblyInfo file in a VS
 project. Is this achievable with IronPython?

 Thanks,
 Davy

 On 8/2/07, Dino Viehland [EMAIL PROTECTED] wrote:
  This works for me:
 
   import System
   import clr
   clr.AddReference('System.Windows.Forms')
   from System.Windows.Forms import Application
   dir(Application)
  ['AddMessageFilter', 'AllowQuit', 'ApplicationExit', 'CommonAppDataPath', 
  'CommonAppDataRegistry', 'CompanyName', 'CurrentCulture', 
  'CurrentInputLanguage',
   'DoEvents', 'EnableVisualStyles', 'EnterThreadModal', 'Equals', 
  'ExecutablePath', 'Exit', 'ExitThread', 'FilterMessage', 'Finalize', 
  'GetHashCode', 'GetTy
  pe', 'Idle', 'LeaveThreadModal', 'LocalUserAppDataPath', 'MakeDynamicType', 
  'MemberwiseClone', 'MessageLoop', 'MessageLoopCallback', 'OleRequired', 
  'OnThre
  adException', 'OpenForms', 'ProductName', 'ProductVersion', 'RaiseIdle', 
  'Reduce', 'ReferenceEquals', 'RegisterMessageLoop', 'RemoveMessageFilter', 
  'Render
  WithVisualStyles', 'Restart', 'Run', 'SafeTopLevelCaptionFormat', 
  'SetCompatibleTextRenderingDefault', 'SetSuspendState', 
  'SetUnhandledExceptionMode', 'Sta
  rtupPath', 'ThreadException', 'ThreadExit', 'ToString', 
  'UnregisterMessageLoop', 'UseWaitCursor', 'UserAppDataPath', 
  'UserAppDataRegistry', 'VisualStyleSta
  te', '__class__', '__doc__', '__init__', '__module__', '__new__', 
  '__reduce__', '__reduce_ex__', '__repr__', 'add_ApplicationExit', 
  'add_EnterThreadModal',
   'add_Idle', 'add_LeaveThreadModal', 'add_ThreadException', 
  'add_ThreadExit', 'remove_ApplicationExit', 'remove_EnterThreadModal', 
  'remove_Idle', 'remove_L
  eaveThreadModal', 'remove_ThreadException', 'remove_ThreadExit']
   Application.CommonAppDataPath
  'C:\\ProgramData\\Microsoft\\IronPython\\1.1'
  
 
 
 
 
 
 
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Davy Mitchell
  Sent: Wednesday, August 01, 2007 3:34 PM
  To: Discussion of IronPython
  Subject: [IronPython] Application?
 
  Is there a way to use the Application namespace in IronPython?
 
  Hoping to use methods like Application.CommonAppDataPath but they all
  seem assembly focussed?
 
  Thanks,
  Davy
 
  --
  Davy Mitchell
  Blog - http://www.latedecember.co.uk/sites/personal/davy/
  Twitter - http://twitter.com/daftspaniel
  Skype - daftspaniel
  needgod.com
  ___
  Users mailing list
  Users@lists.ironpython.com
  http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
  ___
  Users mailing list
  Users@lists.ironpython.com
  http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
 


 --
 Davy Mitchell
 Blog - http://www.latedecember.co.uk/sites/personal/davy/
 Twitter - http://twitter.com/daftspaniel
 Skype - daftspaniel
 needgod.com
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
___
Users mailing

[IronPython] Odd behaviour for unknown property

2007-08-02 Thread Davy Mitchell
Oh that subject line is clumsy

Is this a bug (2.0A3)?

import clr
clr.AddReference('System.Windows.Forms')

from System import *
from System.Windows.Forms import *

class LDForm(Form):
def __init__(self):
pass

#This reports an AttributeError the method as read only.
test = LDForm()
print test.Idontexist

#This reports an AttributeError method as not existing as expected.
test = Form()
print test.Idontexist

Not sure if this is related to using or subclassing .Net objects - its
just what I was using at the time.

Davy

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Application?

2007-08-01 Thread Davy Mitchell
Is there a way to use the Application namespace in IronPython?

Hoping to use methods like Application.CommonAppDataPath but they all
seem assembly focussed?

Thanks,
Davy

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Console

2007-05-30 Thread Davy Mitchell
For something a bit better than cmd, try
http://sourceforge.net/projects/console

Tabs, improve text selection, transparency and more.

Cheers,
Davy

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Bug?

2007-03-13 Thread Davy Mitchell
 On 1/5/07, Dino Viehland [EMAIL PROTECTED] wrote:
  The System.Timers.Timer class will swallow all exceptions from the timer
 causing this to happen (and apparently has no way to report those to the 
 user).

In case this helps other people with events in WinForms apps

I hit a similar situation to this when handling events from the web
browser control. To get the exceptions reported I simply put the
entire handler in a try/catch block and printed it/them out.

Cheers,
Davy

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] New IronPython Section

2007-02-05 Thread Davy Mitchell
On 12/30/06, J. Merrill [EMAIL PROTECTED] wrote:
  I too cannot get DNS to recognize www.latedecember.com  

Finally my website is back on line but the domain is .co.uk now.
http://www.latedecember.co.uk/sites/personal/davy/

RSS for IronPython section is now :
http://www.latedecember.co.uk/sites/personal/davy/IronPython_index.xml

Cheers,
Davy

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Mood News
 - BBC News Headlines Auto-Classified as   Good,   Bad or   Neutral.
 http://www.latedecember.co.uk/sites/moodnews/
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Bug?

2007-01-05 Thread Davy Mitchell
In the example below, hello is printed but there is no error for the
call on the non-existent method. Is this something to do with the
timer thread?

Cheers,
Davy

import clr
clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Drawing')

from System import *
from System.Drawing import *
from System.Drawing.Drawing2D import *
from System.Windows.Forms import Application, Button, Form, Label,
TextBox, FolderBrowserDialog, Timer, FormWindowState,
FormBorderStyle,ImageLayout, MenuStrip, ToolStripMenuItem,
ToolStripItem
from System.Timers import Timer

class ScreenForm(Form):

def __init__(self):
Form.__init__(self)
self.Change = Timer()
self.Change.Elapsed += self.ChangeTick
self.Change.Interval = 3000
self.Change.Enabled = True

def Closeform(self, s, e):
self.Change.Enabled = False
self.Close()

def ChangeTick(self, s, e):
print hello!
self.UpdatePicture()

Application.EnableVisualStyles()
form = ScreenForm()
Application.Run(form)

-- 
Davy Mitchell
Blog - http://www.latedecember.com/sites/personal/davy/
Mood News
 - BBC News Headlines Auto-Classified as   Good,   Bad or   Neutral.
 http://www.latedecember.com/sites/moodnews/
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] taylayout release

2007-01-03 Thread Davy Mitchell
Happy 2007 Everyone,

Early Developers Release Of TayLayout
http://code.google.com/p/taylayout/downloads/list

Unzip, cd to that dir and run slidenet.py or demo.py which are the
sample applications.
Some equally early docs exist at
http://docs.google.com/View?docid=dd59dk39_2jh3xf9

There's loads I want to do with this little module but would love some
feedback hence the early release. I have not tested yet on Mono.

Also sorry but my website/blog will be down for a while more. If
anyone else want to blog about this please do !! :-)

Cheers,
Davy Mitchell
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Do we have any option for Intellisense??

2006-12-06 Thread Davy Mitchell
SPE (free) handles IronPython fairly well.

Stani is having hosting problems so you may need to find a mirror site
somewhere.

Davy

-- 
Davy Mitchell
Blog - http://www.latedecember.com/sites/personal/davy/
Mood News
 - BBC News Headlines Auto-Classified as   Good,   Bad or   Neutral.
 http://www.latedecember.com/sites/moodnews/
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Subclassing a Control

2006-11-29 Thread Davy Mitchell
Thanks - got it working. Put the code snippet on my blog.
http://www.latedecember.com/sites/personal/davy/

class TransLabel(Control):
def __init__(self):
pass

def CreateParams(self):
cp = Label().CreateParams
cp.ExStyle = cp.ExStyle | 0x20
return cp
CreateParams = property(fget=CreateParams)

def OnPaintBackground(self,e):
pass

def OnPaint(self,e):
grfx = e.Graphics
grfx.DrawString(Hello World, self.Font, Brushes.Black, 0, 0)

Cheers,
Davy Mitchell

Blog - http://www.latedecember.com/sites/personal/davy/
Mood News
 - BBC News Headlines Auto-Classified as   Good,   Bad or   Neutral.
 http://www.latedecember.com/sites/moodnews/
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Subclassing a Control

2006-11-27 Thread Davy Mitchell
Hi Folks,

I was doing some IronPython for the first time in ages so forgive me
if I am being dumb :-)

Anyway I am trying to make a transparent label WinForm control:

class TransLabel(Label):

def CreateParams(self):
cp = super(TransLabel,self).CreateParams
cp.ExStyle = cp.ExStyle | 0x20
return cp

def OnPaintBackground(self,e):
pass

The problem is the super call fails with:
Traceback (most recent call last):
  File K:\MyDev\PyLP\helloWorld1.py, line 69, in Initialize
  File K:\MyDev\PyLP\helloWorld1.py, line 22, in __init__
  File , line 0, in DefaultNew##12
  File , line 0, in .ctor##26
  File System.Windows.Forms, line unknown, in .ctor
  File System.Windows.Forms, line unknown, in .ctor
TypeError: issubclass: arg 1 must be a class

line22 is only self.label = TransLabel()

Thanks and take care,
Davy Mitchell

-- 
Davy Mitchell
Blog - http://www.latedecember.com/sites/personal/davy/
Mood News
 - BBC News Headlines Auto-Classified as   Good,   Bad or   Neutral.
 http://www.latedecember.com/sites/moodnews/
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Accessing Win Form Properties

2005-10-04 Thread Davy Mitchell
Thanks Martin - I was mixing up the instance name.

Too busy looking at the output than my own code :-)

Regards,
Davy

On 10/4/05, Martin Maly [EMAIL PROTECTED] wrote:
 I suspect that the Form you are referencing is the
 System.Windows.Forms.Form class.
 Once you have instance, it should just work:

 f = Form()
 f.Text = Hi
 print f.Text

 I hope this helps
 Martin

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of
 Davy Mitchell
 Sent: Tuesday, October 04, 2005 11:31 AM
 To: users-ironpython.com@lists.ironpython.com
 Subject: [IronPython] Accessing Win Form Properties

 Hi Folks,

 Apologies if this is a FAQ but I couldn't find anything in the archives.

 I am writing a GUI Designer in IronPython.
  print Form.Text
  property# Text on Form

 I am probably missing something simple but how do I get the actual
 text/value of the property.

 Thanks,
 Davy Mitchell

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



--

Davy Mitchell

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