Re: [IronPython] codecs module in Silverlight

2009-12-14 Thread Dino Viehland
You could do:

import _codecs
def lookup_error(name):
raise LookupError('unknown error handler')
_codecs.lookup_error = lookup_error


This looks like we've just overly aggressively disabled some functionality
in Silverlight.  Maybe it used to depend upon something that wasn't available
but it doesn't look like it does anymore.  I've opened a bug:

http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=25673

It should be trivial to fix.

> -Original Message-
> From: users-boun...@lists.ironpython.com [mailto:users-
> boun...@lists.ironpython.com] On Behalf Of Lukas Cenovsky
> Sent: Monday, December 14, 2009 4:56 PM
> To: Discussion of IronPython
> Subject: [IronPython] codecs module in Silverlight
> 
> Hi all,
> I cannot import codecs module in Silverligh IronPython - it throws
> NameError for lookup_error method. The reason is this method is not in
> the _codecs module of Silverlight IronPython:
> 
> dir(_codecs) - Silverlight
> ['__doc__', '__name__', '__package__', 'ascii_decode', 'ascii_encode',
> 'charbuffer_encode', 'charmap_decode', 'charmap_encode', 'decode', 'encode',
> 'escape_decode', 'escape_encode', 'lookup', 'raw_unicode_escape_decode',
> 'raw_unicode_escape_encode', 'readbuffer_encode', 'register',
> 'unicode_escape_decode', 'unicode_escape_encode', 'unicode_internal_decode',
> 'unicode_internal_encode', 'utf_16_be_decode', 'utf_16_be_encode',
> 'utf_16_decode', 'utf_16_encode', 'utf_16_ex_decode', 'utf_16_le_decode',
> 'utf_16_le_encode', 'utf_8_decode', 'utf_8_encode']
> 
> dir(_codecs) - IronPython
> ['__doc__', '__name__', '__package__', 'ascii_decode', 'ascii_encode',
> 'charbuffer_encode', 'charmap_decode', 'charmap_encode', 'decode', 'encode',
> 'escape_decode', 'escape_encode', 'latin_1_decode', 'latin_1_encode',
> 'lookup',
> 'lookup_error', 'mbcs_decode', 'mbcs_encode', 'raw_unicode_escape_decode',
> 'raw_unicode_escape_encode', 'readbuffer_encode', 'register',
> 'register_error',
> 'unicode_escape_decode', 'unicode_escape_encode', 'unicode_internal_decode',
> 'unicode_internal_encode', 'utf_16_be_decode', 'utf_16_be_encode',
> 'utf_16_decode', 'utf_16_encode', 'utf_16_ex_decode', 'utf_16_le_decode',
> 'utf_16_le_encode', 'utf_32_decode', 'utf_32_encode', 'utf_32_ex_decode',
> 'utf_32_le_decode', 'utf_32_le_encode', 'utf_7_decode', 'utf_7_encode',
> 'utf_8_decode', 'utf_8_encode']
> 
> Any idea how to make it work? Thanks.
> 
> --
> -- Lukáš
> 
> ___
> 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] codecs module in Silverlight

2009-12-14 Thread Lukas Cenovsky

Hi all,
I cannot import codecs module in Silverligh IronPython - it throws 
NameError for lookup_error method. The reason is this method is not in 
the _codecs module of Silverlight IronPython:


dir(_codecs) - Silverlight
['__doc__', '__name__', '__package__', 'ascii_decode', 'ascii_encode',
'charbuffer_encode', 'charmap_decode', 'charmap_encode', 'decode', 'encode',
'escape_decode', 'escape_encode', 'lookup', 'raw_unicode_escape_decode',
'raw_unicode_escape_encode', 'readbuffer_encode', 'register',
'unicode_escape_decode', 'unicode_escape_encode', 'unicode_internal_decode',
'unicode_internal_encode', 'utf_16_be_decode', 'utf_16_be_encode',
'utf_16_decode', 'utf_16_encode', 'utf_16_ex_decode', 'utf_16_le_decode',
'utf_16_le_encode', 'utf_8_decode', 'utf_8_encode']

dir(_codecs) - IronPython
['__doc__', '__name__', '__package__', 'ascii_decode', 'ascii_encode',
'charbuffer_encode', 'charmap_decode', 'charmap_encode', 'decode', 'encode',
'escape_decode', 'escape_encode', 'latin_1_decode', 'latin_1_encode', 
'lookup',

'lookup_error', 'mbcs_decode', 'mbcs_encode', 'raw_unicode_escape_decode',
'raw_unicode_escape_encode', 'readbuffer_encode', 'register', 
'register_error',

'unicode_escape_decode', 'unicode_escape_encode', 'unicode_internal_decode',
'unicode_internal_encode', 'utf_16_be_decode', 'utf_16_be_encode',
'utf_16_decode', 'utf_16_encode', 'utf_16_ex_decode', 'utf_16_le_decode',
'utf_16_le_encode', 'utf_32_decode', 'utf_32_encode', 'utf_32_ex_decode',
'utf_32_le_decode', 'utf_32_le_encode', 'utf_7_decode', 'utf_7_encode',
'utf_8_decode', 'utf_8_encode']

Any idea how to make it work? Thanks.

--
-- Lukáš

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


Re: [IronPython] IronPython 2.6 final and net 4

2009-12-14 Thread Dino Viehland
Yes - we've got previews of this already in the form of our IronPython 2.6 CTP 
for .NET 4.0 Beta 2 (and previously beta 1 release).  We are continuing to 
update 2.6 for better .NET 4.0 compatbility and the plan is to ship a 2.6.x 
release in both .NET 2.0 and .NET 4.0 flavors around when .NET 4.0 ships.

From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of Keith J. Farmer
Sent: Monday, December 14, 2009 10:45 AM
To: Discussion of IronPython; Discussion of IronPython
Subject: Re: [IronPython] IronPython 2.6 final and net 4

Is a refresh planned for .NET 4 RTM that won't require the 2.x CLR be installed?


From: users-boun...@lists.ironpython.com on behalf of Dino Viehland
Sent: Mon 12/14/2009 9:57 AM
To: Discussion of IronPython
Subject: Re: [IronPython] IronPython 2.6 final and net 4
Do you have .NET 2.0 installed as well as .NET 4.0?  .NET 2.0 and .NET 4.0 are 
side by side releases.  While IronPython built for .NET 2.0 would probably run 
fine on .NET 4.0 we haven't done any testing to make sure that's the case.  
Additionally it would cause a lot of confusion because we have been putting out 
.NET 4.0 compatible releases which use new functionality that we usually ship 
as part of IronPython (Microsoft.Scripting.Core - the portions of the DLR 
shipping in .NET 4.0). Therefore lots of people would probably try and use 
C#/VB.NET's new dynamic support to talk to IronPython and it would fail but it 
wouldn't be entirely obvious why it's not working.

You should just be able to install .NET 2.0 SP1 in addition to 4.0 and things 
should work.

.NET 4.0 is certainly a later version and that's why the message explicitly 
calls out that .NET 4.0 isn't supported :)  It means later in the 2.0/3.0/3.5 
series of runtimes which are all in place upgrades.

From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of David Waller
Sent: Monday, December 14, 2009 9:47 AM
To: users@lists.ironpython.com
Subject: [IronPython] IronPython 2.6 final and net 4

Hello,
I have been using earlier versions of IronPython 2.6 (not sure exactly which 
version) without any major issues. I have recently tried to install the latest 
2.6 final and it complains about "requires .NET Framework 2.0 SP1 or later. NET 
4.0 is not supported". I have installed .NET 4.0 as part of the Visual express 
2010 software. Is there any way I can convince IronPython to update itself 
without uninstalling the visual express software.
Also isn't .NET 4.0 a later version of .NET 2.0

Thanks
David Waller

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


Re: [IronPython] IronPython 2.6 final and net 4

2009-12-14 Thread Keith J. Farmer
Is a refresh planned for .NET 4 RTM that won't require the 2.x CLR be installed?



From: users-boun...@lists.ironpython.com on behalf of Dino Viehland
Sent: Mon 12/14/2009 9:57 AM
To: Discussion of IronPython
Subject: Re: [IronPython] IronPython 2.6 final and net 4



Do you have .NET 2.0 installed as well as .NET 4.0?  .NET 2.0 and .NET 4.0 are 
side by side releases.  While IronPython built for .NET 2.0 would probably run 
fine on .NET 4.0 we haven't done any testing to make sure that's the case.  
Additionally it would cause a lot of confusion because we have been putting out 
.NET 4.0 compatible releases which use new functionality that we usually ship 
as part of IronPython (Microsoft.Scripting.Core - the portions of the DLR 
shipping in .NET 4.0). Therefore lots of people would probably try and use 
C#/VB.NET's new dynamic support to talk to IronPython and it would fail but it 
wouldn't be entirely obvious why it's not working.

 

You should just be able to install .NET 2.0 SP1 in addition to 4.0 and things 
should work.

 

.NET 4.0 is certainly a later version and that's why the message explicitly 
calls out that .NET 4.0 isn't supported J  It means later in the 2.0/3.0/3.5 
series of runtimes which are all in place upgrades.

 

From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of David Waller
Sent: Monday, December 14, 2009 9:47 AM
To: users@lists.ironpython.com
Subject: [IronPython] IronPython 2.6 final and net 4

 

Hello,

I have been using earlier versions of IronPython 2.6 (not sure exactly which 
version) without any major issues. I have recently tried to install the latest 
2.6 final and it complains about "requires .NET Framework 2.0 SP1 or later. NET 
4.0 is not supported". I have installed .NET 4.0 as part of the Visual express 
2010 software. Is there any way I can convince IronPython to update itself 
without uninstalling the visual express software. 

Also isn't .NET 4.0 a later version of .NET 2.0

 

Thanks

David Waller

 

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


Re: [IronPython] IronPython 2.6 final: Debugging not working?

2009-12-14 Thread Dino Viehland
I'll have to look into this and get back to you - hopefully I can figure
it out on my side.  There were some threading issues in Beta 2 I believe 
and I thought they were all fixed but maybe there's still something 
lingering.

> -Original Message-
> From: users-boun...@lists.ironpython.com [mailto:users-
> boun...@lists.ironpython.com] On Behalf Of Joshua Kramer
> Sent: Sunday, December 13, 2009 8:32 PM
> To: users@lists.ironpython.com
> Subject: Re: [IronPython] IronPython 2.6 final: Debugging not working?
> 
> 
> Dino,
> 
> This actually appears to be a threading issue.  While I was filing a bug
> report for PyDev I did further testing.  In three debugging sessions, two
> sessions worked fine with full debugging and one session skipped the
> breakpoints.  Here's a relevant debug log:
> 
> This is where it DOES work:
> 
> pydev debugger: starting
> ('Executing file ', 'C:\\Documents and
> Settings\\Joshua.Kramer\\workspace\\DebugTest\\src\\Program.py')
> ('arguments:', "['C:Documents and
> SettingsJoshua.KramerworkspaceDebugTestsrcProgram.py']")
> ('Connecting to ', 'localhost', ':', '3416')
> ('Connected.',)
> ('received command ', '501\t1\t1.1')
> ('received command ', '111\t3\tC:\\Documents and
> Settings\\Joshua.Kramer\\workspace\\DebugTest\\src\\Program.py\t10\t**FUNC**\t
> None')
> sending cmd: CMD_THREAD_CREATE 1032name="pydevd.reader" id="-1"/>
> 
> sending cmd: CMD_VERSION 501  1   1.1
> 
> sending cmd: CMD_THREAD_CREATE 1034name="pydevd.writer" id="-1"/>
> 
> Added breakpoint:c:\documents and
> settings\joshua.kramer\workspace\debugtest\src\program.py - line:10 -
> func_name:
> ('received command ', '101\t5\t')
> hello
> lightbulb
> ('found a new thread ', 'pid264_seq1')
> sending cmd: CMD_THREAD_CREATE 1036name="MainThread" id="pid264_seq1" />
> 
> sending cmd: CMD_THREAD_SUSPEND 105   8id="pid264_seq1" stop_reason="111"> name="%26lt%3Bmodule%26gt%3B" file="c%253A%255Cdocuments and
> settings%255Cjoshua.kramer%255Cworkspace%255Cdebugtest%255Csrc%255Cprogram.py"
> line="10">"
> 
> ('received command ', '114\t7\tpid264_seq1\t43\tFRAME')
> ('processing internal command ', ' at 0x002C>')
> sending cmd: CMD_GET_FRAME 1147name="%24globalContext"
> type="CodeContext" value="CodeContext%253A
> %253CIronPython.Runtime.CodeContext object at 0x002D
> %255BIronPython.Runtime.CodeContext%255D%26gt%3B" isContainer="True"
> />%0A%0A name="functionCode" type="code" value="code%253A %253Ccode object at
> 0x002E%26gt%3B" isContainer="True" />%0A
> 
> This is where it does NOT work:
> 
> pydev debugger: starting
> ('Executing file ', 'C:\\Documents and
> Settings\\Joshua.Kramer\\workspace\\DebugTest\\src\\Program.py')
> ('arguments:', "['C:Documents and
> SettingsJoshua.KramerworkspaceDebugTestsrcProgram.py']")
> ('Connecting to ', 'localhost', ':', '3422')
> ('Connected.',)
> ('received command ', '501\t1\t1.1')
> ('received command ', '111\t3\tC:\\Documents and
> Settings\\Joshua.Kramer\\workspace\\DebugTest\\src\\Program.py\t10\t**FUNC**\t
> None')
> sending cmd: CMD_THREAD_CREATE 1032name="pydevd.reader" id="-1"/>
> 
> sending cmd: CMD_VERSION 501  1   1.1
> 
> sending cmd: CMD_THREAD_CREATE 1034name="pydevd.writer" id="-1"/>
> 
> Added breakpoint:c:\documents and
> settings\joshua.kramer\workspace\debugtest\src\program.py - line:10 -
> func_name:
> ('received command ', '101\t5\t')
> hello
> lightbulb
> goodbye
> gobble
> done testing
> 
> How can I further assist?
> 
> Thanks,
> -Josh
> 
> --
> 
> -
> http://www.globalherald.net/jb01
> GlobalHerald.NET, the Smarter Social Network! (tm)
> ___
> 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] Users Digest, Vol 65, Issue 16

2009-12-14 Thread Dino Viehland
Unfortunately it didn't get fixed for 2.6 but we're planning on fixing that for 
2.6.1.

From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of David Welden
Sent: Monday, December 14, 2009 9:00 AM
To: users@lists.ironpython.com
Subject: Re: [IronPython] Users Digest, Vol 65, Issue 16

Any news on work item 25106: ctypes: no support for Union? ctypes is not really 
done if unions are unsupported.

  1.  [ANN]: IronPython 2.6 final (Dino Viehland)

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


Re: [IronPython] IronPython 2.6 final and net 4

2009-12-14 Thread Dino Viehland
Do you have .NET 2.0 installed as well as .NET 4.0?  .NET 2.0 and .NET 4.0 are 
side by side releases.  While IronPython built for .NET 2.0 would probably run 
fine on .NET 4.0 we haven't done any testing to make sure that's the case.  
Additionally it would cause a lot of confusion because we have been putting out 
.NET 4.0 compatible releases which use new functionality that we usually ship 
as part of IronPython (Microsoft.Scripting.Core - the portions of the DLR 
shipping in .NET 4.0). Therefore lots of people would probably try and use 
C#/VB.NET's new dynamic support to talk to IronPython and it would fail but it 
wouldn't be entirely obvious why it's not working.

You should just be able to install .NET 2.0 SP1 in addition to 4.0 and things 
should work.

.NET 4.0 is certainly a later version and that's why the message explicitly 
calls out that .NET 4.0 isn't supported :)  It means later in the 2.0/3.0/3.5 
series of runtimes which are all in place upgrades.

From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of David Waller
Sent: Monday, December 14, 2009 9:47 AM
To: users@lists.ironpython.com
Subject: [IronPython] IronPython 2.6 final and net 4

Hello,
I have been using earlier versions of IronPython 2.6 (not sure exactly which 
version) without any major issues. I have recently tried to install the latest 
2.6 final and it complains about "requires .NET Framework 2.0 SP1 or later. NET 
4.0 is not supported". I have installed .NET 4.0 as part of the Visual express 
2010 software. Is there any way I can convince IronPython to update itself 
without uninstalling the visual express software.
Also isn't .NET 4.0 a later version of .NET 2.0

Thanks
David Waller

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


[IronPython] IronPython 2.6 final and net 4

2009-12-14 Thread David Waller
Hello,

I have been using earlier versions of IronPython 2.6 (not sure exactly which
version) without any major issues. I have recently tried to install the
latest 2.6 final and it complains about "requires .NET Framework 2.0 SP1 or
later. NET 4.0 is not supported". I have installed .NET 4.0 as part of the
Visual express 2010 software. Is there any way I can convince IronPython to
update itself without uninstalling the visual express software. 

Also isn't .NET 4.0 a later version of .NET 2.0

 

Thanks

David Waller

 

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


Re: [IronPython] Users Digest, Vol 65, Issue 16

2009-12-14 Thread David Welden
Any news on work item 25106: ctypes: no support for Union? ctypes is not
really done if unions are unsupported.

  1.  [ANN]: IronPython 2.6 final (Dino Viehland)

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


[IronPython] IronPython 2.6 CodePlex Source Update

2009-12-14 Thread merllab
This is an automated email letting you know that sources 
have recently been pushed out.  You can download these newer 
sources directly from 
http://ironpython.codeplex.com/SourceControl/changeset/view/62266.

ADDED SOURCES

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting.Core/Actions/IInvokeOnGetBinder.cs

MODIFIED SOURCES

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting.Core/Actions/IInvokeOnGetBinder.cs

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting.Core/Compiler/ConstantCheck.cs

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting.Core/Compiler/ILGen.cs

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting.Core/Ast/TypeUtils.cs

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting.Core/Actions/DynamicObject.cs



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


Re: [IronPython] from __future__ import ...

2009-12-14 Thread Lukas Cenovsky
I've found the catch - the __future__.py module is in ironpython\lib 
folder which is automatically added to path by ipy.exe - that's why it 
worked from interpreter but not from the ScriptEngine.


--
-- Lukáš

Michael Foord wrote:
__future__ is a standard library module that must be on the path in 
order to do future imports. You must put the directory containing this 
module (or preferably all the standard library) into sys.path before 
importing it.


The ScriptRuntime or ScriptEngine has a SetSearchPaths method that 
allows you to do this from C#.


All the best,

Michael Foord

On 14/12/2009 10:18, Lukas Cenovsky wrote:

Hi,
I've found that the from __future__ import ... works in .py file run 
by ipy.exe but not when I create an engine in C#.


test.py:

from __future__ import division
print 'done'

test.cs:

using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;
using IronPython.Hosting;

namespace TestDuture
{
   public class Test
   {
   static void Main(string[] args)
   {
   ScriptEngine engine = Python.CreateEngine();
   ScriptRuntime runtime = engine.Runtime;
   ScriptScope scope = runtime.CreateScope();
   ScriptSource source = 
engine.CreateScriptSourceFromFile("test.py");

   source.Execute(scope);
   }
   }
}

build command:

csc /r:Microsoft.Dynamic.dll /r:Microsoft.Scripting.core.dll 
/r:Microsoft.Scripting.dll /r:IronPython.dll 
/r:IronPython.Modules.dll test.cs


Running test.exe throws exception:

C:\Users\dev\Documents\FutureTest>test.exe

Unhandled Exception: IronPython.Runtime.Exceptions.ImportException: 
No module named __future__
  at 
Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] 
args, Boolean& shouldOptimize)
  at 
IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`5.Call4(CallSite 
site, CodeContext context, TFuncType func, T0 arg0, T1 arg1, T2 arg2, 
T3 arg3)
  at 
System.Dynamic.UpdateDelegates.UpdateAndExecute6[T0,T1,T2,T3,T4,T5,TRet](CallSite 
site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
  at IronPython.Runtime.Importer.Import(CodeContext context, String 
fullName, PythonTuple from, Int32 level)
  at 
IronPython.Runtime.Operations.PythonOps.ImportWithNames(CodeContext 
context, String fullName, String[] names, Int32 level)
  at Microsoft.Scripting.Utils.InvokeHelper`5.Invoke(Object arg0, 
Object arg1, Object arg2, Object arg3)

  at Microsoft.Scripting.Utils.ReflectedCaller.Invoke(Object[] args)
  at 
Microsoft.Scripting.Interpreter.CallInstruction.Run(InterpretedFrame 
frame)
  at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame 
frame)
  at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 
arg0, T1 arg1)

  at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
  at IronPython.Compiler.PythonScriptCode.Run(Scope scope)
  at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
  at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope)
  at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink 
errorSink)

  at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)
  at TestDuture.Test.Main(String[] args)

Am I missing something? It works ok when I add __future__.py from 
Python 2.6.


--
-- Lukáš

___
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] from __future__ import ...

2009-12-14 Thread Michael Foord
__future__ is a standard library module that must be on the path in 
order to do future imports. You must put the directory containing this 
module (or preferably all the standard library) into sys.path before 
importing it.


The ScriptRuntime or ScriptEngine has a SetSearchPaths method that 
allows you to do this from C#.


All the best,

Michael Foord

On 14/12/2009 10:18, Lukas Cenovsky wrote:

Hi,
I've found that the from __future__ import ... works in .py file run 
by ipy.exe but not when I create an engine in C#.


test.py:

from __future__ import division
print 'done'

test.cs:

using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;
using IronPython.Hosting;

namespace TestDuture
{
   public class Test
   {
   static void Main(string[] args)
   {
   ScriptEngine engine = Python.CreateEngine();
   ScriptRuntime runtime = engine.Runtime;
   ScriptScope scope = runtime.CreateScope();
   ScriptSource source = 
engine.CreateScriptSourceFromFile("test.py");

   source.Execute(scope);
   }
   }
}

build command:

csc /r:Microsoft.Dynamic.dll /r:Microsoft.Scripting.core.dll 
/r:Microsoft.Scripting.dll /r:IronPython.dll /r:IronPython.Modules.dll 
test.cs


Running test.exe throws exception:

C:\Users\dev\Documents\FutureTest>test.exe

Unhandled Exception: IronPython.Runtime.Exceptions.ImportException: No 
module named __future__
  at 
Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] 
args, Boolean& shouldOptimize)
  at 
IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`5.Call4(CallSite 
site, CodeContext context, TFuncType func, T0 arg0, T1 arg1, T2 arg2, 
T3 arg3)
  at 
System.Dynamic.UpdateDelegates.UpdateAndExecute6[T0,T1,T2,T3,T4,T5,TRet](CallSite 
site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
  at IronPython.Runtime.Importer.Import(CodeContext context, String 
fullName, PythonTuple from, Int32 level)
  at 
IronPython.Runtime.Operations.PythonOps.ImportWithNames(CodeContext 
context, String fullName, String[] names, Int32 level)
  at Microsoft.Scripting.Utils.InvokeHelper`5.Invoke(Object arg0, 
Object arg1, Object arg2, Object arg3)

  at Microsoft.Scripting.Utils.ReflectedCaller.Invoke(Object[] args)
  at 
Microsoft.Scripting.Interpreter.CallInstruction.Run(InterpretedFrame 
frame)
  at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame 
frame)
  at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 
arg0, T1 arg1)

  at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
  at IronPython.Compiler.PythonScriptCode.Run(Scope scope)
  at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
  at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope)
  at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink 
errorSink)

  at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)
  at TestDuture.Test.Main(String[] args)

Am I missing something? It works ok when I add __future__.py from 
Python 2.6.


--
-- Lukáš

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



--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog


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


Re: [IronPython] [ANN]: IronPython 2.6 final

2009-12-14 Thread Giles Thomas
Congratulations! 

We have a release of Resolver One based on IronPython 2.6 that is almost 
ready to go, and hope to get that into beta shortly.




Dino Viehland wrote:


Hello Python Community,

We're proud to announce the release of IronPython 2.6 final.  This is 
a major release with improvements across all areas of IronPython and 
can be downloaded from 
http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=12482.  
Significant changes include:


· Updating the language and standard library to match CPython 2.6

· Improved .NET integration

· Updating to the latest version of the DLR

· Adding previously missing CPython features and fixing bugs

· Performance improvements in particular startup time improvements

Python 2.6 support includes a large number of new features which 
include support for the new bytes and byte array types (PEP 3112 
), decorators for classes 
(PEP 3129 ), advanced string 
formatting (PEP 3101 ) which 
will feel familiar to .NET users and integrates nicely with 
IFormattable, print as a function (PEP 3105 
), Abstract Base Classes 
(PEP 3119 ), support for 
binary literals, along with lots of other minor features and changes.


IronPython also continues to improve .NET integration in this 
release.  We've added the __clrtype__ method 
 
to types which enables deep integration via meta-classes with the .NET 
type system.  There are also a number of smaller changes such as 
supporting IDisposable in for loops 
 
matching the behavior of other .NET languages.  This release also 
includes the latest version of the DLR and fixes a number of issues 
related to cross-language dynamic interop.  Not to be left out there's 
improvements in Silverlight integration by supporting Python code in 
HTML script tags .


We've also continued to improve Python compatibility by adding missing 
features and fixing bugs.  In this release we've added support for the 
ctypes  module which 
provides interop with native code in a compatible way across Python 
implementations.  We've also implemented sys.settrace to provide 
support for the pdb  module 
and other Python debuggers.  This release also changes how we support 
sys._getframe: a fully working version is now available by a command 
line option;  when not enabled sys._getframe doesn't exist at all. 
This release also fixes over 400 bugs removing a large number of 
smaller incompatibilities.


As always we've also continued to improve performance, and this 
release primarily focuses on improving startup time.  The IronPython 
installer now pre-compiles (ngens) IronPython during installation on 
both 32-bit and 64-bit platforms.  Modules are now interpreted 
initially and hot functions are compiled for faster import times.  A 
number of other code paths that used to involve runtime code 
generation have been optimized to be contained within the pre-compiled 
IronPython binaries.  We've also made a number of smaller changes 
which improve performance in other areas such as adding constant folding.


Finally we'd like to thank everyone who reported issues and helped 
make this a better release:  Anders M. Mikkelsen, Dan Eloff, Zachc, 
yamakox, vernondcole, VAks, tscottw, tonyandrewmeyer, tomwright, 
TomasMatousek, tkamiya, timers, srivatsn, sopeajw, saveenr, sanxiyn, 
rridge, ronniemaor, quirogaco, pythonfoo, pysunil, pm100, pl6306, 
paulfelix, orestis, olegt, oldman, NDHUMuscle, mycall, mmaly, 
mmacdonaldssfcu, maplpro, luntain, llaske, lbaker, Lawouach, laurionb, 
laughingboy, kurhan, kuno, kowenswp, klrohe, kevgu, jmesserly, 
jlunder, jdhardy, jbevain, jackeyoo, hhonisch, gz, gjones, fwereade, 
deadalusai, daveremy, Seo Sanghyeon, CurtHagenlocher, chaghi, 
cgravill, cartman, bobarnso, atifaziz, ashcor, alvanet, Helmut, 
fuzzyman, fabiofz, Eloff, RuiDC, Kevin Chu, Kyle Howland-Rose egonw, 
davec, dungen, dsblank, cjacobs, dmajnemer, leppie, Mark Rees, 
soulfry, tatwright, ufechner and wilberforce.


Thank you for your continued support of IronPython.

The IronPython Team

 




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


--
Giles Thomas
giles.tho...@resolversystems.com
+44 (0) 20 7253 6372

17a Clerkenwell Road, London EC1M 5RD, UK
VAT No.: GB 893 5643 79
Registered in England and Wales as company number 5467329.
Registe

[IronPython] from __future__ import ...

2009-12-14 Thread Lukas Cenovsky

Hi,
I've found that the from __future__ import ... works in .py file run by 
ipy.exe but not when I create an engine in C#.


test.py:

from __future__ import division
print 'done'

test.cs:

using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;
using IronPython.Hosting;

namespace TestDuture
{
   public class Test
   {
   static void Main(string[] args)
   {
   ScriptEngine engine = Python.CreateEngine();
   ScriptRuntime runtime = engine.Runtime;
   ScriptScope scope = runtime.CreateScope();
   ScriptSource source = 
engine.CreateScriptSourceFromFile("test.py");

   source.Execute(scope);
   }
   }
}

build command:

csc /r:Microsoft.Dynamic.dll /r:Microsoft.Scripting.core.dll 
/r:Microsoft.Scripting.dll /r:IronPython.dll /r:IronPython.Modules.dll 
test.cs


Running test.exe throws exception:

C:\Users\dev\Documents\FutureTest>test.exe

Unhandled Exception: IronPython.Runtime.Exceptions.ImportException: No 
module named __future__
  at 
Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] 
args, Boolean& shouldOptimize)
  at 
IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`5.Call4(CallSite 
site, CodeContext context, TFuncType func, T0 arg0, T1 arg1, T2 arg2, T3 
arg3)
  at 
System.Dynamic.UpdateDelegates.UpdateAndExecute6[T0,T1,T2,T3,T4,T5,TRet](CallSite 
site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
  at IronPython.Runtime.Importer.Import(CodeContext context, String 
fullName, PythonTuple from, Int32 level)
  at 
IronPython.Runtime.Operations.PythonOps.ImportWithNames(CodeContext 
context, String fullName, String[] names, Int32 level)
  at Microsoft.Scripting.Utils.InvokeHelper`5.Invoke(Object arg0, 
Object arg1, Object arg2, Object arg3)

  at Microsoft.Scripting.Utils.ReflectedCaller.Invoke(Object[] args)
  at 
Microsoft.Scripting.Interpreter.CallInstruction.Run(InterpretedFrame frame)
  at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame 
frame)
  at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 
arg0, T1 arg1)

  at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
  at IronPython.Compiler.PythonScriptCode.Run(Scope scope)
  at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
  at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope)
  at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink 
errorSink)

  at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)
  at TestDuture.Test.Main(String[] args)

Am I missing something? It works ok when I add __future__.py from Python 
2.6.


--
-- Lukáš

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