Re: [IronPython] Unable to compare two junk character string in Iron Python.Do I need to include any particular encoding.??

2011-04-26 Thread Lukas Cenovsky


  
  
You should use the same encoding as has you special character
string.
Have you tried using utf-8 instead of ascii?

--
-- Lukáš


On 26.4.2011 11:56, saurabh rawat wrote:

  

  

  HI, 
  I have problem while working with text containing the
  unknown characters
  I have a method which compare the variable song with "some
  special character string"  and return true and false on
  the match and mismatch respectively.
  
  example
  
  (0)song = The goodgoddevil robzombie pfjsdfgolsdg á
  é ú
  (1)if song == "The goodgoddevil robzombie
  pfjsdfgolsdg á é ú"
  
  it exits as soon as it tries to execute the line (1) 
  
  
  I have go-ogled and found that something like this is to
  be  included
  #!/usr/bin/python
  # -*- coding: ascii -*-
  
  But still the same behavior, i think some problem with the
  coding - encoding standard.
  Could plz somebody help.
  
  Rgds,
  Saurabh
  

     " The
  ultimate test of a relationship is to
  disagree but to hold hands..." 
     
   

  

  
  

___
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] Loading a static lib a second time in hosted ironpython

2011-02-03 Thread Lukas Cenovsky
It looks like IronPython cannot find your .dll. Check whether you have 
MathHelpLib.dll along with all dependencies in your sys.path.


--
-- Lukás(

On 3.2.2011 17:00, Brian Ashcroft wrote:


Hello,

   I have an ironpython instance running within my application.  This 
instance is used to control the application.  I have a math dll that I 
reference in the hosting application that I would like to be able to 
use also in the ironpython scripting.  However, I get error messages 
when I try to add the reference.  I have tried the ironpython console 
(ipy.exe) in the application directory and the dll loads just fine and 
is completely usable, but when I try the following code in the 
application, I get an error


*import *clr

clr.*AddReferenceToFile*('MathHelpLib.dll')

*from *MathHelpLib *import **

With the error:

Could not add reference to assembly MathHelpLib


___
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] Using WebClient with Gestalt

2010-10-28 Thread Lukas Cenovsky

On 28.10.2010 16:34, Mark Heath wrote:
I'm writing an IronPython Silverlight application and trying to use 
WebClient to download some xaml so I can use XamlReader.Load to load 
it. I have the following code in a .py file that is referenced by my 
main HTML page:


wc = WebClient()
wc.DownloadStringCompleted += self.xamlDownloaded
wc.DownloadStringAsync(Uri('star.xaml',UriKind.Relative))

however, in the completed handler I get a SystemError - not found. I 
know that the xaml file is present, so I'm wondering if it is looking 
for it relative to dlr.xap. I didn't get much more success with an 
absolute Uri - just a SystemError with no message at all, which I 
guess could be due to Silverlight cross-domain request permissions.


Any suggestions for how I can get this working?

And another quick question while I'm at it. Are there any known issues 
with IronPython and data-binding in Silverlight? I converted an 
IronPython WPF app to Silverlight that was using MVVM, but in 
Silverlight none of the bindings worked at all.


For binding, you have to user clrtype.py. See my blog: 
http://gui-at.blogspot.com/2009/11/inotifypropertychanged-and-databinding.html


--
-- Lukáš

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


Re: [IronPython] The elephant in the room: source control for IronPython

2010-10-28 Thread Lukas Cenovsky

Hi,
I vote for staying wiht the current setup until final 2.7 release. I do 
not have any experiences wiht DVCS so I don't know whether Mercurial is 
better than git or vice versa. I use SVN so being on CodePlex which has 
SVN access is fine for me.


There has been a discussion in IronRuby mailing list and it seem their 
goal is to split current monolithic repo to three parts: IronRuby, 
IronPython and DLR (see 
http://rubyforge.org/pipermail/ironruby-core/2010-October/007562.html). 
The reasons for this makes perfect sense for me too although there are 
some concerns that testing the interoperability and developing similar 
parts would be easier in one repo 
(http://rubyforge.org/pipermail/ironruby-core/2010-October/007493.html).


--
-- Lukáš


On 28.10.2010 9:27, Jeff Hardy wrote:

Currently, IronPython is hosted in a TFS repository on CodePlex
(http://ironpython.codeplex.com/), which was a copy of MS's internal
TFS repository. CodePlex also provides Subversion access, which makes
it much more bearable. CodePlex also hosts our issue tracking and wiki
pages, which probably won't change any time soon.

IronRuby's source code is hosted on github
(http://github.com/ironruby/ironruby). It's also a copy of MS's
internal TFS repository, but in git.

The interesting part is that IronRuby, IronPython, and the DLR are
hosted in the *same* repository, since they evolved together. Thus,
both the IronPython CodePlex repo and the IronRuby github repo are
basically the same.


What this is going to look like in the future is an open question, as
is the timeline. Originally, I wanted to focus on the 2.7 release and
deal with the source control question later. However, it's been raised
in a few places, so I think it's better to get some more feedback on
whether we should switch source control methods (and if so, to what?)
or just stay on TFS/SVN for the time being. Also up for consideration
is whether you consider being part of the same repo as IronRuby is
valuable, or whether IronPython should split out on its own.

We could, for example, drop the source control from CodePlex and just
use the IronRuby github repo - it's already set up and we could start
developing tomorrow (although it would probably be renamed
'ironlanguages' or something like that). It's also probably the only
option if IronPython and IronRuby are to share a repo, as, so far as I
know, the IronRuby guys have no plans on leaving github, which makes
sense for them - git is the de facto choice in the Ruby community.

In Python, however, it's not so clear-cut - Python itself will be
moving to Mercurial soon, and there are plans afoot to eventually put
the Python stdlib in a separate repo from Python itself, which will
likely also be a Mercurial repository. Thus there are advantages
(subrepos, in particular) to being on the same DVCS. On top of that,
both Michael Foord and I strongly dislike git - I prefer Mercurial,
and I imagine the coffee at Canonical will have Michael singing the
praises of bzr fairly soon :). Finally, CodePlex supports Mercurial,
and thus everything could remain there if we so wish.

However, converting the repo to Mercurial could be a difficult task -
the fate of the 1.1, 2.0, and 2.6 branches would have to be decided
(include them in the repo, or not? Their structure is radically
different from the Main branch). There are folders that could very
well be stripped (WiX, Ruby, and *3* CPython installations, not to
mention IronRuby) to save space, and with a DVCS once they're in the
history everyone has to pay that cost in disk space, forever, even if
we later remove them. The fate of the DLR would need to be decided -
do we keep a local copy, pull from IronRuby's copy, or make it a third
repo altogether?

My preference is to stick with TFS/SVN for the time being, get 2.7 out
the door (manually syncing up the DLR sources with IronRuby in the
meantime), and then look at converting to Mercurial. My second choice
would be to work out of IronRuby's git repository, get 2.7 released,
and then look at converting to Mercurial. Anything that doesn't
eventually involve Mercurial is a lot further down my list :).

I would like to see the DLR become a separate project, of which
IronRuby and IronPython are just clients, along with IronJS,
Clojure-CLR, and any others. I don't think the DLR will change too
drastically, but the MS guys who are more familiar might have other
plans, and Tomas has said he would prefer them to be together for ease
of testing.

While the coordinators have discussed this already, I think we need
more feedback to get an idea of what we should do, so please share
your thoughts. This has a direct bearing on how you will be
contributing to IronPython.

- Jeff
___
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.iro

Re: [IronPython] The Road to 2.7 (Was: The Future of IronPython)

2010-10-28 Thread Lukas Cenovsky

On 28.10.2010 7:57, Jeff Hardy wrote:

On Sun, Oct 24, 2010 at 4:45 AM, Lukas Cenovsky  wrote:

I'd like to help. What is the best place to start?

Right now, we need to identify what's not working in 2.7B1 that needs
to be in 2.7 final. The best thing to do would be to identify any
issues that are causing you pain and bring them up on the list. Then
we can decide what meets the bar for a 2.7 release (with issues that
have patches getting priority, of course!). Dino, are there any issues
that you know are in 2.7B1 that must be fixed for 2.7 final?


I have not found any issue so far.


Dino has provided some instructions on contributing to IronPython:
http://ironpython.codeplex.com/wikipage?title=Respository%20Instructions&referringTitle=Home.
We need people to run through that and if there's anything it doesn't
cover (I do intend to add subversion instructions directly at some
point), and run the test suite as well. Also, doing all of that on
Mono, to see what work needs to be done there.


I'll go through it during the weekend for .NET (not Mono).


Besides knowing what needs to be done, we need a rough timeline. I
would like to see a release before the end of the year, or at least a
solid release candidate with a possible release early next year. The
idea behind an aggressive schedule is to focus on getting the features
we have solid and not worry about adding new features or libraries
(with the possible exception of zlib). That said, this all just my
desires, and I really want to get an idea of what every one else is
thinking.


I agree with this schedule. It was quite a pain waiting for 2.6.2 
bugfixes so I am for quicker releases.


--
-- Lukáš

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


[IronPython] Pyc.py platform differences

2010-10-25 Thread Lukas Cenovsky


  
  
Hi all,
this is just a reminder to what I have just found. All below was
performed on Win7x64 in VirtualBox.

When you use pyc.py to compile your code into .dll or .exe and your
code uses some other libraries, make sure you specify target
platform - i.e. /platform:x86

My code uses vfpoledb to access .dbf files. When I did not specify
the platform, System.Reflection.PortableExecutableKinds.ILOnly
was used which produced strange behavior:

  it was slower than interpreted code
  it crashes with 'vfpoledb is not registered error' although
vfpoledb was registered and the interpreted code run OK
  it runs OK on the second VM
  

When I specified switch /platform:x86 for compiling, it
runs correctly.

--
-- Lukáš
  


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


Re: [IronPython] The Future of IronPython

2010-10-24 Thread Lukas Cenovsky

Thank you Jeff you are taking the responsibility for the final 2.7 release.

*I'd like to help. What is the best place to start?*

--
-- Lukás(


On 22.10.2010 1:09, Jeff Hardy wrote:

As Dino recently posted, this is the last release of IronPython by
Microsoft. As of today, myself, Michael Foord, Jimmy Schementi, and
Miguel de Icaza are the coordinators for the IronPython project (Jimmy
and Miguel will also handle IronRuby). More information can be found
from Jason Zander:
http://blogs.msdn.com/b/jasonz/archive/2010/10/21/new-components-and-contributors-for-ironpython-and-ironruby.aspx.
Do note that Zander doesn't actually come out and *say* that Microsoft
is no longer funding IronPython/IronRuby, but that's what has
happened. Any future participation from MS employees will be on an
unofficial, spare-time basis.

All that said, I hope this isn't the end of IronPython. There's a good
community here, and I think we can do just as good a job as Microsoft
did. You can now contribute patches to IronPython, but that means you
will have to if you want the it to flourish. A good Open Source
community requires a core of regular contributors, but also requires a
mass of occasional ones that are just scratching their particular
itches.

> From here, my goal is to get IronPython 2.7 final out the door in a
timely manner. Let's leave discussions about things like source
control or external libraries aside for a bit and get a solid release
-- then we can start those discussions. I fear that starting a major
overhaul will kill any momentum we have and cause the 2.7 release to
be unacceptably delayed.

I wouldn't have signed up to do this if I thought IronPython didn't
have a future.

- Jeff
___
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] Announcing IronPython 2.7 Beta 1

2010-10-22 Thread Lukas Cenovsky
I think there is an option to register .py extensions in the CPython 
installer. But it is hidden under some Extra settings button.


--
-- Lukás(


On 22.10.2010 16:46, Vernon Cole wrote:
Your issue #2 is not a bug -- or at least it is the same as all other 
installers.


Every version of Python which you install will take over as the 
default "Open" command for .py files -- and will supply it's own icon 
for them.  When you are trying out a new Python version, you must 
remember to re-install your chosen default version afterward, if you 
expect to double-click a .py and get a certain version of Python to 
start. The same thing happens with Python 3.1 and 2.7 for example.  I  
use so many different versions that I have given up on the re-install 
trick. I now use a bunch of .bat files (in a directory on my search 
path) to pick the version I want.


For example, the file "py23.bat" contains:
c:\python23\python.exe %1 %2 %3 %4 %5 %6 %7 %8 %9

and "py31.bat" contains:
c:\python31\python.exe %1 %2 %3 %4 %5 %6 %7 %8 %9

and "ipy.bat" contains:
"c:\program files\IronPython 2.7\ipy.exe" %1 %2 %3 %4 %5 %6 %7 %8 %9

The file "python.bat" points to my chosen default version for this week.

So to test"myTestScript" under IronPython 2.7, I type:
ipy myTestScript.py arg1 arg2

The same little c:\utils directory also contains such handy tools as 
tail.exe, unix2dos.exe, less.exe, and 2to3.bat, which contains:
c:\python26\python.exe c:\python26\Tools\Scripts\2to3.py  %1 %2 %3 %4 
%5 %6 %7 %8 %9


You get the picture... Those of us who's brains are stuck in console 
mode do this sort of thing.

--
Vernon

On Fri, Oct 22, 2010 at 6:44 AM, Adal Chiriliuc 
mailto:adal.chiril...@gmail.com>> wrote:


Hi,

Thanks for making available a new IronPython build. The 2.7 Beta 1
installer has a few issues through:

1. Changing the default installation folder doesn't work: IronPython
will be installed in two places: "C:\Program Files (x86)\IronPython
2.7" and the installation folder that you specified.

2. If you have already have CPython installed, IronPython will
overwrite the icon for .py files, but not for .pyc and .pyw files.
Please don't replace the CPython icons or at least make this an
installer option.

Adal



___
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] Announcing IronPython 2.6.2

2010-10-22 Thread Lukas Cenovsky

Thank you!

--
-- Lukáš


On 22.10.2010 1:01, Dino Viehland wrote:

Hello Python Community,

We're pleased to announce the final release of IronPython 2.6.2 which can be 
downloaded at http://ironpython.codeplex.com/releases/view/41236. This is a 
minor update which fixes the most egregious issues discovered since 2.6.1. 
After the number of major changes we released in 2.6.1 this release keeps the 
number of changes to a minimum to ensure that it'll have great compatibility 
against the previous versions we've shipped. This is the last release from 
Microsoft before turning these projects over to the new coordinators [see 
http://tinyurl.com/24tjztk for more information].

The full list of issues fixed includes:
26593 pyc fails if a file contains a call to unicode
26940 Wrong line numbers in traceback when ecoding is specified
27547 Problem with ScriptSource.GetCodeProperties() (Fix type error when parsing invalid 
text "lambda")
27247 delattr doesn't work on instance attributes of user defined instance
Fix a memory leak related to the id dispenser
Fix stack overflow with a large number of nested if/elif blocks

Special thanks to gjones , cendalc, fuzzyman , sstevenson, Chuck Jacobs ,and 
Idan Zaltzberg for reporting issues and making this a great release! Happy 
scripting!

- The IronPython Team

___
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] gcroot for ironpython object

2010-10-18 Thread Lukas Cenovsky


  
  
Thanks - that works. I've also found Kamil's blog post:
http://blog.kamil.dworakowski.name/2008/02/debugging-memory-problems-in-ironpython.html

Now I'm fighting with s - trying to convert
them to something readable...
Kamil's script does not seem to work - I don't see any dict holding
the ironpython object in the stacktrace: 

...
    0330d0f4(System.Windows.Controls.StackPanel)->
    0330d22c(System.Windows.Controls.UIElementCollection)->
    0330d240(System.Windows.Media.VisualCollection)->
    0330d520(System.Object[])->
    0330d428(System.Windows.Controls.Button)->
    0824cb0c(System.Windows.EffectiveValueEntry[])->
    0824cb00(System.Windows.EventHandlersStore)->
    0824cc00(MS.Utility.SingleObjectMap)->
   
  0824cbe0(MS.Utility.FrugalObjectList`1[[System.Windows.RoutedEventHandlerInfo,
  PresentationCore]])->
   
  0824cbec(MS.Utility.SingleItemList`1[[System.Windows.RoutedEventHandlerInfo,
  PresentationCore]])->
    0824caa8(System.Windows.RoutedEventHandler)->
    0824ca44(System.Object[])->
    0824ca18(IronPython.Runtime.Method)->
  08162f84()->
    08163d78(IronPython.Runtime.PythonDictionary)->
    08163d6c(IronPython.Runtime.StringDictionaryStorage)->
    08163d84(System.Collections.Generic.Dictionary`2[[System.String,
  mscorlib],[System.Object, mscorlib]])->
   
  081c5558(System.Collections.Generic.Dictionary`2+Entry[[System.String,
  mscorlib],[System.Object, mscorlib]][])->
    0816b3bc(System.GopherStyleUriParser)

--
-- Lukáš


On 18.10.2010 20:04, Jonathan Allen wrote:

  One trick is to give it a radioactive marker like they do in medical shows. 

Have that instance you care about reference an instance of EmailMessage or some other class you aren't actually using. Finding the EmailMessage object should be easy because there is only one, and from there you can find the IronPython object you are after.

I use RedGate instead of WinDbg, so I'm not sure this will work for you. If you try it, please let me know the results.

Jonathan


-Original Message-
From: Lukas Cenovsky 
Sent: Monday, October 18, 2010 10:01 AM
To: Discussion of IronPython 
Subject: [IronPython] gcroot for ironpython object

  Hi all,
I have an instance of IronPython object and I'd like to find out why it 
is kept in memory (I use weakref to check it is still in the memory).

What is the best way to find the object in WinDbg so I can call gcroot 
for it? Or is there a better way to find out why my object is kept in 
memory?

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





  


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


[IronPython] gcroot for ironpython object

2010-10-18 Thread Lukas Cenovsky

 Hi all,
I have an instance of IronPython object and I'd like to find out why it 
is kept in memory (I use weakref to check it is still in the memory).


What is the best way to find the object in WinDbg so I can call gcroot 
for it? Or is there a better way to find out why my object is kept in 
memory?


Thanks.

--
-- Lukáš

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


Re: [IronPython] change in standard library behavior for compiled .exe/.dll???

2010-10-05 Thread Lukas Cenovsky

 It's easy - just add the os.py to the build command with the correct path:

ipy.exe Tools\Scripts\pyc.py /target:exe /main:myprg.py /out:myprg 
myprg.py lib\os.py


You will probably need to add more references.

--
-- Lukáš


On 5.10.2010 23:27, Ken MacDonald wrote:
I've been looking at the .exe's we built - using pyc.py - with IP 
2.5/.Net 3.5 and IP2.7 / .NET 4.0. In the 2.7 .exe, it appears that 
the imports (like "os") are not being built into the .exe/.dll, but 
instead are required to be imported in source form, e.g. "os.py" must 
be somewhere on sys.path. In the IP 2.5 .exe's we had been building, 
they would run fine on machines without the IP standard library 
installed at all, in other words, with "os.py" not present on the 
machine at all. We did notice that the .exe in question went from 
being 2.9 MB in it's IP 2.5 incarnation, down to 1.2 MB in the IP 2.7 
version, and the newer version requires that the source code for the 
IP standard library be on the path. Is this a deliberate change in 
behavior? We never had to package the standard library source when we 
sent out .exe's to customers before


>"os" is not an assembly but a Python module from the standard 
library. You need to ensure >that the Python standard library (or the 
parts that you use and their dependencies) is on the >path.



All the best,

Michael Foord


and how do I ensure it gets found from my .exe - is there a
specific env. variable, or the Windows %PATH% e.v., or something
I haven't AddReference'd to
Thanks,
Ken



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



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


READ CAREFULLY. By accepting and reading this email you agree,
on behalf of your employer, to release me from all obligations
and waivers arising from any and all NON-NEGOTIATED agreements,
licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap,
confidentiality, non-disclosure, non-compete and acceptable use
policies (”BOGUS AGREEMENTS”) that I have entered into with your
employer, its partners, licensors, agents and assigns, in
perpetuity, without prejudice to my ongoing rights and privileges.
You further represent that you have the authority to release me
from any BOGUS AGREEMENTS on behalf of your employer.



___
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] Opening a process for mem reads ?

2010-09-22 Thread Lukas Cenovsky

 On 22.9.2010 20:03, Jeff Hardy wrote:

On Wed, Sep 22, 2010 at 11:36 AM, Richard Steventon  wrote:

Next question in my quest to open a process and read its memory:
from win32.win32security import GetSecurityInfo, SetSecurityInfo

How do I get access to those in IronPython ?

Unfortunately, I don't think anyone has ported the win32 module to
IronPython yet (it's a big, complicated module).

You could use ctypes:

 ctypes.windll.advapi32.GetSecurityInfo(...)

GetSecurityInfo has a fairly complicated signature (see
http://msdn.microsoft.com/en-us/library/aa446654(VS.85).aspx) that
will probably require working fairly closely with ctypes
(http://docs.python.org/library/ctypes.html) to get it to work.

Unfortunately, out of the box, that's all the IronPython provides.

- Jeff

P.S. If you need to know the DLL to use with ctypes.windll, look up
the function on MSDN and look for the DLL name near the bottom of the
page.


You can use clrtype instead of ctypes to call native functions - see 
(Sample) ClrType.zip 
.


--
-- Lukás(

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


Re: [IronPython] difference in compiling ipy in 3.5 vs. .NET 4.0?

2010-09-17 Thread Lukas Cenovsky

 I would try to run it via WinDbg to see all exceptions raised.

--
-- Lukás(


On 17.9.2010 19:43, Ken MacDonald wrote:
We're trying to get a WPF/IPY project converted from .NET 3.5 to 4.0 
using IPY 2.6 for .NET 4.0. I got it running fine yesterday using IPY 
interactively:


ipy etms.py

bring up all dialogs, connects to DB, works great.

but I try to compile it into an executable using the 'pyc.py' tool:

C:\hs\tally\etms>ipy.exe "c:\Program Files (x86)\IronPython 2.6 for 
.NET 4.0\Tools\Scripts\pyc.py" /main:etms.py /platform:x86 
/target:winexe etms.py main_window.py model.py presenter.py 
wpf_helpers.py pyevent.py dialogs.py login.py kitchen_ticket.py 
hs_quantity.py hssecdll.py debug_settings.py version_info.py


and it completes 'successfully' but then if I attempt to run it, the 
command prompt returns immediately and not even the login dialog 
appears. There are no error messages, or indications of a problem. 
This worked fine (with path changes to reference 3.5) in .NET 3.5, but 
is now a mystery. I've tried a variety of pyc.py flags that seemed 
possibly relevant, but nothing makes it work. Suggestions for what 
this could be appreciated.

Ken


___
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] IronPython 2.6.2

2010-09-09 Thread Lukas Cenovsky

 On 9.9.2010 22:17, Dino Viehland wrote:

Lukas wrote:

   On 12.8.2010 23:01, Dino Viehland wrote:

Lukas wrote:

Hi guys,
do you have a release date for IronPython 2.6.2? Thanks.

Thank you for the reminder and I apologize for the delay.  There were
a couple of failures in the last check-in that I believe I now have
investigated and fixed.  I'm kicking off another run and if that

passes

then we can kick off the final release build.  So my guess would be

late

next week or the week after that.  Again, sorry for the delay, it's
taken way too long to get it out.


Hi,
any news about 2.6.2?

Well I hate to make a guess on a release date because I've been wrong so many
times now but it's basically ready to go.  There's some internal process that
I'm blocked on that's out of my control so once that's done then it'll be
released.  It should be soon but I'm not exactly sure when :(



OK, it was just a reminder ;-)

--
-- Lukáš

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


Re: [IronPython] Silverlight - Cannot save value from target back to source

2010-09-09 Thread Lukas Cenovsky
 I've filled an issue for this bug: 
http://ironpython.codeplex.com/workitem/28823


--
-- Lukáš


On 3.9.2010 19:39, Lukas Cenovsky wrote:
I do not have any Mountains.filtered.set method - I think clrtype 
metaclass adds it. You can see the part I wrote (filtered property) 
below or in the attachment where I put the whole testing sources.


Running the same code in the desktop CLR works fine (wpf.py).

--
-- Lukáš


On 3.9.2010 19:11, Dino Viehland wrote:


Does this only happen in debug mode?  Do you have a class or a method 
named like Mountains.filtered.set (in other words do you have any 
idea of what this code is)?   Or are you maybe deriving from a class 
named Mountains which has a set method?


Ultimately what I'm getting at is it'd be good to run this on the 
desktop CLR and get the same method created.  So if you can isolate 
the code then run it on the desktop you could run w/ the 
--X:SaveAssemblies option.  That will write out the IL we generate to 
disk as a Snippets.scripting.dll and then you can run peverify on 
that and see if the generated code is actually unverifiable (or if 
maybe there's a CLR bug related to verification).


If there is actually unverifiable code then we have a bug we need to 
fix.  If we have verifiable code or some difference between when 
we're using RefEmit and DynamicMethods then maybe the CLR has a bug 
that needs to be fixed.


*From:* users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Lukas Cenovsky

*Sent:* Friday, September 03, 2010 9:04 AM
*To:* Discussion of IronPython
*Subject:* Re: [IronPython] Silverlight - Cannot save value from 
target back to source


I am trying to debug this bug and I need some help.

I have built IronPython 2.6.1 - Silverlight debug binaries. I have 
pointed VS 2010 symbols folder to the folder with these binaries.


I run the Silverlight app in the debug mode (debug=true in 
index.html), attach VS 2010 debugger, select Thrown for /Common 
Language Runtime Exceptions/ and /Managed Debugging Assistants/ in 
Debug - Exceptions dialog.


All symbols are loaded, so I click on the checkbox button on the 
page. The following exception occurs:


System.Security.VerificationException occurred
  Message=Operation could destabilize the runtime.
  StackTrace:
   at Mountains.filtered(Nullable`1 value)
  InnerException:

No source available.This is the Call stack:

>Snippets.scripting!Mountains.filtered.set(bool? value) + 0x23 bytes
 [Native to Managed Transition]
 [Managed to Native Transition]
 
System.Windows.dll!System.Windows.CLRPropertyListener.Value.set(object value) 
+ 0x23 bytes
 
System.Windows.dll!System.Windows.PropertyAccessPathStep.Value.set(object 
value) + 0x10 bytes
 
System.Windows.dll!System.Windows.Data.BindingExpression.UpdateValue() + 
0x3b2 bytes
 
System.Windows.dll!System.Windows.Data.BindingExpression.UpdateValueIfNecessary() 
+ 0x27 bytes
 
System.Windows.dll!System.Windows.Data.BindingExpression.TargetPropertyChanged(System.Windows.DependencyObject 
sender, System.Windows.DependencyProperty dp) + 0x2b bytes
 
System.Windows.dll!System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyProperty 
dp) + 0x17 bytes
 
System.Windows.dll!System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyProperty 
dp) + 0x51 bytes
 
System.Windows.dll!System.Windows.DependencyObject.RaisePropertyChangeNotifications(System.Windows.DependencyProperty 
dp, object oldValue, object newValue) + 0x5c bytes
 
System.Windows.dll!System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.DependencyProperty 
property, System.Windows.EffectiveValueEntry oldEntry, ref 
System.Windows.EffectiveValueEntry newEntry, 
System.Windows.DependencyObject.ValueOperation operation) + 0xf6 bytes
 
System.Windows.dll!System.Windows.DependencyObject.SetValueInternal(System.Windows.DependencyProperty 
dp, object value, bool allowReadOnlySet) + 0x1da bytes
 
System.Windows.dll!System.Windows.Controls.Primitives.ToggleButton.OnToggle() 
+ 0x8d bytes
 
System.Windows.dll!System.Windows.Controls.Primitives.ToggleButton.OnClick() 
+ 0xf bytes
 
System.Windows.dll!System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs 
e) + 0x8e bytes
 
System.Windows.dll!System.Windows.Controls.Control.OnMouseLeftButtonUp(System.Windows.Controls.Control 
ctrl, System.EventArgs e) + 0x31 bytes
 
System.Windows.dll!MS.Internal.JoltHelper.FireEvent(System.IntPtr 
unmanagedObj, System.IntPtr unmanagedObjArgs, int argsTypeIndex, 
string eventName) + 0x234 bytes

 [Appdomain Transition]

I click Step Into and another exception occurs:

System.Reflection.TargetInvocationException occurred
  Message=Exception has been thrown by the target of an invocation.
  StackTrace:
   at 
System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMetho

Re: [IronPython] IronPython 2.6.2

2010-09-09 Thread Lukas Cenovsky

 On 12.8.2010 23:01, Dino Viehland wrote:

Lukas wrote:

   Hi guys,
do you have a release date for IronPython 2.6.2? Thanks.


Thank you for the reminder and I apologize for the delay.  There were
a couple of failures in the last check-in that I believe I now have
investigated and fixed.  I'm kicking off another run and if that passes
then we can kick off the final release build.  So my guess would be late
next week or the week after that.  Again, sorry for the delay, it's
taken way too long to get it out.



Hi,
any news about 2.6.2?

--
-- Lukáš

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


Re: [IronPython] Silverlight - Cannot save value from target back to source

2010-09-03 Thread Lukas Cenovsky
--
-- Lukáš
    

On 2.9.2010 20:39, Lukas Cenovsky wrote:
 Following
  my binding experiments in WPF, I tried to convert the sample into
  Silverlight and I hit another binding errors there.
  
  
  When I bind anything else than string, I receive an error when the
  target value is changed and the source should be updated. This
  happens in all IronPython versions (2.6.1 on .Net 2.0 and 4,
  2.7a1).
  
  
  Here is the code I use (the whole source is attached):
  
  
      @property
  
      @clrtype.accepts()
  
      @clrtype.returns(System.Nullable[System.Boolean])
  
      def filtered(self):
  
      return self._filtered
  
  
      @filtered.setter
  
      @clrtype.accepts(System.Nullable[System.Boolean])
  
      @clrtype.returns()
  
      def filtered(self, value):
  
      self._filtered = value
  
      self.OnPropertyChanged('filtered')
  
  
  As you can see I tried to use System.Nullable[System.Boolean]
  instead of bool but it did not help. I also tried to use converter
  and convert the value to this type
  (System.Nullable[System.Boolean](value)) but that did not help
  either. All resulted in the following exception for bool type.
  
  
  System.Windows.Data Error: Cannot save value from target back to
  source. BindingExpression: Path='filtered' DataItem='Mountains'
  (HashCode=2058916); target element is
  'System.Windows.Controls.CheckBox' (Name=''); target property is
  'IsChecked' (type 'System.Nullable`1[System.Boolean]')..
  System.Reflection.TargetInvocationException: Exception has been
  thrown by the target of an invocation. --->
  System.Security.VerificationException: Operation could destabilize
  the runtime.
  
     at Mountains.filtered(Nullable`1 value)
  
     --- End of inner exception stack trace ---
  
     at
  System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo
  method, Object target, Object[] arguments, SignatureStruct&
  sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
  
     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
  BindingFlags invokeAttr, Binder binder, Object[] parameters,
  CultureInfo culture, Boolean skipVisibilityChecks)
  
     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
  BindingFlags invokeAttr, Binder binder, Object[] parameters,
  CultureInfo culture)
  
     at System.Reflection.RuntimePropertyInfo.SetValue(Object obj,
  Object value, BindingFlags invokeAttr, Binder binder, Object[]
  index, CultureInfo culture)
  
     at System.Reflection.RuntimePropertyInfo.SetValue(Object obj,
  Object value, Object[] index)
  
     at System.Windows.CLRPropertyListener.set_Value(Object value)
  
     at System.Windows.PropertyAccessPathStep.set_Value(Object
  value)
  
     at System.Windows.Data.BindingExpression.UpdateValue().
  
  
  The similar exception is raised for float or System.Double.
  
  
  I have found an old issue similar to this:
  http://ironpython.codeplex.com/workitem/16831?ProjectName=ironpython
  
  
  Any workaround would be nice for this bug :-)
  
  
  --
  
  -- 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] IronPython 2.6.1, NET 2.0 and binding cause NullReferenceException

2010-09-03 Thread Lukas Cenovsky
 I've found a workaround for this issue. When I was porting this code 
to Silverlight, I could not use default view because Silverlight does 
not have it. So I created my own CollectionViewSource and bind it to the 
listbox. It works. Then I tried it in WPF and it works there too.


So the problem below is caused by default views that WPF create 
automatically when you bind a collection.


--
-- Lukáš


On 2.9.2010 12:32, Lukas Cenovsky wrote:

Hi all,
I've found a bug in IronPython 2.6.1 that causes to terminate 
IronPython 2.6.1 based on .NET 2.0 with SystemError: Object reference 
not set to an instance of an object. exception.


Below is the code. You need clrtype.py and pyevent.py to run it. When 
you run it, a simple form with listbox and checkbox appears. The SK 
items in the listbox can be filtered out by checking the checkbox. 
There is a binding to the selected item in the listbox which is the 
cause of the error. If you select the SK item and check the checkbox 
to filter it out, the exception occurs. But it only occurs in 
IronPython based on .NET 2.0 - it works fine in IronPython 2.6.1 based 
on .NET 4.


Here is the full exception:

C:\BindingTest>C:\IronPython-2.6.1.NET20\ipy.exe -X:Debug 
-X:ShowClrExceptions BindingTest.py

Traceback (most recent call last):
  File "BindingTest.py", line 133, in 
  File "BindingTest.py", line 125, in filtered
SystemError: Object reference not set to an instance of an object.
CLR Exception:
NullReferenceException
:
Object reference not set to an instance of an object.

I'm going to build IronPython in the debug mode this afternoon to see 
what's wrong inside and possible fix it in my own build.


As this is quite showstopper for me, I would be very happy if somebody 
can help me with this. Thank you.


--
-- Lukáš

--- file BindingTest.py ---

import clr
import clrtype
import pyevent
clr.AddReference('WindowsBase')
clr.AddReference('PresentationFramework')
from System.Windows import Application
from System.ComponentModel import INotifyPropertyChanged, 
PropertyChangedEventArgs

from System.Collections.ObjectModel import ObservableCollection
from System.Windows.Markup import XamlReader
from System.Windows.Data import CollectionViewSource

xaml = """xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation";

  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml";
  Title="Binding test" Height="150" Width="250">




















"""

class NotifyPropertyChangedBase(INotifyPropertyChanged):
PropertyChanged = None

def __init__(self):
self.PropertyChanged, self._propertyChangedCaller = 
pyevent.make_event()


def add_PropertyChanged(self, value):
self.PropertyChanged += value

def remove_PropertyChanged(self, value):
self.PropertyChanged -= value

def OnPropertyChanged(self, propertyName):
if self.PropertyChanged is not None:
self._propertyChangedCaller(self, 
PropertyChangedEventArgs(propertyName))


class Mountain(NotifyPropertyChangedBase):
__metaclass__ = clrtype.ClrClass

def __init__(self, name, country):
super(Mountain, self).__init__()
self.name = name
self.country = country

@property
def name(self):
return self._name

@name.setter
def name(self, value):
self._name = value
self.OnPropertyChanged('name')

@property
def country(self):
return self._country

@country.setter
def country(self, value):
self._country = value
self.OnPropertyChanged('country')

class Mountains(NotifyPropertyChangedBase):
__metaclass__ = clrtype.ClrClass

def __init__(self):
super(Mountains, self).__init__()
self._lstMountains = ObservableCollection[Mountain]()
self.lstMountains.Add(Mountain('Snezka', 'CR'))
self.lstMountains.Add(Mountain('Rip', 'CR'))
self.lstMountains.Add(Mountain('Gerlach', 'SK'))
self.filtered = False
self.selMountain = Mountain('', '')

@property
@clrtype.accepts()
@clrtype.returns(Mountain)
def selMountain(self):
return self._selMountain

@selMountain.setter
@clrtype.accepts(Mountain)
@clrtype.returns()
def selMountain(self, value):
self._selMountain = value
self.OnPropertyChanged('selMountain')

@property
@clrtype.accepts()
@clrtype.returns(ObservableCollection[Mountain])
def lstMountains(self):
return self._lstMountains

@property
@clrtype.accepts()
@clrtype.returns(bool)
def filtered(self):
return self._filtered

@filtered.setter
@clrtype.accepts(bool)
@clrtype.returns()
def filtered(self, value):
self._filtered = value
   

Re: [IronPython] performance hit on 64 bit systems

2010-09-03 Thread Lukas Cenovsky

 Wild guess:
 - do you run 64-bit IronPython on 2008 R2?
 - did you NGEN 64-bit IronPython and the app?

--
-- Lukáš


On 3.9.2010 12:04, Idan Zaltzberg wrote:


Hello,

I'm trying to migrate a big  application (running on IronPython 2.6.1) 
from a 32 bit OS (windows server 2003 R2) to a 64 bit system (windows 
server 2008 R2).


I have noticed about 50% performance hit, i.e. operations that took 10 
seconds, now take 15 seconds.


I have tried to see the what is the root cause and created the 
following test, and ran it on both systems:


def f():

sw.Reset()

 sw.Start()

 for x in xrange(n):

s='string:%s' % (x,)

 print sw.Elapsed.TotalSeconds

from System.Diagnostics import Stopwatch

sw = Stopwatch()

n = 1e7

f()

è *11.7766457 (In windows server 2003 R2 – 32 bit)*

è *16.3231212 (In windows server 2008 R2 – 64 bit)*

* *

Which matches the about 50% loss I have seen on my system.

On the other hand, the equivalent code in cpython yields *slightly 
better results to the 64 bit OS*  (3.7 sec to the 64 bit, against 4.1 
sec to the 32 bit).


I hoped you might help to understand why this as happened and can I 
improve the performance in any way for 64 bit systems.


Thanks.


___
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] Silverlight - Cannot save value from target back to source

2010-09-02 Thread Lukas Cenovsky
 Following my binding experiments in WPF, I tried to convert the sample 
into Silverlight and I hit another binding errors there.


When I bind anything else than string, I receive an error when the 
target value is changed and the source should be updated. This happens 
in all IronPython versions (2.6.1 on .Net 2.0 and 4, 2.7a1).


Here is the code I use (the whole source is attached):

@property
@clrtype.accepts()
@clrtype.returns(System.Nullable[System.Boolean])
def filtered(self):
return self._filtered

@filtered.setter
@clrtype.accepts(System.Nullable[System.Boolean])
@clrtype.returns()
def filtered(self, value):
self._filtered = value
self.OnPropertyChanged('filtered')

As you can see I tried to use System.Nullable[System.Boolean] instead of 
bool but it did not help. I also tried to use converter and convert the 
value to this type (System.Nullable[System.Boolean](value)) but that did 
not help either. All resulted in the following exception for bool type.


System.Windows.Data Error: Cannot save value from target back to source. 
BindingExpression: Path='filtered' DataItem='Mountains' 
(HashCode=2058916); target element is 'System.Windows.Controls.CheckBox' 
(Name=''); target property is 'IsChecked' (type 
'System.Nullable`1[System.Boolean]').. 
System.Reflection.TargetInvocationException: Exception has been thrown 
by the target of an invocation. ---> 
System.Security.VerificationException: Operation could destabilize the 
runtime.

   at Mountains.filtered(Nullable`1 value)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo 
method, Object target, Object[] arguments, SignatureStruct& sig, 
MethodAttributes methodAttributes, RuntimeType typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, 
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo 
culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, 
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo 
culture)
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object 
value, BindingFlags invokeAttr, Binder binder, Object[] index, 
CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object 
value, Object[] index)

   at System.Windows.CLRPropertyListener.set_Value(Object value)
   at System.Windows.PropertyAccessPathStep.set_Value(Object value)
   at System.Windows.Data.BindingExpression.UpdateValue().

The similar exception is raised for float or System.Double.

I have found an old issue similar to this: 
http://ironpython.codeplex.com/workitem/16831?ProjectName=ironpython


Any workaround would be nice for this bug :-)

--
-- Lukáš
import clr
import clrtype
import pyevent
import System
from System.Windows import Application
from System.Windows.Controls import UserControl
from System.ComponentModel import INotifyPropertyChanged, 
PropertyChangedEventArgs
from System.Collections.ObjectModel import ObservableCollection
from System.Windows.Data import CollectionViewSource, IValueConverter
from System.Windows.Markup import XamlReader

class NotifyPropertyChangedBase(INotifyPropertyChanged):
PropertyChanged = None

def __init__(self):
self.PropertyChanged, self._propertyChangedCaller = pyevent.make_event()

def add_PropertyChanged(self, value):
self.PropertyChanged += value

def remove_PropertyChanged(self, value):
self.PropertyChanged -= value

def OnPropertyChanged(self, propertyName):
if self.PropertyChanged is not None:
self._propertyChangedCaller(self, 
PropertyChangedEventArgs(propertyName))

class Mountains(NotifyPropertyChangedBase):
__metaclass__ = clrtype.ClrClass

def __init__(self):
super(Mountains, self).__init__()
self.filtered = True

@property
@clrtype.accepts()
@clrtype.returns(str)
def filtered_text(self):
return 't' if getattr(self, 'filtered', False) else 'f'

@property
@clrtype.accepts()
@clrtype.returns(System.Nullable[System.Boolean])
def filtered(self):
return self._filtered

@filtered.setter
@clrtype.accepts(System.Nullable[System.Boolean])
@clrtype.returns()
def filtered(self, value):
self._filtered = value
self.OnPropertyChanged('filtered')

class App:
def __init__(self):
self.root = Application.Current.LoadRootVisual(UserControl(), 
"app.xaml")
self.root.FindName('LayoutRoot').DataContext = Mountains()

a = App()


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


[IronPython] IronPython 2.6.1, NET 2.0 and binding cause NullReferenceException

2010-09-02 Thread Lukas Cenovsky


  
  
Hi all,
I've found a bug in IronPython 2.6.1 that causes to terminate
IronPython 2.6.1 based on .NET 2.0 with SystemError: Object
  reference not set to an instance of an object. exception.

Below is the code. You need clrtype.py and pyevent.py to run it.
When you run it, a simple form with listbox and checkbox appears.
The SK items in the listbox can be filtered out by checking the
checkbox. There is a binding to the selected item in the listbox
which is the cause of the error. If you select the SK item and check
the checkbox to filter it out, the exception occurs. But it only
occurs in IronPython based on .NET 2.0 - it works fine in IronPython
2.6.1 based on .NET 4.

Here is the full exception:

C:\BindingTest>C:\IronPython-2.6.1.NET20\ipy.exe -X:Debug
  -X:ShowClrExceptions BindingTest.py
  Traceback (most recent call last):
    File "BindingTest.py", line 133, in 
    File "BindingTest.py", line 125, in filtered
  SystemError: Object reference not set to an instance of an object.
  CLR Exception:
      NullReferenceException
  :
  Object reference not set to an instance of an object.

I'm going to build IronPython in the debug mode this afternoon to
see what's wrong inside and possible fix it in my own build.

As this is quite showstopper for me, I would be very happy if
somebody can help me with this. Thank you.

--
-- Lukáš

--- file BindingTest.py ---

import clr
  import clrtype
  import pyevent
  clr.AddReference('WindowsBase')
  clr.AddReference('PresentationFramework')
  from System.Windows import Application
  from System.ComponentModel import INotifyPropertyChanged,
  PropertyChangedEventArgs
  from System.Collections.ObjectModel import ObservableCollection
  from System.Windows.Markup import XamlReader
  from System.Windows.Data import CollectionViewSource
  
  xaml = http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Binding test" Height="150" Width="250">
    
      
    
    
    
      
      
      
    ItemsSource="{Binding lstMountains}"
    SelectedItem="{Binding selMountain}">
    
      
    
      
      
      
    
      
    
      
      
    
  """
  
  class NotifyPropertyChangedBase(INotifyPropertyChanged):
      PropertyChanged = None
  
      def __init__(self):
      self.PropertyChanged, self._propertyChangedCaller =
  pyevent.make_event()
  
      def add_PropertyChanged(self, value):
      self.PropertyChanged += value
  
      def remove_PropertyChanged(self, value):
      self.PropertyChanged -= value
  
      def OnPropertyChanged(self, propertyName):
      if self.PropertyChanged is not None:
      self._propertyChangedCaller(self,
  PropertyChangedEventArgs(propertyName))
  
  class Mountain(NotifyPropertyChangedBase):
      __metaclass__ = clrtype.ClrClass
  
      def __init__(self, name, country):
      super(Mountain, self).__init__()
      self.name = name
      self.country = country
  
      @property
      def name(self):
      return self._name
  
      @name.setter
      def name(self, value):
      self._name = value
      self.OnPropertyChanged('name')
  
      @property
      def country(self):
      return self._country
  
      @country.setter
      def country(self, value):
      self._country = value
      self.OnPropertyChanged('country')
  
  class Mountains(NotifyPropertyChangedBase):
      __metaclass__ = clrtype.ClrClass
  
      def __init__(self):
      super(Mountains, self).__init__()
      self._lstMountains = ObservableCollection[Mountain]()
      self.lstMountains.Add(Mountain('Snezka', 'CR'))
      self.lstMountains.Add(Mountain('Rip', 'CR'))
      self.lstMountains.Add(Mountain('Gerlach', 'SK'))
      self.filtered = False
      self.selMountain = Mountain('', '')
  
      @property
      @clrtype.accepts()
      @clrtype.returns(Mountain)
      def selMountain(self):
      return self._selMountain
  
      @selMountain.setter
      @clrtype.accepts(Mountain)
      @clrtype.returns()
      def selMountain(self, value):
      self._selMountain = value
      self.OnPropertyChanged('selMountain')
  
      @property
      @clrtype.accepts()
      @clrtype.returns(ObservableCol

Re: [IronPython] Hosting IronPython in Silverlight - background loading

2010-08-22 Thread Lukas Cenovsky
 I've entered the issue on tracker: 
http://ironpython.codeplex.com/workitem/28635


--
-- Lukáš


On 18.8.2010 15:44, Jimmy Schementi wrote:
Lukas, this is the bug in Microsoft.Scripting.Silverlight. Because you 
do "setup.HostType = 
typeof(Microsoft.Scripting.Silverlight.BrowserScriptHost)", all 
file-system lookups (like looking for a module) go through that type.


~Jimmy


On Wed, Aug 18, 2010 at 3:23 AM, Lukas Cenovsky <mailto:cenov...@bakalari.cz>> wrote:


Looks like there is a bug in DynamicEngine. When I tried the old
way, it works:

private void UserControl_Loaded(object sender, RoutedEventArgs ev)
{
IPloader = new BackgroundWorker();
IPloader.DoWork += new DoWorkEventHandler((s, e) =>
{
ScriptRuntimeSetup setup = new ScriptRuntimeSetup();
   
setup.LanguageSetups.Add(Python.CreateLanguageSetup(null));

setup.HostType =
typeof(Microsoft.Scripting.Silverlight.BrowserScriptHost);
setup.DebugMode = true;
runtime = new ScriptRuntime(setup);
engine = Python.GetEngine(runtime);
foreach (string str in new string[] { "mscorlib",
"System", "System.Windows", "System.Windows.Browser", "System.Net" })
{
   
runtime.LoadAssembly(runtime.Host.PlatformAdaptationLayer.LoadAssembly(str));

}
// engine.Execute("import imptest"); --this does not work

}
);
IPloader.RunWorkerCompleted += new
RunWorkerCompletedEventHandler((s, e) =>
{
this.textBlock1.Text = "IronPython loaded";
}
);
IPloader.RunWorkerAsync();
}

What does not work is importing modules in the background thread
(commented line). It throws the following exception:

System.InvalidOperationException was unhandled by user code
  Message=This operation can only occur on the UI Thread.
  StackTrace:
   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.ImportTop(CodeContext
context, String fullName, Int32 level)
   at
Microsoft.Scripting.Interpreter.FuncCallInstruction`4.Run(InterpretedFrame
frame)
   at
Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame
frame)
   at
Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet](T0 arg0)
   at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope
scope)
   at IronPython.Compiler.RuntimeScriptCode.Run()
   at Microsoft.Scripting.SourceUnit.Execute()
   at Microsoft.Scripting.Hosting.ScriptSource.Execute()
   at Microsoft.Scripting.Hosting.ScriptEngine.Execute(String
expression)

   at SLHosting.MainPage.b__0(Object s,
DoWorkEventArgs e)
   at
System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
   at System.ComponentModel.BackgroundWorker.OnRun(Object
argument)
  InnerException:


runtime.ImportModule("imptest"); is similar story so I guess it
cannot be done, right?

--
-- Lukáš



On 18.8.2010 5:05, Jimmy Schementi wrote:

True, but according to his exception stack it never gets there
... it throws on the "runtime =
DynamicEngine.CreateRuntime(true);" line. It throws because
somewhere in that method it doesn't dispatch to the UI thread as
you described. Those are the fixes I need to do.

~Jimmy


2010/8/17 Dave Curylo mailto:cury...@asme.org>>

Lukas,

I think the problem is the RunWorkerCompleted handler trying
to update the UI. Wrap calls from a background thread to
update UI controls in something like this so the Dispatcher
updates any controls on the UI thread:

this.Dispatcher.BeginInvoke(() =>
{
    this.textBlock1.Text = "IronPython loaded";
});

Hope that helps.

-Dave

2010/8/17 Lukas Cenovsky mailto:cenov...@bakalari.cz>>

 Hi all,
is it possible to load IronPython engine in the
background thread in Silverlight?

I tried to load it via BackgroundWorker

Re: [IronPython] Help me IronPython + pybluez + VBNET

2010-08-22 Thread Lukas Cenovsky
 I guess Pybluez is not pure Python module and uses some C code, so to 
make it work in IronPython, try IronClad: http://code.google.com/p/ironclad/


--
-- Lukás(


On 21.8.2010 19:33, Sebastian Urbanski wrote:

Hello, i'm a student from Argentina
I am developing an application that send and receive SMS messages.
This works fine in Python + Pybluez, but when i want to execute this 
code from VBNET, i have problems. Ironpython can't resolve 
the bluetooth import
I am using NET 2008, python 2.6, Iron python 2.6 and 
PyBluez-0.18.win32-py2.6.exe
Here i have a testing class "HelloWorl.py" to try to import package 
bluetooth. The error result in NET is "global name 'discover_devices' 
is not defined"

import clr
import sys
sys.path.append(r"C:\Python26\Lib")
sys.path.append(r"C:\Python26\Lib\site-packages")
import bluetooth
import select
clr.AddReference('prueba')
from prueba import HelloWorldVB
class HelloWorldIronPython(HelloWorldVB):
def HelloWorld(self, name):
return "Hello '" + name + "' from IronPython"
Bluetooth's package is installed in the following path: 
C:\Python26\Lib\site-packages\bluetooth

I founded the function discover_devices and it is in bluez.py
If i try to import directly the bluez.py i have another error. 
Ironpython not found the _bluetooth import.

import sys
import struct
import binascii
from btcommon import *
import _bluetooth as _bt
import array
import fcntl
Here my code for NET (solutions name is "prueba"):

Private

Sub Button1_Click(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles Button1.Click Dim helloWorld As New 
HelloWorldVB()


MsgBox(helloWorld.HelloWorld(

"Maurice")) Dim runtime As ScriptRuntime = 
IronPython.Hosting.Python.CreateEngine.Runtime Dim scope As 
ScriptScope = runtime.ExecuteFile("HelloWorld.py") Dim pythonType As 
PythonType = scope.GetVariable(Of PythonType)("HelloWorldIronPython")


helloWorld =

CType(runtime.Operations.Invoke(pythonType), HelloWorldVB)

MsgBox(helloWorld.HelloWorld(

"Maurice")) End Sub

Public

Class HelloWorldVB Public Overridable Function HelloWorld(ByVal name 
As String) As String Return String.Format("Hello '{0}' from Visual 
Basic", name) End Function


End

Class
Any idea to import correctly the package bluetooth
Thanks!!!
Sebastian


___
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] WPF / ipy: renewing data binding? Could use some guidance.

2010-08-18 Thread Lukas Cenovsky
 Have you tried manually refreshing the CollectionView after update by 
CollectionView.Refresh()?


--
-- Lukás(


On 18.8.2010 17:35, Ken MacDonald wrote:
I have inherited a WPF/ipy app which is using data binding / 
CollectionView to interact with a customer list. Steps are roughly:


1. query cust. list from DB, sorted by name
2. bind this to a CollectionView
3. step through the list, displaying 1 cust. at a time using the 
CollectionView.Next/Previous (forget the exact name) operators,

moved thru the list in alpha-sorted order
4. re-sort the list by, say, customer type. Still moves thru the list 
with Next/Previous except now sorted by type, no longer by alpha.

Perfect so far, but

5. New customers (maybe) have been added to the DB. I re-query the 
customer list to pick up any new ones. The new list is sorted by  
customer type (remembered my last sort criteria).

6. bind this to a CollectionView.
7. step thru the list, using Next/Previous on the CollectionView. The 
customers appear in *utterly random order*, not by alpha, not by 
customer type.


So, I'm a bit stymied. I've been looking through the MSDN but haven't 
seen anything that addresses how to update CollectionView/data binding 
to reflect new data in the customer list, or whether it is, in fact, 
possible to do so. I've found a couple of hints, and tried dozens of 
variations on the code that seems like it should "just work". It's 
quite tempting to just maintain my own lists and navigation in python.


I've deliberately NOT included any code; for one thing, it's scattered 
over a number of modules of python (and XAML) but am interested in how 
any of you would approach the re-binding-to-new-data problem; also, if 
any of you tried it and found it equally as bizarre and arcane and 
impossible as it seems to be for my app.

Thanks!
Ken


___
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] Hosting IronPython in Silverlight - background loading

2010-08-18 Thread Lukas Cenovsky


  
  
Looks like there is a bug in DynamicEngine. When I tried the old
way, it works:

private void UserControl_Loaded(object sender, RoutedEventArgs
  ev)
  {
      IPloader = new BackgroundWorker();
      IPloader.DoWork += new DoWorkEventHandler((s, e) =>
      {
      ScriptRuntimeSetup setup = new ScriptRuntimeSetup();
     
  setup.LanguageSetups.Add(Python.CreateLanguageSetup(null));
      setup.HostType =
  typeof(Microsoft.Scripting.Silverlight.BrowserScriptHost);
      setup.DebugMode = true;
      runtime = new ScriptRuntime(setup);
      engine = Python.GetEngine(runtime);
      foreach (string str in new string[] { "mscorlib",
  "System", "System.Windows", "System.Windows.Browser", "System.Net"
  })
      {
     
runtime.LoadAssembly(runtime.Host.PlatformAdaptationLayer.LoadAssembly(str));
      }
      // engine.Execute("import imptest"); --this does not
  work
      }
      );
      IPloader.RunWorkerCompleted += new
  RunWorkerCompletedEventHandler((s, e) =>
      {
      this.textBlock1.Text = "IronPython loaded";
      }
      );
      IPloader.RunWorkerAsync();
  }

What does not work is importing modules in the background thread
(commented line). It throws the following exception:

System.InvalidOperationException was unhandled by user code
    Message=This operation can only occur on the UI Thread.
    StackTrace:
     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.ImportTop(CodeContext
  context, String fullName, Int32 level)
     at
  Microsoft.Scripting.Interpreter.FuncCallInstruction`4.Run(InterpretedFrame
  frame)
     at
  Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame
  frame)
     at
  Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet](T0 arg0)
     at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope
  scope)
     at IronPython.Compiler.RuntimeScriptCode.Run()
     at Microsoft.Scripting.SourceUnit.Execute()
     at Microsoft.Scripting.Hosting.ScriptSource.Execute()
     at Microsoft.Scripting.Hosting.ScriptEngine.Execute(String
  _expression_)
     at SLHosting.MainPage.b__0(Object
  s, DoWorkEventArgs e)
     at
  System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
     at System.ComponentModel.BackgroundWorker.OnRun(Object
  argument)
    InnerException: 

runtime.ImportModule("imptest"); is similar story so I
guess it cannot be done, right?

--
-- Lukáš


On 18.8.2010 5:05, Jimmy Schementi wrote:
True, but according to his exception stack it never
  gets there ... it throws on the "runtime =
  DynamicEngine.CreateRuntime(true);" line. It throws because
  somewhere in that method it doesn't dispatch to the UI thread as
  you described. Those are the fixes I need to do.
  
  ~Jimmy
  
  
  2010/8/17 Dave Curylo <cury...@asme.org>

  Lukas,
  
  
  I think the problem is the RunWorkerCompleted handler
trying to update the UI. Wrap calls from a background thread
to update UI controls in something like this so the
Dispatcher updates any controls on the UI thread:
  
  
  
this.Dispatcher.BeginInvoke(() =>

      {
          this.textBlock1.Text = "IronPython loaded";
      });
  
  

    Hope that helps.

  

-Dave

2010/8/17 Lukas Cenovsky <cenov...@bakalari.cz>
  

  
 Hi all,
is it possible to load IronPython engine in the
background thread in Silverlight?

I tried to load it via BackgroundWork

Re: [IronPython] Chasing memory leak in IronPython scripts

2010-08-17 Thread Lukas Cenovsky

 On 18.8.2010 7:25, yngipy hernan wrote:

Hi All,

I have an IronPython script that is using/talking to COM server. I am 
not sure if I have a memory leak but the IronPython Private Byte keeps 
on growing. I haven't seen it run of memory but I might be leaking memory.


Essential I am using an interop dll to connect to the COM server. Call 
some methods and disconnects. I have created another script to stress 
test this "library" to basically connect to COM server. Then 
repeatedly create COM objects, call methods, do intermediate cleanup 
by calling Marshal.ReleaseComObject. This part seems like leaking memory.


Now my question is:
- Can anyone point me to a tutorial on detecting memory leak in 
IronPython?

- Do we have tools that can help me in detecting any dangling objects?


WinDbg is you friend for your problem. Check this blog:
http://blog.kamil.dworakowski.name/2008/02/debugging-memory-problems-in-ironpython.html

--
-- Lukáš

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


[IronPython] Hosting IronPython in Silverlight - background loading

2010-08-17 Thread Lukas Cenovsky

 Hi all,
is it possible to load IronPython engine in the background thread in 
Silverlight?


I tried to load it via BackgroundWorker:

private void UserControl_Loaded(object sender, RoutedEventArgs ev)
{
IPloader = new BackgroundWorker();
IPloader.DoWork += new DoWorkEventHandler((s, e) =>
{
runtime = DynamicEngine.CreateRuntime(true); // debug mode true
engine = runtime.GetEngine("python");
}
);
IPloader.RunWorkerCompleted += new 
RunWorkerCompletedEventHandler((s, e) =>

{
this.textBlock1.Text = "IronPython loaded";
}
);
IPloader.RunWorkerAsync();
}

It fails with the following exception:

System.UnauthorizedAccessException was unhandled by user code
  Message=Invalid cross-thread access.
  StackTrace:
   at MS.Internal.XcpImports.CheckThread()
   at 
System.Windows.DependencyObject.GetValueInternal(DependencyProperty dp)

   at System.Windows.Deployment.get_Parts()
   at 
Microsoft.Scripting.Silverlight.DynamicAppManifest.AssemblyParts()

   at Microsoft.Scripting.Silverlight.DynamicAppManifest..ctor()
   at Microsoft.Scripting.Silverlight.DynamicEngine.CreateLangConfig()
   at 
Microsoft.Scripting.Silverlight.DynamicEngine.CreateRuntimeSetup(Boolean 
debugMode)
   at 
Microsoft.Scripting.Silverlight.DynamicEngine.CreateRuntime(Boolean 
debugMode)
   at SLHosting.MainPage.b__0(Object s, 
DoWorkEventArgs e)
   at 
System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)

   at System.ComponentModel.BackgroundWorker.OnRun(Object argument)
  InnerException:

Thanks for any advice.

--
-- Lukáš

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


Re: [IronPython] IronPython / DLR Direction

2010-08-12 Thread Lukas Cenovsky

 Thank you for the info.

--
-- Lukas


On 12.8.2010 17:34, Dave Fugate wrote:


All the team can say at this point is that there's an official comment 
from Microsoft on Mary-Jo Foley's blog -- see "Update (August 10)" on 
http://www.zdnet.com/blog/microsoft/whats-next-for-microsofts-ironruby/7034?tag=mantle_skin;content. 



Dave

*From:* users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Hank Fay

*Sent:* Thursday, August 12, 2010 8:05 AM
*To:* Discussion of IronPython
*Subject:* Re: [IronPython] IronPython / DLR Direction

Ouch!  If PR is the answer, then the wrong question has been asked.

And I agree: the people in the middle aren't in a position to comment.

Hank

PS: When did the relief at getting out of middle hit you?  Spokane? 
 S. Dakota? Minnesota?  Having been in that kind of position, I 
know it took a little while for it to sink in when I was out of the 
middle.  I think it was about the 3rd day out on the road for me.


On Thu, Aug 12, 2010 at 10:24 AM, Jimmy Schementi > wrote:


Let's not push Dino or Bill to say anything; This is a enough of a 
high-profile issue that I'm sure Microsoft's PR firms are working on 
this. Unfortunately, we'll just have to be patient.


~Jimmy



On Thu, Aug 12, 2010 at 6:02 AM, Eyvind Axelsen 
mailto:eyvind.axel...@profdoc.no>> wrote:


So, no response from the IPY team on this issue?

Eyvind.

*Fra:* users-boun...@lists.ironpython.com 
 
[mailto:users-boun...@lists.ironpython.com 
] *På vegne av* yngipy hernan

*Sendt:* 10. august 2010 05:46
*Til:* Discussion of IronPython
*Emne:* Re: [IronPython] IronPython / DLR Direction

I completely agree with IPy being Microsoft-supported lowers the 
barrier of entry to enterprise use. I have this problem long time back 
using Python as the company is a Microsoft shop (mostly). But 
IronPython being Microsoft pretty much is approved already, no 
question ask.


I am hoping to hear that IronPython will be supported by MS in the 
next 2 to 5 years or longer ( forever :-) ) if possible.


-yngipy

On Mon, Aug 9, 2010 at 4:34 PM, Hank Fay > wrote:


Hi Tony,

I have to agree about the barrier being lower if IPy is 
Microsoft-supported (as all the Iron* languages were announced to be). 
 I had a discussion in January with a market-leader in another 
country, and their project manager could accept IronPython, barely. 
 His take was: I want to be able to easily hire programmers for 
customization and/or sourcecode escrow clause necessity. 
 Customization wasn't really an issue (the program uses hooks for 
customization), as he could hire his bevy of C# developers to do that, 
but if he had to maintain sourcecode that would be a different story.


Having come from a very productive dynamic language (Visual FoxPro) 
that MS first said could not be ported to .Net, and then when it 
obviously was possible (in 2005) made no attempt to do so, I'm having 
a deja vu experience all over again.  I'll try not to be as cynical 
and sarcastic as last time, but I'm having to hold my arm down (shades 
of Dr. Strangelove) and hold my tongue to prevent shouting out "Middle 
Management Uber Alles!" (referencing Jimmy's blog post).


And so it goes...

Hank

On Mon, Aug 9, 2010 at 12:43 AM, Tony Meyer > wrote:


On Sun, Aug 8, 2010 at 6:19 AM, Jeff Hardy > wrote:

> if [Iron*] die, doesn't that mean MS made the right choice after all?

I don't think that's true.  .NET isn't just another platform - it's
Microsoft's own platform.  Some thoughts:

Like it or not, and whether it *should* be the case or not, in many
organisations (or even teams) if a technology is from Microsoft then
it's automatically approved, or at least much easier to approve.  The
barrier to using Iron* is much lower because they are Microsoft
products - this is even more the case with Visual Studio integration.

Although Iron* are open-source (which is great, obviously), they
aren't typical open-source communities, because of the (somewhat
understandable) restriction about accepting code, and the leadership
all (AFAIK) being within Microsoft.  Microsoft have created this
environment (which has worked fairly well so far), and it's not clear
how easily that can transition to something that's lead by someone (or
ones) outside of Microsoft.

Leadership (or at least involvement) within Microsoft opens
opportunities for Iron* development to influence .NET.  I'm not overly
familiar with the details, but I gather than the DLR approach is
significantly superior to the IPy 1 CLR approach, and that some of the
new dynamic features of C# have benefited from this.  It's hard to see
how a community IronPython could have developed the DLR, and it seems
unlikely that Microsoft would make changes to the CLR to assist it.
(Does the latest Microsoft Javasc

Re: [IronPython] Building IronPython from sources

2010-08-12 Thread Lukas Cenovsky
 This is just confirmation that after installing Silverlight 3 
(3.0.50106.0), building works perfectly.


However finding Silverlight 3 installation is not easy. Eventually, I 
found this link:

http://silverlight.dlservice.microsoft.com/download/0/D/E/0DEAFE9C-8451-4497-8F8B-DFF82B729818/Silverlight.exe

--
-- Lukas


On 27.7.2010 17:31, Dave Fugate wrote:


I'd actually suggest doing this with 2.7 Alpha 1 sources...

*Building* 2./6.1/ requires a Silverlight /3./x installation as there 
were changes to System.Core (e.g., System.Func) between Silverlight 
3.x and Silverlight 4.x.  As you've discovered, we implemented some of 
this missing System.Core functionality ourselves in 2.6.1 which is 
confusing the compiler when there's references to both (4.x) 
System.Core and MS.Scripting.Utils.  If you can't get your hands on a 
Silverlight 3.x installation to fix this, the next easiest route IMO 
would be to use 2.7A1 instead.


*From:* users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Lukas Cenovsky

*Sent:* Tuesday, July 27, 2010 8:09 AM
*To:* Discussion of IronPython
*Subject:* Re: [IronPython] Building IronPython from sources

Thanks. Copying my current Silverlight version 4.0.50524.0 to 
3.0.50106.0 helped and Microsoft.Scripting.dll compiles fine. Now I 
get many following errors  for Microsoft.Dynamic.dll:


Error1'Func' is an ambiguous reference between 
'System.Func' and 
'Microsoft.Scripting.Utils.Func'
C:\IronPython-2.6.1\Src\Runtime\Microsoft.Dynamic\Interpreter\Instructions\CallInstruction.Generated.cs
27870Microsoft.Dynamic


How can I tell Visual Studio to use reference from 
Microsoft.Scripting.Utils? Thanks.


--
-- Lukas


On 26.7.2010 18:21, Dave Fugate wrote:

Hi Lukas, the error message below is because you don't have the 
version of Silverlight installed which was used to build IronPython 
2.6.1.  For this particular release, I believe it was something like 
"%ProgramFiles%\Microsoft Silverlight\3.0.40624.0".  You can find out 
for sure by examining the "" element in 
Src\IronPython\IronPython.csproj.  Any ways, there are two workarounds:


Replace all instances of "3.0.40624.0" throughout all C# project files 
with the version of Silverlight you have installed locally


Copy and rename the version of Silverlight you have installed to 
whatever is expected by the C# project files


Hope that helps,

Dave

*From:* users-boun...@lists.ironpython.com 
<mailto:users-boun...@lists.ironpython.com> 
[mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Lukas Cenovsky

*Sent:* Friday, July 23, 2010 12:37 PM
*To:* Discussion of IronPython
*Subject:* [IronPython] Building IronPython from sources

Hi all,
I have one wish for the next release of IronPython 2.6.2 (hope it is 
not too late...) - please make sure it is possible to build IronPython 
binaries from sources. I have downloaded 
IronPython-2.6.1-Src-Net20SP1.zip 
<http://ironpython.codeplex.com/releases/view/36280#DownloadId=116512> 
and I there is no way for me to build Silverlight binaries from it...


I have opened the solution in VS 2010, solution file was converted to 
the new version, I selected 'Silverlight Debug' as a solution 
configuration and I received meny errors as below when building 
Microsoft.Scripting.dll:


Error11The type 'System.SerializableAttribute' exists in both 
'c:\IronPython-2.6.1\Bin\Silverlight 
Debug\Microsoft.Scripting.Core.dll' and 
'c:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll'
C:\IronPython-2.6.1\Src\Runtime\Microsoft.Scripting\ArgumentTypeException.cs
206Microsoft.Scripting
Error12The type or namespace name 'Serializable' could not be 
found (are you missing a using directive or an assembly reference?)
C:\IronPython-2.6.1\Src\Runtime\Microsoft.Scripting\ArgumentTypeException.cs
206Microsoft.Scripting


My goal was to build debug-able Microsoft.Scripting.Silverlight.dll 
because I'm receiving AddReference error which I'd like to inspect.


--
-- Lukas

  
___

Users mailing list
Users@lists.ironpython.com  <mailto: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] IronPython 2.6.2

2010-08-12 Thread Lukas Cenovsky

 Hi guys,
do you have a release date for IronPython 2.6.2? Thanks.

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


Re: [IronPython] Fwd: [DB-SIG] How can I reliably detect whether an SQL statement is a Query?

2010-08-11 Thread Lukas Cenovsky

 He is probably talking about this:
http://weblogs.asp.net/davidfowler/archive/2010/08/02/introduction-to-microsoft-data-dll.aspx

From reading the article, I don't think it is the way to go.

--
-- Lukas


On 11.8.2010 19:19, Vernon Cole wrote:

Hank:
 Never heard of it (before). A quick search of google and msdn only 
tells me that LightSwitch is soon to be released in beta.  As a full 
time college student (how did I get myself into this at the age of 
60?) I can get access to lots of free, new, and beta stuff.  Do you 
have links?

(send privately if need be.)
--
Vernon

On Tue, Aug 10, 2010 at 12:49 PM, Hank Fay <mailto:h...@prosysplus.com>> wrote:


Hi Vernon,

have you looked at Microsoft.Data.Database, which comes with
LightSwitch?  I think it might have what you need in terms of
methods and properties.  It does require .Net 4.0.

Hank


On Tue, Aug 10, 2010 at 12:41 PM, Vernon Cole
mailto:vernondc...@gmail.com>> wrote:

I am afraid Lukas is very correct.  (Thanks, you really saved
me a lot of debugging time.)

This will be an anti-announcement.  I got a version (2.4.1A1)
of adodbapi working (sort of) on ADO.NET <http://ADO.NET> and
splatted up against enough difficulties that I have shelved
the effort for the present time.  I have committed my efforts
to a new branch (named ado.net <http://ado.net>) on the
mercurial source tree at
http://sourceforge.net/projects/adodbapi/develop for anyone
who would like to take up the effort.  It might be worthwhile
to continue development on an SQL-server specific version,
especially if someone has MONO in mind.  Since I intended
adodbapi to be as universal as possible, I did not want to go
that direction.

The problems I found were:
1) Lukas was right -- only one datareader per connection.
Messes up cursor usage as per the api.
2) cursor.rowcount becomes useless for SELECTs.
3) Connection timeouts are only supported by adding text to
the connection strings -- which breaks JET.
4) The "internal size" for cursor.description[3] cannot be
retrieved.
5) fine control of cursor location and isolation level is lost.
6) MS documentation vaguely suggests that using ExecuteReader
for a command which returns no dataset is a bad idea, which
may mean that there is a problem with a stored procedure which
may not return a dataset.
7) MS documentation hints that schema results (which are
processed into cursor.description) may be incorrect unless a
"keyinfo" flag is passed to ExecuteReader, the use of which
will cause several possible side effects to the data retrieval.
8) Use of a datareader implies no recordset, so I have to
emulate a recordset within my SQLrows object.
9) ADO.NET <http://ADO.NET> still uses a COM interface
internally to communicate with ADO data adapters -- so what's
the point of not using COM directly in my code and keeping all
of the lost features?

So the COM implementation of adodbapi v2.4.0 will remain as
the official "latest and greatest" for IronPython.

Thanks for all the fish...
    Vernon Cole


On Tue, Aug 3, 2010 at 2:17 PM, Lukas Cenovsky
mailto:cenov...@bakalari.cz>> wrote:

On 3.8.2010 1:24, Vernon Cole wrote:

What are the consequences of using ExecuteReader() when
there is
nothing to read? If none, i.e. you get an empty set of
results, then I
would say to use that all the time, and don't bother to
examine your
SQL at all.



I think ExecuteReader should work for everything. I use
only ExecuteReader in my private tool (but I do not use
stored procedures).

You will have a bigger problem with ADO.NET
<http://ADO.NET> than this. According to the Python dbapi
specification, you can have as many cursors per connection
as you want. You can have many cursors in ADO.NET
<http://ADO.NET> too, but you can have only one
SqlDataReader per connections which makes several cursors
per connection useless.

--
-- Lukas

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



___
Users mailing list
Users@lists.ironpython.com <mailto:Users@lists.ironpython.com>
http://lists.ironpython.com/lis

Re: [IronPython] IronPython Silverlight 4 debugging... [No errors just not working]

2010-08-11 Thread Lukas Cenovsky

 On 11.8.2010 19:11, Andrew Evans wrote:

Ok well it doesn't look like my event handlers are even being called

this is what I did

def KeyDown_Control(self, s, e):
if e.Key == Key.Right:
print "Right Arrow"
#self.canvas.SetLeft(self.ship, 
self.canvas.GetLeft(self.ship) + velocity)

elif e.Key == Key.Left:
print "Left Arrow"
#self.canvas.SetLeft(self.ship, 
self.canvas.GetLeft(self.ship) - velocity)

elif e.Key == Key.Up:
print "Up Arrow"
#self.canvas.SetTop(self.ship, 
self.canvas.GetTop(self.ship) - velocity)

elif e.Key == Key.Down:
print "Down Arrow"
#self.canvas.SetTop(self.ship, 
self.canvas.GetTop(self.ship) + velocity)


So assuming that's the issue which is likely than it would be this line

# This line should be something different Not sure what to use instead 
of this

self.ship.KeyDown += KeyEventHandler(self.KeyDown_Control)


What about
self.ship.KeyDown += self.KeyDown_Control

--
-- Lukas




Which I assumed all this time

Any ideas what it should be?

*cheers

Andrew

On Wed, Aug 11, 2010 at 9:37 AM, Michael Foord 
mailto:fuzzy...@voidspace.org.uk>> wrote:


On 11/08/2010 17:34, Andrew Evans wrote:

Hello I am running IronPython 2.7A and trying to debug a
Silverlight app. I am trying to figure out why my ship doesn't
move when I press the Arrow keys.

here is the complete source minus most imports :D

Put some debugging in (append text to an html div) to see if your
event handlers are being fired. That would my first step.

Michael



Any ideas

from System.Windows.Input import *


velocity = 10

class Gui():
def __init__(self):

self.grid = Grid()
self.canvas = Canvas(Background =
SolidColorBrush(Colors.White))
self.canvas.Width = 640
self.canvas.Height = 432
self.bgImage = Image(
Source = BitmapImage(Uri("images/background.jpg",
UriKind.Relative))
)
self.canvas.SetTop(self.bgImage, 132)
self.canvas.SetLeft(self.bgImage, 0)
#self.textblock = TextBlock()
##self.textblock.FontSize = 24
##self.textblock.Text = 'This Really Works!!'
##self.canvas.Children.Add(self.textblock)

self.ship = Image(
Source = BitmapImage(Uri("images/ship.png",
UriKind.Relative))
)

self.canvas.SetTop(self.ship, 75)
self.canvas.SetLeft(self.ship, 25)

CompositionTarget.Rendering += EventHandler(self.ShootBG)
##self.GenerateStarField(350)

self.canvas.Children.Add(self.bgImage)

self.canvas.Children.Add(self.ship)
self.grid.Children.Add(self.canvas)
Application.Current.RootVisual = self.grid
# This line should be something different Not sure what
to use instead of this
self.ship.KeyDown += KeyEventHandler(self.KeyDown_Control)


def ShootBG(self, s, e):
self.canvas.SetLeft(self.bgImage,
self.canvas.GetLeft(self.bgImage) - 1)
if self.canvas.GetLeft(self.bgImage) < -2110:
self.canvas.SetLeft(self.bgImage, 0)

def KeyDown_Control(self, s, e):
if e.Key == Key.Right:
self.canvas.SetLeft(self.ship,
self.canvas.GetLeft(self.ship) + velocity)
elif e.Key == Key.Left:
self.canvas.SetLeft(self.ship,
self.canvas.GetLeft(self.ship) - velocity)
elif e.Key == Key.Up:
self.canvas.SetTop(self.ship,
self.canvas.GetTop(self.ship) - velocity)
elif e.Key == Key.Down:
self.canvas.SetTop(self.ship,
self.canvas.GetTop(self.ship) + velocity)

gui = Gui()
gui


___
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

READ CAREFULLY. By accepting and reading this email you agree, on behalf of 
your employer, to release me from all obligations and waivers arising from any 
and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, 
clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and 
acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your 
employer, its partners, licensors, agents and assigns, in perpetuity, without 
prejudice to my ongoing rights and privileges. You further represent that you 
have the authority to release me from any BOGUS AGREEMENTS on behalf of your 
employer.



___
Users mailing list
Users@lists.ironpython.com 

Re: [IronPython] Using isolated storage from IronPython in the browser

2010-08-10 Thread Lukas Cenovsky

 Isn't it this issue?
http://lists.ironpython.com/pipermail/users-ironpython.com/2010-March/012376.html

--
-- Lukas


On 10.8.2010 15:58, Dave Curylo wrote:
I'm attempting to use IsolatedStorage from IronPython running the 
browser, and I keep running into the following error.  Any idea what 
I'm doing wrong or is this functionality currently unsupported?


Best regards,
Dave

MethodAccessException: Security transparent method 
System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForSite() cannot 
access 
Microsoft.Scripting.Actions.Calls.MethodCandidate+Caller.Call(System.Object[], 
Boolean ByRef) using reflection.

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

http://www.w3.org/1999/xhtml";>


window.DLR = { path: 'ipy' }






from System.IO import (FileMode, StreamWriter)
from System.IO.IsolatedStorage import IsolatedStorageFile
with IsolatedStorageFile.GetUserStoreForSite() as store:
with IsolatedStorageFileStream("test.txt", FileMode.Create, store) as stream:
with StreamWriter(stream) as writer:
writer.WriteLine("Testing from IPy in Browser.")





___
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] IronPython / DLR Direction

2010-08-07 Thread Lukas Cenovsky
 Very disappointing news... I only hope it won't happen to IronPython 
as I am working on business app in it.


By the way - this is good post about the situation: 
http://evain.net/blog/articles/2010/08/07/on-ironruby


--
-- Lukas

On 7.8.2010 17:42, David Seruyange wrote:
Just woke up and caught wind of a post that the IronRuby project is 
not being continued under the auspices of Microsoft (see: 
http://blog.jimmy.schementi.com/2010/08/start-spreading-news-future-of-jimmy.html). 
Is the same true of IronPython and are they disbanding the Microsoft 
team?


David


___
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] Fwd: [DB-SIG] How can I reliably detect whether an SQL statement is a Query?

2010-08-03 Thread Lukas Cenovsky

 On 3.8.2010 1:24, Vernon Cole wrote:

What are the consequences of using ExecuteReader() when there is
nothing to read? If none, i.e. you get an empty set of results, then I
would say to use that all the time, and don't bother to examine your
SQL at all.



I think ExecuteReader should work for everything. I use only 
ExecuteReader in my private tool (but I do not use stored procedures).


You will have a bigger problem with ADO.NET than this. According to the 
Python dbapi specification, you can have as many cursors per connection 
as you want. You can have many cursors in ADO.NET too, but you can have 
only one SqlDataReader per connections which makes several cursors per 
connection useless.


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


Re: [IronPython] Announcing adodbapi version 2.4.0 -- with COLUMN NAME data access

2010-08-01 Thread Lukas Cenovsky

 Hi all,
I have developed my internal tool for accessing SQL server and FoxPro 
.dbf files. It is inspired by PEP 249 too but it uses  
System.Data.SqlClient.SqlConnection respectively 
System.Data.OleDb.OleDbConnection (vfpoledb.dll). It's main goal is to 
cover differences between SQL server and FoxPro.


If anybody is interested, let me know and I will try to make it public.

--
-- Lukás(


On 31.7.2010 9:42, Vernon Cole wrote:

Announcing a new version of adodbapi...

[ for those who may not know...
[ adodbapi is a pure Python package which fully implements the PEP-249 
db-api

[ using Microsoft ADO/db.
[ It runs on CPython versions 2.3 and later, IronPython 2.6 and later,
[ or Python 3.0 and later.

I have often been frustrated by the need to count '?' marks for input 
parameters

and remembering column numbers to get my SQL output.
This release fixes that by allowing the use of 'named' parameters as 
an option,

and by returning 'SQLrow' objects which allow the use of column names.

This version includes a distutils setup.py file, so installation is easy.
Just
  1) unzip
  2) "cd" to the directory you just unzipped.
  2) Execute the command:
  python setup.py install
  using the python distribution of your choice.
It even runs 2to3 automatically if you run it using a 3.n Python.
(Why didn't I do this years ago?)

NOTE:  on Vista (and 7?) you must run setup.py using the administrator 
account to install on IronPython,

because setup.py does not elevate privileges for the source installer.
(Distutils can create a stand-alone binary installer which does 
elevate privileges, but that feature is not yet supported by 
IronPython because it has no zip library.)


ALSO NOTE: I have _used_ this package with IronPython 2.7.A1, but not 
_tested_ it, because 2.7's unittest package is broken.


Here's what's new

* adodbapi version 2.4.0 -- in this version,
   "fetchall()" and "fetchmany()" return an SQLrows object
   ...which emulates a sequence of SQLrow objects.
   "fetchone()" or the cursor's "next()" method return an SQLrow object.
   An SQLrow object emulates a tuple of data fields.
   An SQLrow object also appears to have an attribute for each column 
of data.

   therefore...
>>> import adodbapi
>>> myConnection = adodbapi.connection('someDSN')
>>> cur = myConnection.cursor()
>>> cur.execute("select name, rank, serialNumber from soldiers")
>>> row = cur.fetchone()
>>> assert row[0] == row['name']
>>> assert row[1] == row.rank
>>> rows = cur.fecthall()
>>> assert rows[4,'serialNumber'] == rows[4][2]

* adodbapi version 2.3.0 -- this is includes major refactoring and
   specifically adds features for django support, including the 
ability for the
   programmer to change ado's SQL "paramstyle" at run time to select 
between

   'qmark', 'format' and 'named' methods of passing SQL parameters.
** also, in response to user requests, adodbapi will now use client-side
   cursors by default.  This will make rowcount and stored procedure 
return

   parameter values more readily available.


___
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] Building IronPython from sources

2010-07-27 Thread Lukas Cenovsky

 Thanks for the info Dave. However, I still smell a catch here :-)

What means no build support for IronPython 2.6.x and Silverlight 4 - 
considering the functionality? Can I use all functionality of 
Silverlight 4 with Silverlight 3 based assemblies? What is a difference 
between Silverlight 3 and Silverlight 4 based assemblies?


--
-- Lukas


On 27.7.2010 19:18, Dave Fugate wrote:


Hi Lukas, the deal is IronPython 2.6.x (where x>0) will /run/ against 
.NET 2.0 SP1, .NET 4.0, Silverlight 3, and *Silverlight 4*.  You'll 
only be able to /build/ IronPython 2.6.x against .NET 2.0 SP1, .NET 
4.0, and Silverlight 3 though.  In other words, we will not be back 
porting Silverlight 4 /build/ support to the 2.6.x release series as 
we're really trying to limit 2.6.2 and later 2.6.x releases to bug 
fixes only.


With IronPython 2.7, we'll provide .NET 4.0 and Silverlight 4 based 
assemblies.  This said, we intend on continuing to provide the 
capability of /building/ IronPython 2.7 against .NET 3.5 and 
Silverlight 3 via IronPython sources obtained from the DLR CodePlex 
source repository.


Thanks,

Dave

*From:* users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Lukas Cenovsky

*Sent:* Tuesday, July 27, 2010 9:49 AM
*To:* Discussion of IronPython
*Subject:* Re: [IronPython] Building IronPython from sources

I am a little bit confused about Silverlight, .NET and IronPython 
versions.


Here is a list what I think is valid, please correct me if I am wrong:

* IronPython 2.6.1 supports Silverlight 3 + .NET 2 SP1
* IronPython 2.6.1 does not support Silverlight 4 + .NET 2 SP1 or
  Silverlight 4 + .NET 4
* IronPython 2.7 will support Silverlight 4 + .NET 4


What will IronPython 2.6.2 support?

--
-- Lukas


On 27.7.2010 17:31, Dave Fugate wrote:

I'd actually suggest doing this with 2.7 Alpha 1 sources...

*Building* 2./6.1/ requires a Silverlight /3./x installation as there 
were changes to System.Core (e.g., System.Func) between Silverlight 
3.x and Silverlight 4.x.  As you've discovered, we implemented some of 
this missing System.Core functionality ourselves in 2.6.1 which is 
confusing the compiler when there's references to both (4.x) 
System.Core and MS.Scripting.Utils.  If you can't get your hands on a 
Silverlight 3.x installation to fix this, the next easiest route IMO 
would be to use 2.7A1 instead.


*From:* users-boun...@lists.ironpython.com 
<mailto:users-boun...@lists.ironpython.com> 
[mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Lukas Cenovsky

*Sent:* Tuesday, July 27, 2010 8:09 AM
*To:* Discussion of IronPython
*Subject:* Re: [IronPython] Building IronPython from sources

Thanks. Copying my current Silverlight version 4.0.50524.0 to 
3.0.50106.0 helped and Microsoft.Scripting.dll compiles fine. Now I 
get many following errors  for Microsoft.Dynamic.dll:


Error1'Func' is an ambiguous reference between 
'System.Func' and 
'Microsoft.Scripting.Utils.Func'
C:\IronPython-2.6.1\Src\Runtime\Microsoft.Dynamic\Interpreter\Instructions\CallInstruction.Generated.cs
27870Microsoft.Dynamic


How can I tell Visual Studio to use reference from 
Microsoft.Scripting.Utils? Thanks.


--
-- Lukas


On 26.7.2010 18:21, Dave Fugate wrote:

Hi Lukas, the error message below is because you don't have the 
version of Silverlight installed which was used to build IronPython 
2.6.1.  For this particular release, I believe it was something like 
"%ProgramFiles%\Microsoft Silverlight\3.0.40624.0".  You can find out 
for sure by examining the "" element in 
Src\IronPython\IronPython.csproj.  Any ways, there are two workarounds:


Replace all instances of "3.0.40624.0" throughout all C# project files 
with the version of Silverlight you have installed locally


Copy and rename the version of Silverlight you have installed to 
whatever is expected by the C# project files


Hope that helps,

Dave

*From:* users-boun...@lists.ironpython.com 
<mailto:users-boun...@lists.ironpython.com> 
[mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Lukas Cenovsky

*Sent:* Friday, July 23, 2010 12:37 PM
*To:* Discussion of IronPython
*Subject:* [IronPython] Building IronPython from sources

Hi all,
I have one wish for the next release of IronPython 2.6.2 (hope it is 
not too late...) - please make sure it is possible to build IronPython 
binaries from sources. I have downloaded 
IronPython-2.6.1-Src-Net20SP1.zip 
<http://ironpython.codeplex.com/releases/view/36280#DownloadId=116512> 
and I there is no way for me to build Silverlight binaries from it...


I have opened the solution in VS 2010, solution file was converted to 
the new version, I selected 'Silverlight Debug' as a solution 
configuration and I received meny errors as below when building 
Microsoft.Scripting.dll:


Error11The type '

Re: [IronPython] Building IronPython from sources

2010-07-27 Thread Lukas Cenovsky
 I am a little bit confused about Silverlight, .NET and IronPython 
versions.


Here is a list what I think is valid, please correct me if I am wrong:

   * IronPython 2.6.1 supports Silverlight 3 + .NET 2 SP1
   * IronPython 2.6.1 does not support Silverlight 4 + .NET 2 SP1 or
 Silverlight 4 + .NET 4
   * IronPython 2.7 will support Silverlight 4 + .NET 4


What will IronPython 2.6.2 support?

--
-- Lukas


On 27.7.2010 17:31, Dave Fugate wrote:


I'd actually suggest doing this with 2.7 Alpha 1 sources...

*Building* 2./6.1/ requires a Silverlight /3./x installation as there 
were changes to System.Core (e.g., System.Func) between Silverlight 
3.x and Silverlight 4.x.  As you've discovered, we implemented some of 
this missing System.Core functionality ourselves in 2.6.1 which is 
confusing the compiler when there's references to both (4.x) 
System.Core and MS.Scripting.Utils.  If you can't get your hands on a 
Silverlight 3.x installation to fix this, the next easiest route IMO 
would be to use 2.7A1 instead.


*From:* users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Lukas Cenovsky

*Sent:* Tuesday, July 27, 2010 8:09 AM
*To:* Discussion of IronPython
*Subject:* Re: [IronPython] Building IronPython from sources

Thanks. Copying my current Silverlight version 4.0.50524.0 to 
3.0.50106.0 helped and Microsoft.Scripting.dll compiles fine. Now I 
get many following errors  for Microsoft.Dynamic.dll:


Error1'Func' is an ambiguous reference between 
'System.Func' and 
'Microsoft.Scripting.Utils.Func'
C:\IronPython-2.6.1\Src\Runtime\Microsoft.Dynamic\Interpreter\Instructions\CallInstruction.Generated.cs
27870Microsoft.Dynamic


How can I tell Visual Studio to use reference from 
Microsoft.Scripting.Utils? Thanks.


--
-- Lukas


On 26.7.2010 18:21, Dave Fugate wrote:

Hi Lukas, the error message below is because you don't have the 
version of Silverlight installed which was used to build IronPython 
2.6.1.  For this particular release, I believe it was something like 
"%ProgramFiles%\Microsoft Silverlight\3.0.40624.0".  You can find out 
for sure by examining the "" element in 
Src\IronPython\IronPython.csproj.  Any ways, there are two workarounds:


Replace all instances of "3.0.40624.0" throughout all C# project files 
with the version of Silverlight you have installed locally


Copy and rename the version of Silverlight you have installed to 
whatever is expected by the C# project files


Hope that helps,

Dave

*From:* users-boun...@lists.ironpython.com 
<mailto:users-boun...@lists.ironpython.com> 
[mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Lukas Cenovsky

*Sent:* Friday, July 23, 2010 12:37 PM
*To:* Discussion of IronPython
*Subject:* [IronPython] Building IronPython from sources

Hi all,
I have one wish for the next release of IronPython 2.6.2 (hope it is 
not too late...) - please make sure it is possible to build IronPython 
binaries from sources. I have downloaded 
IronPython-2.6.1-Src-Net20SP1.zip 
<http://ironpython.codeplex.com/releases/view/36280#DownloadId=116512> 
and I there is no way for me to build Silverlight binaries from it...


I have opened the solution in VS 2010, solution file was converted to 
the new version, I selected 'Silverlight Debug' as a solution 
configuration and I received meny errors as below when building 
Microsoft.Scripting.dll:


Error11The type 'System.SerializableAttribute' exists in both 
'c:\IronPython-2.6.1\Bin\Silverlight 
Debug\Microsoft.Scripting.Core.dll' and 
'c:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll'
C:\IronPython-2.6.1\Src\Runtime\Microsoft.Scripting\ArgumentTypeException.cs
206Microsoft.Scripting
Error12The type or namespace name 'Serializable' could not be 
found (are you missing a using directive or an assembly reference?)
C:\IronPython-2.6.1\Src\Runtime\Microsoft.Scripting\ArgumentTypeException.cs
206Microsoft.Scripting


My goal was to build debug-able Microsoft.Scripting.Silverlight.dll 
because I'm receiving AddReference error which I'd like to inspect.


--
-- Lukas

  
___

Users mailing list
Users@lists.ironpython.com  <mailto: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] Building IronPython from sources

2010-07-27 Thread Lukas Cenovsky
 Thanks. Copying my current Silverlight version 4.0.50524.0 to 
3.0.50106.0 helped and Microsoft.Scripting.dll compiles fine. Now I get 
many following errors  for Microsoft.Dynamic.dll:


Error1'Func' is an ambiguous reference between 
'System.Func' and 
'Microsoft.Scripting.Utils.Func'
C:\IronPython-2.6.1\Src\Runtime\Microsoft.Dynamic\Interpreter\Instructions\CallInstruction.Generated.cs
27870Microsoft.Dynamic


How can I tell Visual Studio to use reference from 
Microsoft.Scripting.Utils? Thanks.


--
-- Lukas


On 26.7.2010 18:21, Dave Fugate wrote:


Hi Lukas, the error message below is because you don't have the 
version of Silverlight installed which was used to build IronPython 
2.6.1.  For this particular release, I believe it was something like 
"%ProgramFiles%\Microsoft Silverlight\3.0.40624.0".  You can find out 
for sure by examining the "" element in 
Src\IronPython\IronPython.csproj.  Any ways, there are two workarounds:


· Replace all instances of "3.0.40624.0" throughout all C# project 
files with the version of Silverlight you have installed locally


· Copy and rename the version of Silverlight you have installed to 
whatever is expected by the C# project files


Hope that helps,

Dave

*From:* users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Lukas Cenovsky

*Sent:* Friday, July 23, 2010 12:37 PM
*To:* Discussion of IronPython
*Subject:* [IronPython] Building IronPython from sources

Hi all,
I have one wish for the next release of IronPython 2.6.2 (hope it is 
not too late...) - please make sure it is possible to build IronPython 
binaries from sources. I have downloaded 
IronPython-2.6.1-Src-Net20SP1.zip 
<http://ironpython.codeplex.com/releases/view/36280#DownloadId=116512> 
and I there is no way for me to build Silverlight binaries from it...


I have opened the solution in VS 2010, solution file was converted to 
the new version, I selected 'Silverlight Debug' as a solution 
configuration and I received meny errors as below when building 
Microsoft.Scripting.dll:


Error11The type 'System.SerializableAttribute' exists in both 
'c:\IronPython-2.6.1\Bin\Silverlight 
Debug\Microsoft.Scripting.Core.dll' and 
'c:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll'
C:\IronPython-2.6.1\Src\Runtime\Microsoft.Scripting\ArgumentTypeException.cs
206Microsoft.Scripting
Error12The type or namespace name 'Serializable' could not be 
found (are you missing a using directive or an assembly reference?)
C:\IronPython-2.6.1\Src\Runtime\Microsoft.Scripting\ArgumentTypeException.cs
206Microsoft.Scripting


My goal was to build debug-able Microsoft.Scripting.Silverlight.dll 
because I'm receiving AddReference error which I'd like to inspect.


--
-- Lukas


___
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] Building IronPython from sources

2010-07-23 Thread Lukas Cenovsky

 Hi all,
I have one wish for the next release of IronPython 2.6.2 (hope it is not 
too late...) - please make sure it is possible to build IronPython 
binaries from sources. I have downloaded 
IronPython-2.6.1-Src-Net20SP1.zip 
 
and I there is no way for me to build Silverlight binaries from it...


I have opened the solution in VS 2010, solution file was converted to 
the new version, I selected 'Silverlight Debug' as a solution 
configuration and I received meny errors as below when building 
Microsoft.Scripting.dll:


Error11The type 'System.SerializableAttribute' exists in both 
'c:\IronPython-2.6.1\Bin\Silverlight Debug\Microsoft.Scripting.Core.dll' 
and 'c:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll'
C:\IronPython-2.6.1\Src\Runtime\Microsoft.Scripting\ArgumentTypeException.cs
206Microsoft.Scripting
Error12The type or namespace name 'Serializable' could not be 
found (are you missing a using directive or an assembly reference?)
C:\IronPython-2.6.1\Src\Runtime\Microsoft.Scripting\ArgumentTypeException.cs
206Microsoft.Scripting


My goal was to build debug-able Microsoft.Scripting.Silverlight.dll 
because I'm receiving AddReference error which I'd like to inspect.


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


Re: [IronPython] How to call a class written in IronPython in vb.net?

2010-07-23 Thread Lukas Cenovsky
 You cannot use mksmath.dll directly from VB (see 
http://ironpython.net/documentation/dotnet/dotnet.html#id86) so you have 
to host IronPython engine in your VB app and use MksMath from the 
engine. See 
http://www.ironpython.info/index.php/Using_Compiled_Python_Classes_from_.NET/CSharp_IP_2.6 
for example (in C#).


--
-- Lukas



On 23.7.2010 12:19, M K Saravanan wrote:

Hi,

I am a newbie to IronPython.  I wrote a small test class in IronPython
which I want to use in vb.net.

For e.g.

class MksMath(object):
def __init__(self):
pass
def add(a,b):
return a+b
def sub(a,b):
return a-b
def mul(a,b):
return a*b
def div(a,b):
return a/b

Using SharpDevelop 3.2, I am compiling it as a class library which
produces the following files:

IronPython.dll
IronPython.Modules.dll
IronPython.Modules.xml
IronPython.xml
Microsoft.Dynamic.dll
Microsoft.Scripting.Core.dll
Microsoft.Scripting.Debugging.dll
Microsoft.Scripting.dll
Microsoft.Scripting.ExtensionAttribute.dll
mksmath.dll

Now how do I use this class in vb.net?  Sorry if my question is too basic.

-- mks --
___
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] TypeError: expected Size, got Size

2010-07-19 Thread Lukas Cenovsky

 On 19.7.2010 18:15, Ian Hobson wrote:

On 19/07/2010 16:57, Lukas Cenovsky wrote:
And I need to know how to find out where I can get the correct 
definition of Size.


Grid is UIElement and you need System.Windows.Size for 
UIElement.Measure - not System.Drawing.Size. See 
http://msdn.microsoft.com/en-us/library/system.windows.uielement.measure.aspx. 


Hi Lukas,

Thanks for the info. I went to the page and it told me

*Namespace:* System.Windows 
<http://msdn.microsoft.com/en-us/library/system.windows.aspx>

*Assembly:* PresentationCore (in PresentationCore.dll)

Therefore I ensured my code contained the two lines

clr.AddReference("PresentationCore")
from Systems.Windows import Size

This gives me
ImportError: Cannot import name Size

giving the line numebr of the import line.

Conclusion : I am missing something - and I don't know how to find it 
out.


Well, UIElement.Measure is in assembly PresentationCore but 
System.Windows.Size structure is in assembly WindowsBase: 
http://msdn.microsoft.com/en-us/library/system.windows.size.aspx. This 
is the link in Parameters section of UIElement.Measure - availableSize 
parameter.


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


Re: [IronPython] TypeError: expected Size, got Size

2010-07-19 Thread Lukas Cenovsky

 On 19.7.2010 17:11, Ian Hobson wrote:

Hi all,

Will some kind soul please point me to a decent explanation of 
Assemblies, NameSpaces
CLR references and the from X import Y command from an IronPythin 
perspective?


I'm utterly fed up of getting errors like this one.

When I use

from System.Drawing import Size

I get the ultra-informative error message in my subject line.

I am trying to translate the following line from c#

worksOrder.Measure(new Size(printDlg.PrintableAreaWidth, 
printDlg.PrintableAreaHeight));


worksOrder is a Grid, printDlg is a printDialog.

I have...

worksOrder.Measure(Size(printDlg.PrintableAreaWidth, 
printDlg.PrintableAreaHeight))


And I need to know how to find out where I can get the correct 
definition of Size.


Grid is UIElement and you need System.Windows.Size for UIElement.Measure 
- not System.Drawing.Size. See 
http://msdn.microsoft.com/en-us/library/system.windows.uielement.measure.aspx.


--
-- Lukáš

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


Re: [IronPython] overriding methods from C# classes

2010-07-09 Thread Lukas Cenovsky

 On 9.7.2010 19:17, Dino Viehland wrote:

This is one of the reasons why I suggest WPF over WinForms.  In WPF you can
declare the event handlers in the XAML and we can wire them up to you.  In
our IronPython 2.7 source code I recently added a clr.LoadComponent method which
does this.  So for WPF the code ends up looking like:

import clr
clr.AddReference('PresentationFramework')

from System.Windows import Application, Window

class MyWindow(Window):
 def __init__(self):
 clr.LoadComponent('WpfApplication16.xaml', self)

 def Button_Click(self, sender, e):
 pass



if __name__ == '__main__':
Application().Run(MyWindow())


While the XAML looks like:

http://schemas.microsoft.com/winfx/2006/xaml/presentation";
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml";
Title="WpfApplication16" Height="300" Width="300">

 
 



And we'll both connect MyWindow.ButtonClick() to the event handlers as well as 
make Foo (the name of the button) available on the self instance.



This is very nice enhancement. Thanks.

--
-- Lukáš

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


Re: [IronPython] png images in xaml

2010-07-08 Thread Lukas Cenovsky

 On 8.7.2010 22:21, Rob Brown-Bayliss wrote:

Hi

I am using visual studio 2010 and the iron python tools.

How do I place an image in a dialog?

I have this in my xaml:


 
 
 
 

and in the project directory I have the Images folder and the png
image.  But nothing shows when I run the app.

Is it preferable to add the images in code or is xaml the correct place?


I think this is not IronPython problem. I would try to search Uri 
questions on stackoverflow.com - e.g. 
http://stackoverflow.com/questions/1874705/pack-uri-and-path-not-resolving-image-in-wpf


--
-- Lukáš

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


Re: [IronPython] Developing Silverlight apps using IronPython -- best strategies

2010-07-07 Thread Lukas Cenovsky

 On 2.7.2010 20:02, Jan-Philip Gehrcke wrote:

Dear list,

I'm totally new to Silverlight (SL) development and it seems that I 
can benefit from my Python experience by combining SL with IronPython 
(at which I've never looked before, too). In the last days, I crawled 
the web and tried to get an impression of what is the best way to 
start. During this time, some questions came up...


1) What is the cutting-edge way to deploy an SL4/IP2.6 application?
I've basically seen two:
- The "all-in-xap-way", with the python application and assemblies 
as well as the XAML in the xap file, as it is described in the article 
series at 
http://www.voidspace.org.uk/ironpython/silverlight/silverlight_application.shtml
- The "Gestalt way", with some magic inside, allowing to place 
XAML/Python code directly in the HTML
Is the first way out-of-date? Are there more techniques? What are 
advantages/disadvantages?


If you want to use "all-in-xap-way" with some .dlls served (and cached) 
separately, see my blog: 
http://gui-at.blogspot.com/2010/05/distributing-silverlight-application.html



4) Code compilation: Is it possible to develop using IP, but to only 
deploy compiled binaries?
I've stumbled over Pyc. How to use it within the best approach of 
question (1)? My naive mind sees two possible advantages:
- Could this be a solution to the traffic problem in question (2), 
i.e. would this do without IP assembly provisioning?

- For some developers it could be attractive for code obfuscation.
I have the feeling that things are not that easy...


There were some promises about compilation... If you want it, vote for 
http://ironpython.codeplex.com/workitem/25680


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


Re: [IronPython] Missing folders in SVN

2010-06-27 Thread Lukas Cenovsky


  
  
Well, I just opened IronPython_Main\Solutions\IronPython.sln
and the following errors appear:

C:\IronPython_Main\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.Core.csproj
  : error  : Unable to read the project file
  'Microsoft.Scripting.Core.csproj'. 
  C:\IronPython_Main\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.Core.csproj:
  The project file could not be loaded. Could not find a part of the
  path
'C:\IronPython_Main\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.Core.csproj'.

  C:\IronPython_Main\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.ExtensionAttribute.csproj
  : error  : Unable to read the project file
  'Microsoft.Scripting.ExtensionAttribute.csproj'. 
  C:\IronPython_Main\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.ExtensionAttribute.csproj:
  The project file could not be loaded. Could not find a part of the
  path
'C:\IronPython_Main\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.ExtensionAttribute.csproj'.

But I tried building now and building Release and Silverlight4Release
succeeded, building Silverlight3Release failed.

Trying Silverlight4Release however shown the following
error:

C:\IronPython_Main\bin\Silverlight4Release>Chiron.exe
  /d:python
  Chiron - Silverlight Dynamic Language Development Utility. Version
  1.0.0.0
  Chiron serving 'C:\IronPython_Main\bin\Silverlight4Release\python'
  as http://localhost:2060/
  21:40:11 200   338 /css/screen.css
  21:40:11 200 5 146 /index.html
  21:40:11 200 1 249 /js/error.js
  21:40:13 500   637 /app.xap [error generating XAP: Could not
  find assembly: System.Numerics.dll]

Sure I know this is not yet even beta - just reporting my attempts.

Btw. is a release date for 2.6.2 known already?

--
-- Lukáš


On 27.6.2010 20:53, Curt Hagenlocher wrote:
Those projects don't exist for .NET 4.0; did you want
  to build for 2.0 or 4.0?
  
  2010/6/27 Lukas Cenovsky <cenov...@bakalari.cz>
 Hi,
  I wanted to build IronPython from sources but some files are
  missing:
  Microsoft.Scripting.Core.csproj
  Microsoft.Scripting.ExtensionAttribute.csproj
  
  Actually the whole folder
  IronPython_Main\Runtime\Microsoft.Scripting.Core is missing.
  
--
-- 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



  


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


[IronPython] Missing folders in SVN

2010-06-27 Thread Lukas Cenovsky

 Hi,
I wanted to build IronPython from sources but some files are missing:
Microsoft.Scripting.Core.csproj
Microsoft.Scripting.ExtensionAttribute.csproj

Actually the whole folder 
IronPython_Main\Runtime\Microsoft.Scripting.Core is missing.


--
-- Lukáš

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


Re: [IronPython] Passing Parameters to a background worker thread

2010-06-18 Thread Lukas Cenovsky

robinsiebler wrote:

I'm trying to use BackgroundWorker to make my app multithreaded. I can't
figure out how to pass a parameter to it when I call it. How do I do this?


Check 
http://devhawk.net/2008/11/19/IronPython+And+WPF+Part+4+Background+Processing.aspx


--
-- Lukáš

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


Re: [IronPython] UI Automation: Wrong values for ControlType, AutomationElementID and more. IronPython 2.6.1

2010-06-18 Thread Lukas Cenovsky
Just an idea - create a proxy in C# that calls 
TreeWalker.ControlViewWalker.GetFirstChild and other methods for you and 
return you the results. Maybe it will work. The similar way I created 
the C# proxy to access Win32API functions 
(http://gui-at.blogspot.com/2008/07/simulate-users-input.html)


--
-- Lukás(


yngipy hernan wrote:
I have been playing around UI Automation and IronPython for several 
days now. My impression is that they don't play each other well. Or 
maybe I missed something.


I am trying to dig deeper to understand why.

Probably this issue is not fixed 
yet? http://blogs.msdn.com/b/shrib/archive/2008/03/24/ironpython-cannot-call-automationelement-fromhandle.aspx



On Wed, Jun 16, 2010 at 3:32 AM, Stanger, Wolfram 
> wrote:


Hello to all,
 
over many years I have forced to implement a test automation

scenerie in our company.
Now they will do it and - who hat thougth that - I've got the job!
And I had to bring the job to success!
 
My Environment:


I've succesfully presented a test automation solution only build
from Internet-Software. It includes:
 
Keyword-Driven Tables in HTML (done with Winword)

  !
   Python 2.6
  !
  Robot-Framework
   !  !
 ApplTestlib.pySeleniumLibrary
  ! !
  pyWinAuto   WEB-AppToTest
  !
 WIN32-AppToTest
 
Later we will embed the solution in a QAtrac process.
 
Now it's time to test automate GUIs build from Windows-Forms and

WPF too.
 
First I switched Python 2.6 to IronPython 2.6[and 2.6.1 RC1] and

got only one, but 'very magic', bug in Robot-Framework when
creating the HTML-Report-File.
Second I'm switched the pyWinAuto-Layer to Miscrosoft UI
Automation (.NET >= 3.0) to support all GUI-Frameworks (WIN32,
WINFORMS and WPF)
 
I. In IronPython all UI Automation values ControlTypePropertys

(w/o the window itself) where Type 'panel'.  Other values are also
not the same as you can see
with UISpy or UIA Verify (Tool from Codeplex 'white'-Project). The
AutomationIDs has the values from NativeWindowHandles (unique
- but never the same from run to run!).
Only the NamePropertys are OK but often empty (when control has no
text content yet).
 
II. All Controls in the window title (titlebar, menubar,

menuitems, and min-, max- and close-Button) where completely
hidden in Automation-Tree (I've tested with Raw-, Control- and
ContentViews)! These eight controls are from IronPython-UI
Automation not reachable. This may be a consequence from point I.
above.
 
In this situation it's unpossible for me to identify Controls in

the application to automate!
 
I have found, I run in exactly the same problems witch where

reported from Jozef in November 2009:

http://lists.ironpython.com/pipermail/users-ironpython.com/2009-November/011583.html
 
and heself stated a own solution in


http://lists.ironpython.com/pipermail/users-ironpython.com/2009-November/011630.html
 
The solution reads:
 
'Thanks for your response.

Solution to my problem is to first instantiate AutomationElement
from dll, not from IronPython.
Then all subsequent AutomationElement retrieved from IronPython
looks ok.'
 
About 30 years I have programmed in ANSI-C (Same SW on

Windows,VMS, Linux, etc.) but now being a newbie to C#, .NET and



Python.
 
Therefore I should have an (syntax-)example for the expression:

'to first instantiate AutomationElement from dll'
 
Witch DLL (Own written, .NET-DLL. ??)

How to instantiate in C#?
How to transport the AutomationElement to IronPython?
 
The best will be if jozef.a... will give me some example lines of

code from his solution in nov 2009 in C# and/or Python. Thanks.
 
Greetings

Wolfram

___
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] IronPython and C# not giving the same result

2010-06-17 Thread Lukas Cenovsky
I tried your IronPython script and it found one child element which name 
is ''.


Change the print line to:
print 'Name:',  ae.Current.Name

--
-- Lukás(


yngipy hernan wrote:

Hi,

All root elements are ok. Thus say, i can see all (?) of the root 
elements.


But not when trying to iterate child elements of the Notepad 
automation element.


My Info:
W7 32 bit (UAC disabled)
.Net 4.0

On Wed, Jun 16, 2010 at 10:08 AM, Lepisto, Stephen P 
mailto:stephen.p.lepi...@intel.com>> wrote:


I was able to successfully run that python code under both
IronPython 2.0.3 and IronPython 2.6.1 and it produced a list of
all top-level applications.  I modified the one line

 


if rae.Current.Name  == 'Untitled - Notepad':

 


to be

 


if not rae.Current.Name  == '':

 


just to see what was actually being found.

 


Note: I'm running Windows XP SP3.

 


*From:* users-boun...@lists.ironpython.com

[mailto:users-boun...@lists.ironpython.com
] *On Behalf Of *yngipy
hernan
*Sent:* Tuesday, June 15, 2010 10:09 PM
*To:* Discussion of IronPython
*Subject:* [IronPython] IronPython and C# not giving the same result

 


Hi All,

 


I have tried to transliterate the following C# code to IronPython:

 


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Windows.Automation;

 


namespace ConsoleApplication1

{

class Program

{

static void Main(string[] args)

{

AutomationElement eNode;

eNode =
TreeWalker.ControlViewWalker.GetFirstChild(AutomationElement.RootElement);

while(eNode != null) {

if (eNode.Current.Name 
== "Untitled - Notepad")

{

AutomationElement ae;

ae =
TreeWalker.ControlViewWalker.GetFirstChild(eNode);

System.Console.WriteLine("---");

while (ae != null)

{

System.Console.WriteLine("Name: {0}",
ae.Current.Name );

ae =
TreeWalker.ControlViewWalker.GetNextSibling( ae);

}

System.Console.WriteLine("---");

}

eNode =
TreeWalker.ControlViewWalker.GetNextSibling(eNode);

}

}

}

}

 


The output of this program looks like:

 


---

Name: test1

Name: Untitled - Notepad

Name: Application

---

 


This is my IronPython code:

 


import clr

 


clr.AddReference('UIAutomationTypes')

clr.AddReference('UIAutomationProvider')

clr.AddReference('UIAutomationClient')

 


import System.Windows.Automation as swu

 


rae = swu.TreeWalker.ControlViewWalker.GetFirstChild(
swu.AutomationElement.RootElement )

while rae:

if rae.Current.Name  == 'Untitled -
Notepad':

print '-'*24

ae = swu.TreeWalker.ControlViewWalker.GetFirstChild( rae )

while ae:

print ae.Current.Name 

ae = swu.TreeWalker.ControlViewWalker.GetNextSibling( ae )

print '-'*24

rae = swu.TreeWalker.ControlViewWalker.GetNextSibling( rae )

 


The output of this shows:



test1



 


I read somewhere that IronPython used to have issues with UI
Automation. Is still the case?

 


Regards,

Yngipy


___
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] Problem Closing Application

2010-06-14 Thread Lukas Cenovsky

Anthony wrote:

Hi Michael

Sorry for the late reply - only got back to my email this morning :-)
I tried to close the form - but when doing that - the whole 
application closed - I think this was mainly due to the fact that that 
form was seen as the "main form"?? Sorry about this real noob question 
- but I'm just starting out - and this is very frustrating for me, I 
know it's probably something stupid that I'm doing! Let me post my 
code here - and see what you can see!

Here is my code

#form = MainForm.Log_In()
form = Log_In.Log_In()
Application.Run(form)


If you run the above code, the main form of the application is Log_In 
form. You have to run application with hidden main form, display log in 
form and after successful log in, display the main form.


By default, the application is closed when the main form of the 
application is closed. If you want different bahavior, see 
ApplicationContext class: 
http://msdn.microsoft.com/en-us/library/07d698ye(v=VS.100).aspx 



--
-- Lukáš

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


Re: [IronPython] clr.CompileModules fails on some python standard lib modules

2010-06-02 Thread Lukas Cenovsky

Dino Viehland wrote:

Lukáš wrote:
  

This is a known issue
(http://ironpython.codeplex.com/workitem/26593?ProjectName=ironpython)
and as Dino mentioned recently it is already fixed in the main.

Which brings a question - when is IronPython 2.6.2 scheduled for release?




We haven't quite scheduled it yet - we've been waiting to make sure there were
no other regressions introduced in 2.6.1.  I've seen 1 or 2 other small bugs
that I think we'd like to fix.  Personally I'm thinking end of June-ish but I'll
need to talk to the rest of the team about it.


For me, the biggest issue is the compiling. Would be nice to see some 
progress in compiling Silverlight code ;-)


Also the line number issue in tracebacks is quite inconvenient 
(http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=26940). 
I've almost got used to it but it surprise me from time to time anyway.


End of June/ start of July is fine for next release.

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


Re: [IronPython] clr.CompileModules fails on some python standard lib modules

2010-06-02 Thread Lukas Cenovsky
This is a known issue 
(http://ironpython.codeplex.com/workitem/26593?ProjectName=ironpython) 
and as Dino mentioned recently it is already fixed in the main.


Which brings a question - when is IronPython 2.6.2 scheduled for release?

--
-- Lukáš


Hernan M Foffani wrote:

Several standard lib modules fails to compile through the use of
clr.CompileModules(..). Compiling modules like decimal.py, gettext.py,
glob.py and others (nine in total) all fail with the same message:

SystemError: CompileToMethod cannot compile constant
'IronPython.Runtime.Types.BuiltinFunction' because it is a non-trivial
value, such as a live object. Instead, create an expression tree that
can construct this value.

Is this a known problem? Are we expecting too much trying to compile
the standard library with clr.CompileModules() and this is not a
supported behaviour?

We are using IronPython 2.6.1 for .NET 2.0.

Regards,
-Hernán.
___
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] Willing to pay for help

2010-05-28 Thread Lukas Cenovsky

I recommend to check DevHawk's posts on Background processing:
http://devhawk.net/2008/11/19/IronPython+And+WPF+Part+4+Background+Processing.aspx
http://devhawk.net/2008/11/21/Background+Processing+ReRevisited.aspx

--
-- Lukás(


Dino Viehland wrote:
Another way to do this, and one I think you were trying to accomplish, and 
is probably superior, would be to move this to another thread.  In your code 
you have:


#t = Thread(ThreadStart(CreateZip(zipname, 
fname)))
#t.Start()

Which I believe is where you're trying to do this.  I would recommend moving
the whole loop into its own function (probably defined in your Button3Click
method so it just closes over the variables) such as:

def Button3Click(...):
...
  def inner_func(unused):
for fname in file_list:
  ...

from System.Threading import ThreadPool
ThreadPool.QueueUserWorkItem(inner_function)

Then you just need to change your updates to the UI to be posted back on the
UI thread.  You do this using Control.BeginInvoke such as:

  def inner_func(unused):
for fname in file_list:
  ...
def update_text():
self._label4.Text = "Zipping file " + str(count) + " of 
" + str(len(file_list)) 

  self.BeginInvoke(Action(update_text))

This will have the added benefit of never hanging - even if the zip operation
is taking a very long period of time.  You'll need to do the same thing for
updating the progress bar, and you'll need to flow in the value in 
self._textBox2.Text, etc...  Basically you can't touch the UI from any thread

other than the UI thread.

All of this was compiled w/ Outlook so hopefully it's mostly accurate and can
get you going in the right direction if you want a slightly better solution.

  

-Original Message-
From: users-boun...@lists.ironpython.com [mailto:users-
boun...@lists.ironpython.com] On Behalf Of robinsiebler
Sent: Thursday, May 27, 2010 1:25 PM
To: users@lists.ironpython.com
Subject: Re: [IronPython] Willing to pay for help


That worked! Give me an e-mail address and I will send you the money.
Can you
recommend a good book to learn about WinForms and .NET in general?


Curt Hagenlocher wrote:


You almost certainly need to be pump messages occasionally if you're
  

going


to be performing a long operation on the UI thread. With Windows
  

Forms,


this
involves calling System.Windows.Forms.Application.DoEvents().

On Thu, May 27, 2010 at 11:55 AM, robinsiebler 
wrote:

  

This is my 1st IronPython/.NET app. It is really simple, all it does


is


zip
all the files in a folder into an archive, 1 file per zip.

The problem is that when it is zipping large files 200MB+ the app


stops


responding. It is still zipping files, but the UI doesn't update. I


don't


know how to fix this.

The project is here -

http://cid-


0c375b07f1f323b6.skydrive.live.com/self.aspx/.Public/ZipfilesGUI.zip


I've looked at all the examples and I am can't seem to figure out


how to


apply them to my app. I'm sur that if someone shows me how to do it


I


will
get it.

I am willing to pay $30 to anyone who will help me solve the


problem.


The
problem is this - when zipping large files (100MB+) the UI stops
responding.
It doesn't refresh until all the files are zipped.
--
View this message in context:
http://old.nabble.com/Willing-to-pay-for-help-


tp28698448p28698448.html


Sent from the IronPython mailing list archive at Nabble.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


  

--
View this message in context: http://old.nabble.com/Willing-to-pay-for-
help-tp28698448p28699466.html
Sent from the IronPython mailing list archive at Nabble.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] Internal Assembly Dependency

2010-05-26 Thread Lukas Cenovsky

Bakalar, Matthew (NIH/CIT) [C] wrote:


Hello All,

I am new to IronPython, relatively new to C#, and new to this list. I 
have a C# assembly that I am attempting to access from IronPython. I 
am able to load the assembly using:


clr.AddReferenceToFileAndPath(mypath)

without any problems. I can then import the classes that reside within 
my assembly as well, create instances of these classes, and call 
certain methods on these instances. There are methods within this 
assembly that rely on a reference to another assembly 
(MathNet.Iridium). When I attempt to call these methods from my 
IronPython script, I receive the following error:


IOError: [Errno 2] Could not load file or assembly 'MathNet.Iridium, 
Version=2008.8.16.470, Culture=neutral, 
PublicKeyToken=c061a3ec32cc0c6f' or one of its dependencies. The 
system cannot find the file specified.


Now, I never added a reference to MathNet.Iridium in my script. 
However, I assumed that the C# assembly that I am calling directly was 
compiled with a reference to this other assembly, and that I would not 
have to explicitly add a reference. When I create a test assembly 
entirely in C# that calls the assembly I am attempting to call, and do 
not include a reference to the MathNet.Iridium assembly, I am able to 
execute the code without problems. Do I need to add a reference to the 
MathNet.Iridium assembly from within my IronPython script even though 
I don't intend to access it directly?


Thanks

Matthew Bakalar



First, try to copy all necessary assemblies to the folder with your 
script and use AddReference for all of them. If that works, you can 
experiment with assemblies in different folders.


Note, the path in AddReferenceToFileAndPath should be full path.

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


Re: [IronPython] example of using IronPython with MS Access database (.mdb)?

2010-05-24 Thread Lukas Cenovsky

Peter Masiar wrote:

Gurus,

I am trying to wrap my mind about how I can access MS Access database
from IronPython. My apologies - I bet this was asked about zillion
times, but of course "Access" is impossible to google. I believe that
it is same thing as Jet engine, Access 2003 uses .mdb as file
extension.

I found http://www.ironpython.info/index.php/Databases_with_Odbc but
AFAICT it uses MS SQL server.
IronPython in Action book uses PostgreSQL. There are plenty of MySQL
and SQLite examples, but I am stuck with Access (and want to get out -
IronPython should be first step).

I would also prefer stock IronPython install - I expect there should
be a way to work with Access databases, right? Unless some other
library provides much better functionality.

Should be something trivial but I am confused. Any links to simple examples?

Thank you


I would check System.Data.OleDb 
 
namespace. I use it for working with FoxPro .dbf files (via 
vfpoledb.dll) and I think there must be driver for Access too.


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


Re: [IronPython] Add reference to .dll located in above directory

2010-05-20 Thread Lukas Cenovsky

Oh! Such a stupid mistake... Thanks Dino!

--
-- Lukáš


Dino Viehland wrote:


Ahh, you need to drop the "\bar.dll" from the path -- it should just 
be the directory where bar.dll lives.


 

*From:* users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Lukas Cenovsky

*Sent:* Thursday, May 20, 2010 12:39 PM
*To:* Discussion of IronPython
*Subject:* Re: [IronPython] Add reference to .dll located in above 
directory


 


Dino Viehland wrote:

Lukáš wrote:
  


Yes, the above works for me too, but the following one does not:

 


F:\Product\1\Dlr\x\module > ipy foo.py



 
Even with the full path added to sys.path instead of the relative 
path?  Because this one works for me as well.
  



This is strange. It does not work for me even with the full path.
I run it on IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.4927 on 
Win7 64-bit


Directory of M:\root

20.05.2010  21:29  .
20.05.2010  21:29  ..
19.03.2010  11:1534 648 ipy.exe
19.03.2010  11:15 1 496 920 IronPython.dll
19.03.2010  11:15   464 728 IronPython.Modules.dll
19.03.2010  11:15   956 248 Microsoft.Dynamic.dll
19.03.2010  11:15   403 288 Microsoft.Scripting.Core.dll
19.03.2010  11:1558 200 Microsoft.Scripting.Debugging.dll
19.03.2010  11:15   178 008 Microsoft.Scripting.dll
19.03.2010  11:1511 096 
Microsoft.Scripting.ExtensionAttribute.dll

20.05.2010  21:29  test
   8 File(s)  3 603 136 bytes

 Directory of M:\root\test

20.05.2010  21:29  .
20.05.2010  21:29  ..
20.05.2010  21:20 4 608 bar.dll
20.05.2010  21:29  module
   1 File(s)  4 608 bytes

 Directory of M:\root\test\module

20.05.2010  21:29  .
20.05.2010  21:29  ..
20.05.2010  21:21   128 foo.py
   1 File(s)128 bytes

foo.py contains:

import clr
import sys
sys.path.append(r'M:\root\test\bar.dll')
clr.AddReference('bar')
import bar
print 'oki'

bar.py contains:

print 'from bar'


M:\root\test>M:\root\ipy.exe module\foo.py
from bar
oki

M:\root\test\module>M:\root\ipy.exe foo.py
Traceback (most recent call last):
  File "foo.py", line 4, in 
IOError: System.IO.IOException: Could not add reference to assembly bar
   at 
Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] 
args, Boolean& shouldOptimize)
   at 
IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`2.Call1(CallSite 
site, CodeContext context, TFuncType func, T0 arg0)
   at 
System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite 
site, T0 arg0, T1 arg1, T2 arg2)
   at 
IronPython.Runtime.Types.BuiltinFunction.BuiltinMethodCaller`2.Call1(CallSite 
site, CodeContext context, TFuncType func, T0 arg0)
   at 
IronPython.Compiler.Ast.CallExpression.Invoke1Instruction.Run(InterpretedFrame 
frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame 
frame)

   at Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet](T0 arg0)
   at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
   at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope)
   at IronPython.Hosting.PythonCommandLine.RunFileWorker(String fileName)
   at IronPython.Hosting.PythonCommandLine.RunFile(String fileName)

--
-- 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] Add reference to .dll located in above directory

2010-05-20 Thread Lukas Cenovsky

Dino Viehland wrote:

Lukáš wrote:
  

Yes, the above works for me too, but the following one does not:

F:\Product\1\Dlr\x\module > ipy foo.py



Even with the full path added to sys.path instead of the relative 
path?  Because this one works for me as well.
  


This is strange. It does not work for me even with the full path.
I run it on IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.4927 on 
Win7 64-bit


Directory of M:\root

20.05.2010  21:29  .
20.05.2010  21:29  ..
19.03.2010  11:1534 648 ipy.exe
19.03.2010  11:15 1 496 920 IronPython.dll
19.03.2010  11:15   464 728 IronPython.Modules.dll
19.03.2010  11:15   956 248 Microsoft.Dynamic.dll
19.03.2010  11:15   403 288 Microsoft.Scripting.Core.dll
19.03.2010  11:1558 200 Microsoft.Scripting.Debugging.dll
19.03.2010  11:15   178 008 Microsoft.Scripting.dll
19.03.2010  11:1511 096 
Microsoft.Scripting.ExtensionAttribute.dll

20.05.2010  21:29  test
  8 File(s)  3 603 136 bytes

Directory of M:\root\test

20.05.2010  21:29  .
20.05.2010  21:29  ..
20.05.2010  21:20 4 608 bar.dll
20.05.2010  21:29  module
  1 File(s)  4 608 bytes

Directory of M:\root\test\module

20.05.2010  21:29  .
20.05.2010  21:29  ..
20.05.2010  21:21   128 foo.py
  1 File(s)128 bytes

foo.py contains:

import clr
import sys
sys.path.append(r'M:\root\test\bar.dll')
clr.AddReference('bar')
import bar
print 'oki'

bar.py contains:

print 'from bar'


M:\root\test>M:\root\ipy.exe module\foo.py
from bar
oki

M:\root\test\module>M:\root\ipy.exe foo.py
Traceback (most recent call last):
 File "foo.py", line 4, in 
IOError: System.IO.IOException: Could not add reference to assembly bar
  at 
Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] 
args, Boolean& shouldOptimize)
  at 
IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`2.Call1(CallSite 
site, CodeContext context, TFuncType func, T0 arg0)
  at 
System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite 
site, T0 arg0, T1 arg1, T2 arg2)
  at 
IronPython.Runtime.Types.BuiltinFunction.BuiltinMethodCaller`2.Call1(CallSite 
site, CodeContext context, TFuncType func, T0 arg0)
  at 
IronPython.Compiler.Ast.CallExpression.Invoke1Instruction.Run(InterpretedFrame 
frame)
  at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame 
frame)

  at Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet](T0 arg0)
  at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
  at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope)
  at IronPython.Hosting.PythonCommandLine.RunFileWorker(String fileName)
  at IronPython.Hosting.PythonCommandLine.RunFile(String fileName)

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


Re: [IronPython] Add reference to .dll located in above directory

2010-05-20 Thread Lukas Cenovsky



Dino Viehland wrote:

Instead of sys.path.append('root') can you append the full path to sys.path?

That seems to work for me, I have:

Directory of F:\Product\1\Dlr\x

05/20/2010  10:34 AM  .
05/20/2010  10:34 AM  ..
05/20/2010  10:30 AM  module
05/20/2010  10:30 AM64 PythonModules.cs
05/20/2010  10:34 AM 3,072 PythonModules.dll
   2 File(s)  3,136 bytes

 Directory of F:\Product\1\Dlr\x\module

05/20/2010  10:30 AM  .
05/20/2010  10:30 AM  ..
05/20/2010  10:36 AM97 foo.py
   1 File(s) 97 bytes

Foo.py contains:

import clr
import sys
sys.path.append(r'F:\Product\1\Dlr\x')
clr.AddReference('PythonModules')

and both of these work:

10:37:08.72
F:\Product\1\Dlr > ipy x\module\foo.py

10:37:48.96
F:\Product\1\Dlr > cd x

10:37:50.11
F:\Product\1\Dlr\x > ipy module\foo.py
  


Yes, the above works for me too, but the following one does not:

F:\Product\1\Dlr\x\module > ipy foo.py


--
-- Lukáš



Also you could calculate the path using __file__ from foo.py.


  

-Original Message-
From: users-boun...@lists.ironpython.com [mailto:users-
boun...@lists.ironpython.com] On Behalf Of cenov...@bakalari.cz
Sent: Thursday, May 20, 2010 12:37 AM
To: Discussion of IronPython
Subject: [IronPython] Add reference to .dll located in above directory

Hi all,
I have the following directory structure:

root
|-- PythonModules.dll
|-- module
  |-- foo.py

I want to add reference to PythonModules.dll  from foo.py. I have the
compiled Python libraries there I need to use in foo.py.

I have not successfully make this work with sys.path:

import clr
import sys
sys.path.append('root')  # this is full path to root
clr.AddReference('PythonModules')

Traceback (most recent call last):
   File "C:\test\modul\t.py", line 4, in 
IOError: System.IO.IOException: Could not add reference to assembly
PythonModules
at
Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[]
args, Boolean& shouldOptimize)
at
IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`2.Call1(CallSit
e site, CodeContext context, TFuncType func, T0
arg0)
at
System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site,
T0 arg0, T1 arg1, T2 arg2)
at __main__$1.__main__(FunctionCode $functionCode) in
C:\test\modul\t.py:line 14
at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope)
at IronPython.Hosting.PythonCommandLine.RunFileWorker(String fileName)
at IronPython.Hosting.PythonCommandLine.RunFile(String fileName)>>>

I get the same error when I use clr.AddReferenceToFile('PythonModules.dll').

The only way how could I make this work is the following:

import clr
import sys
clr.AddReferenceToFileAndPath('..\\PythonModules')

This is not suitable for me as I want to run foo.py from different
directories.

Is it a bug? Or do I something wrong?

--
-- 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


  


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


Re: [IronPython] AddReference to Silverlight toolkit assemblies

2010-05-16 Thread Lukas Cenovsky

Thanks Jimmy, it really works now.

I have written a small howto for those interested:
http://gui-at.blogspot.com/2010/05/distributing-silverlight-application.html

--
-- Lukáš


Jimmy Schementi wrote:


Ah **duh**, though Microsoft.Scripting.Silverlight.dll calls 
ScriptRuntime.LoadAssembly on each AssemblyPart in the 
AppManifest.xaml, it does **not** do the same thing for DLLs in zip 
files referenced by ExtensionPart, since Silverlight only gives us a 
way of getting files out of a zip, not enumerating its contents.


 

So, to correct myself, if you're using ExtensionParts, you'll have to 
call clr.AddReference for each DLL you want loaded. The reason why you 
don't see the expected types is because IronPython doesn't know about 
them.


 

We /could/ require that those zip files have a AppManifest.xaml, which 
would list the DLLs, and then we could parse that and load the DLLs. 
Though asking Silverlight to implement ZIP contents enumeration is 
probably the best =)


 


~js

 


*From:* Lukas Cenovsky [mailto:cenov...@bakalari.cz]
*Sent:* Wednesday, April 28, 2010 6:14 AM
*To:* Discussion of IronPython; Jimmy Schementi
*Subject:* Re: [IronPython] AddReference to Silverlight toolkit assemblies

 


Well, I was wrong when I said it worked. Here is the scenario:

I have necessary .dlls in separate file called /SLToolkit.zip/ which I 
reference in AppManifest.xaml:


  


  

There are the following files in /SLToolkit.zip/:

System.ComponentModel.DataAnnotations.dll
System.Windows.Controls.dll
System.Windows.Controls.Data.dll
System.Windows.Controls.Data.Input.dll
System.Windows.Data.dll


I want to use /ChildWindow/ control. It works when I use it in XAML 
and load the XAML with XamlReader. But it does not work when I want to 
load it from code. If fails on importing because /ChildWindow/ is not 
in /System.Windows.Controls/ namespace.


I put System.Windows.Controls.dll into .xap file and test the 
following in Silverlight REPL:


py> import System.Windows.Controls
=> None
py> dir(System.Windows.Controls)
=> ['Border', 'Button', 'Canvas', 'CheckBox', 
'CleanUpVirtualizedItemEventArgs', ...]
py> clr.AddReferenceToFile('System.Windows.Controls.dll')
=> None
py> dir(System.Windows.Controls)
=> ['Border', 'Button', 'Calendar', 'CalendarBlackoutDatesCollection', 
'CalendarDateChangedEventArgs', 'CalendarDateRange', 'CalendarMode', 
'CalendarModeChangedEventArgs', 'CalendarSelectionMode', 'Canvas', 
'CheckBox', 'ChildWindow', 'CleanUpVirtualizedItemEventArgs', ...]
 

It looks like the controls from System.Windows.Controls.dll are not 
merged into /System.Windows.Controls/ namespace.


Is it bug or do I do something wrong?

--
-- Lukáš


Jimmy Schementi wrote:

Lukas,

 

When you use ExtensionPart, it calls Assembly.Load on each file in the 
zip file referenced, so you don't need to do clr.Addreference.


 

System.Windows.Data.dll and System.Windows.Controls.Data.dll are not 
DLLs in Silverlight; they are in the Silverlight SDK. So you'll have 
to package them up into a separate zip file which you include in your 
AppManfest, just like you did with the SLToolkit.zip.


 


~js

 

*From:* users-boun...@lists.ironpython.com 
<mailto:users-boun...@lists.ironpython.com> 
[mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Lukas Cenovsky

*Sent:* Tuesday, March 23, 2010 5:42 PM
*To:* users@lists.ironpython.com <mailto:users@lists.ironpython.com>
*Subject:* [IronPython] AddReference to Silverlight toolkit assemblies

 


Hi all,
I use Silverlight toolkit in my IronPython Silverlight app. To lower 
bandwidth, I put all necessary Silverlight toolkit .dlls into separate 
file called /SLToolkit.zip/ which I reference in AppManifest.xaml:


  


  

This works nicely if I don't need to reference assembly already 
existing in Silverlight - e.g. I do


clr.AddReference('System.Windows.Controls.Data')

and use /DataGrid/. Unfortunately, when I need to reference 
/PagedCollectionView /from System.Windows.Data, this approach does not 
work. Trying


from System.Windows.Data import PagedCollectionView

fails on /ImportError: Cannot import name PagedCollectionView/. Doing

import System.Windows.Data
System.Windows.Data.PagedCollectionView(some_data)

fails with /AttributeError: attribute 'PagedCollectionView' of 
'namespace#' object is read-only/. When I try to add


clr.AddReference('System.Windows.Data')

if fails with: /IOError: [Errno 2] could not find assembly: 
System.Windows.Data (check the Web server)/.


The only way how to make this work is to put System.Windows.Data.dll 
into .xap file and reference it with


clr.AddReferenceToFile('System.Windows.Data.dll')
from System.Window

[IronPython] clr.AddReferenceToFile bug?

2010-05-16 Thread Lukas Cenovsky

Hi all,
I thought clr.AddReferenceToFile should behave similarly to 
clr.AddReferenceToFileAndPath when I adjust sys.path manually first. But 
it seems they don't. Is it a bug or feature?


This works:

import clr
import sys
clr.AddReferenceToFileAndPath('..\\PythonModules.dll')

This does not work:

import clr
import sys
sys.path.insert(0, '..\\')
clr.AddReferenceToFile('PythonModules.dll')

Traceback (most recent call last):
 File "C:\tests\addrefbug.py", line 8, in 
IOError: System.IO.IOException: Could not add reference to assembly 
PythonModules.dll
  at 
Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] 
args, Boolean& shouldOptimize)
  at 
IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`2.Call1(CallSite 
site, CodeContext context, TFuncType func, T0 arg0)
  at 
System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite 
site, T0 arg0, T1 arg1, T2 arg2)
  at __main__$2.__main__(FunctionCode $functionCode) in 
C:\Klasifikace\Klasifikace\tests\db\addrefbug.py:line 10

  at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
  at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope)
  at IronPython.Hosting.PythonCommandLine.RunFileWorker(String fileName)
  at IronPython.Hosting.PythonCommandLine.RunFile(String fileName)>>>

--
-- Lukáš

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


[IronPython] WPF DataGrid bug

2010-05-13 Thread Lukas Cenovsky

Hi all,
when working with DataGrid in WPF application, I have found two bugs. I 
am not sure they are IronPython bugs but I don't know how to investigate 
more - I am not so fluent in WinDbg :-)


The first (more severe) bug is the /Object reference not set to an 
instance of an object/ error. The attached sample consists of DataGrid 
with some items and property /sel_item/ that is bound to 
DataGrid.SelectedItem. When you try to disable the whole DataGrid (click 
the button), the /Object reference not set to an instance of an object/ 
appears:


Traceback (most recent call last):
 File "C:\IronPython-2.6.1\wpf.grid.py", line 109, in 
 File "C:\IronPython-2.6.1\wpf.grid.py", line 103, in btnClick
SystemError: Object reference not set to an instance of an object.>>>

It only appears when you use binding to DataGrid.SelectedItem. If you 
remove the binding (lines 21-22; in xaml), no error appears.


The second error appears when you initialize /sel_item/ to None (change 
line 73 to: self.sel_item = None). The DataGrid has initially no 
selected row. When you click on any, the binding error appears:


TypeConverter cannot convert from DataItem.

I guess this is more likely to be correct behavior because the Binding 
is initialized with None instead of the row type so it has no way to 
find out the right conversion.


I use IronPython 2.6.1 and WFP Toolkit from February 2010.

It would be nice if somebody could check these bugs.  Thanks.

--
-- Lukáš
import clr
import clrtype
import pyevent
clr.AddReference('PresentationFramework')
clr.AddReference('PresentationCore')
clr.AddReference('WindowsBase')
clr.AddReference('WPFToolkit')
from System.Windows import Application
from System.ComponentModel import INotifyPropertyChanged, 
PropertyChangedEventArgs
from System.Collections.ObjectModel import ObservableCollection
from System.Windows.Markup import XamlReader
from System.Windows.Controls import Validation
from System.Windows import RoutedEventHandler

xaml = """ http://schemas.microsoft.com/winfx/2006/xaml/presentation";
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml";
  xmlns:data="http://schemas.microsoft.com/wpf/2008/toolkit";>
  



  
"""

class NotifyPropertyChangedBase(INotifyPropertyChanged):
PropertyChanged = None

def __init__(self):
self.PropertyChanged, self._propertyChangedCaller = pyevent.make_event()

def add_PropertyChanged(self, value):
self.PropertyChanged += value

def remove_PropertyChanged(self, value):
self.PropertyChanged -= value

def OnPropertyChanged(self, propertyName):
if self.PropertyChanged is not None:
self._propertyChangedCaller(self, 
PropertyChangedEventArgs(propertyName))

class DataItem(NotifyPropertyChangedBase):
__metaclass__ = clrtype.ClrClass

def __init__(self, value):
super(DataItem, self).__init__()
self.value = value

@property
@clrtype.accepts()
@clrtype.returns(str)
def value(self):
return self._value

@value.setter
@clrtype.accepts(str)
@clrtype.returns()
def value(self, value):
self._value = value
self.OnPropertyChanged('value')

class ModelClass(NotifyPropertyChangedBase):
__metaclass__ = clrtype.ClrClass

def __init__(self):
super(ModelClass, self).__init__()
self._data = ObservableCollection[DataItem]()
self.data.Add(DataItem('one'))
self.data.Add(DataItem('two'))
self.data.Add(DataItem('three'))
self.sel_item = self.data[1]

@property
@clrtype.accepts()
@clrtype.returns(DataItem)
def sel_item(self):
return self._sel_item

@sel_item.setter
@clrtype.accepts(DataItem)
@clrtype.returns()
def sel_item(self, value):
self._sel_item = value
self.OnPropertyChanged('sel_item')

@property
@clrtype.accepts()
@clrtype.returns(ObservableCollection[DataItem])
def data(self):
return self._data

class MyApp:
def __init__(self):
self.root = XamlReader.Parse(xaml)
self.root.DataContext = ModelClass()
self.root.AddHandler(Validation.ErrorEvent,
RoutedEventHandler(self.OnBindingValidationError))
self.root.FindName('btn').Click += self.btnClick

def btnClick(self, sender, event):
self.root.FindName('grdItems').IsEnabled = False

def OnBindingValidationError(self, sender, event):
print event.Error.ErrorContent

app = Application()
app.Run(MyApp().root)
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Pywin32 porting woes...

2010-05-12 Thread Lukas Cenovsky
Trying to work with CPython win32api is not a good idea. You should use 
win32 api directly via clrtype.py and pinvokes. Download (Sample) 
ClrType.zip 
 
from http://ironpython.codeplex.com/releases/view/36280 and check how 
for example MessageBox function is imported from user32.dll. The same 
way use for all functions you need from win32 api (replace pywin32 
module with your proxy module).


--
-- Lukás(


Will Sadkin wrote:

Hi list,

I am not sure who to go to with this... 


We have a large legacy CPython library set that makes extensive use of
the pywin32 extensions Mark Hammond wrote.  I would like to use
IronPython to build a RESTful service around the use of this code, but
have discovered that this will be problematic at best, and impossible at
worst.

I saw through some net searching that William Reade managed to get some
portions of win32api to work last year using ironclad
(http://www.mail-archive.com/users@lists.ironpython.com/msg08921.html)

So I thought I'd try to see how far I could get with some of the win32
stuff...  I managed to get win32api to import with a zillion warnings,
but when I tried to import pythoncom, I got errors nesting down to a
problem with the import of pywintypes.

Looking into the code, it assumes that sys.platform startswith("win32")
must be True if it's windows; this isn't the case with ipy; instead it's
"cli".  


Ok, easy to modify, to get to the next issue in the onion, which I'm
stumped on...

'import pythoncom' fails.  I've worked through the code enough to track
down the source of this to problems importing from the pywintypes dll.

It turns out that in cpython:
C:\> c:\Python26\python.exe
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit
(Intel)] on
win32
  

import imp
imp.load_dynamic('pywintypes',


r'C:\Windows\system32\pywintypes26.dll')


That is, imp.load_dynamic() returns a module object for this.

In ipy :
C:\> C:\Program Files (x86)\IronPython 2.6\ipy.exe
IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.4062
  

import sys
sys.path.append(r'c:\ironclad-v2.6.0rc1-bin')
import ironclad
import imp
imp.load_dynamic('pywintypes',


r'C:\Windows\system32\pywintypes26.dll')
  


That is, in ipy, the imp.load_dynamic() *doesn't* return a module, and
raises no exception or anything that would indicate why this was the
case.
 
Which leads to the following questions:
1) Can anyone tell me why this is?  
2) Is this an ironclad issue, an ipy bug, an incompatible change in
imp's behavior in ipy, or something else?  
3) Is this a path worth pursuing?  
4) If not, can anyone give me any recommendations for what to use

instead of ipy?
5) Also, as an aside, will ironpython ever support .pth files to augment
the module search path?

Thanks,
/Will Sadkin
___
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] Silverlight validation with IronPython

2010-05-12 Thread Lukas Cenovsky

Hi all,
does anybody know why Silverlight validation does not work with 
IronPython? The component is not switched into invalid visual state when 
exception occurs in setter. I have not tried it in C# app but I assume 
it works there.


As a workaround, I switch the component into invalid visual state 
manually. See details on my blog:

http://gui-at.blogspot.com/2010/05/silverlight-validation-in-ironpython.html

--
-- Lukáš

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


[IronPython] Formating Decimal numbers / re.match bug

2010-05-07 Thread Lukas Cenovsky

Hi all,
formating Decimals does not work in IronPython:

IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.4927
Type "help", "copyright", "credits" or "license" for more information.
>>> from decimal import Decimal
>>> '{0:3.6f}'.format(Decimal('3.5'))
Traceback (most recent call last):
File "", line unknown, in 
File "C:\src\python\decimal.py", line 3486, in __format__
File "C:\src\python\decimal.py", line 5416, in _parse_format_specifier
ValueError: Invalid format specifier: 3.6f


It works in CPython:

Python 2.6.5 (r265:79096, Mar 19 2010, 18:02:59) [MSC v.1500 64 bit 
(AMD64)] on win32

Type "help", "copyright", "credits" or "license" for more information.
>>> from decimal import Decimal
>>> '{0:3.6f}'.format(Decimal('3.5'))
'3.50'

It looks more like re bug because 
_parse_format_specifier_regex.match(format_spec) returns None in IronPython.


--
-- Lukáš


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


Re: [IronPython] WPF Window vs. Application

2010-05-04 Thread Lukas Cenovsky

Check IronPython-2.6\Tutorial\avalon.py.

--
-- Lukáš


Lukáš Duběda wrote:

Hmm, that's what I'm afraid of. Never done any threaded app
so far.

Could you, please, give me a hint as to how to set this up
so that the Application() runs from within the host app
without problems, i.e. as if it was just a host app's Window.

Thanks a lot, I appretiate it.

Lukáš Duběda
Director
[T] +420 602 444 164

duber studio(tm)
[M] i...@duber.cz
[W] http://www.duber.cz

[A] R.A.Dvorského 601, Praha 10
[A] 10900, Czech Republic, Europe

Lukas Cenovsky wrote:

Lukáš Duběda wrote:

Hi there everybody.

I have yet another question.

This time, since I'm trying to strictly use WPF for my GUI
etc... and what I do here is I host IronPython within another
application that calls it and IPy serves the GUI and
program logic, I bumped into a problem when calling the

Application().Run(LoadedXaml)

The problem seems to be that the app runs in its own thread
separately from the host app and thus doesn't communicate
with the host app, until I close the Application (then
it performs the last task I wanted it to).

So, I was thinking, since I already have most of the gory
Application stuff already up and running, courtesy of the
host app, is there a way to actually only use WPF to
display the GUI and have the program logic taken care of by
IPy? Such as WinForms provides using the Window.Show()
method.

A friend of mine suggested if I could change the Data Type
of the XamlReader.Load... object to a Window object. I don't
know C#, but he suggested this:

Window myWindow;
object result = XamlReader.Load( source );
myWindow = (Window)result;
myWindow.Show();

Is this somehow achieveable via IPy scripting or directly in
the Xaml? Or somehow else?


I doubt this would work - WinForms Window is not the same as WPF 
Window. I think you have to run you WPF app in background STA thread 
to be able to control in from the main thread.


--
-- 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



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


Re: [IronPython] WPF Window vs. Application

2010-05-04 Thread Lukas Cenovsky

Lukáš Duběda wrote:

Hi there everybody.

I have yet another question.

This time, since I'm trying to strictly use WPF for my GUI
etc... and what I do here is I host IronPython within another
application that calls it and IPy serves the GUI and
program logic, I bumped into a problem when calling the

Application().Run(LoadedXaml)

The problem seems to be that the app runs in its own thread
separately from the host app and thus doesn't communicate
with the host app, until I close the Application (then
it performs the last task I wanted it to).

So, I was thinking, since I already have most of the gory
Application stuff already up and running, courtesy of the
host app, is there a way to actually only use WPF to
display the GUI and have the program logic taken care of by
IPy? Such as WinForms provides using the Window.Show()
method.

A friend of mine suggested if I could change the Data Type
of the XamlReader.Load... object to a Window object. I don't
know C#, but he suggested this:

Window myWindow;
object result = XamlReader.Load( source );
myWindow = (Window)result;
myWindow.Show();

Is this somehow achieveable via IPy scripting or directly in
the Xaml? Or somehow else?


I doubt this would work - WinForms Window is not the same as WPF Window. 
I think you have to run you WPF app in background STA thread to be able 
to control in from the main thread.


--
-- Lukáš

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


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

2010-04-30 Thread Lukas Cenovsky

Dino Viehland wrote:

Jeff wrote:
  

I'm trying to fix up the exceptions for the _sqlite3 module I'm
implementing. The dbapi spec (PEP 249) requires a very specific
exception hierarchy, including exceptions derived from StandardError.

My initial version just used C# Exception classes, but StandardError
is not a normal class, so that was insufficient. I looked into how the
existing modules did it (using PythonContext.EnsureModuleException)
and started to implement that but I've run up against a bit of a
roadblock: PythonExceptions.CreateThrowable is internal. It's not a
problem for anything in IronPython.Modules, of course, because of the
accursed InternalsVisibleToAttribute, but that doesn't help me much
:).

Is there a public way to create and throw a Python exception (i.e. a
BaseException instance)? For now I'm just using reflection, but I
would like a better way.



There's a public PythonOps.CreateThrowable.  It just forwards the call
to the internal PythonExceptions.CreateThrowable.


Speaking about exceptions. Is there a way to convert the 
System.Exception to the Python exception when I know the 
System.Exception is a Python exception?


I ran into this when I played with data binding and 
BindingValidationError event. This event is raised when a setter throws 
an exception. So I threw MyException. But in the event, the 
event.Error.Exception is System.Exception and I couldn't figured out how 
to access the Python properties in this "MyException".


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


Re: [IronPython] Load an Ironpython dump

2010-04-30 Thread Lukas Cenovsky

jon vs. python wrote:

Hi all,
My program is crashing and I'm getting this message:

"The program [...\IronPython 2.6\ipy.exe] caused a problem an is going 
to close. Would you like to save a dump file?"


How can I load the dump file generated in order to track the error?
Thanks, Jon.


Run the program from command line and you should see the exception there.

--
-- Lukáš

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


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

2010-04-30 Thread Lukas Cenovsky

Hi all,
there is a bug in IronPython 2.6.1 (and 2.6 too) that line numbers in 
tracebacks are wrong:


=== file t.py ===
# encoding: utf-8
print 1/0


C:\IronPython-2.6.1>ipy.exe t.py
Traceback (most recent call last):
 File "t.py", line 1, in 
ZeroDivisionError: Attempted to divide by zero.

The exception is actually on line 2.

I have filled a bug: 
http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=26940


--
-- Lukáš

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


Re: [IronPython] pyc.py error compiling decimal.py

2010-04-29 Thread Lukas Cenovsky

Dino Viehland wrote:

Lukas wrote:
  

Is the following error the same as in
http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=26593

C:\Dos\IronPython-2.6.1>ipy.exe Tools\Scripts\pyc.py /target:dll
Lib\decimal.py
Input Files:
Lib\decimal.py
Output:
decimal
Target:
Dll
Platform:
ILOnly
Machine:
I386
Compiling...
Traceback (most recent call last):
  File "Tools\Scripts\pyc.py", line 159, in 
  File "Tools\Scripts\pyc.py", line 151, in Main
SystemError: CompileToMethod cannot compile constant
'IronPython.Runtime.Types.BuiltinFunction' because it is a non-trivial
value, such as a live object. Instead, create an expression tree that
can cnstruct this value.



Yep, the fix is checked into our main branch, we plan on quickly putting
out a 2.6.2 which fixes this regression.  We're just giving a short amount
of time to make sure there are no other regressions which should also be
fixed in 2.6.2 as 2.6.1 was one of our biggest dot releases ever.


Good to hear Dino, thanks.

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


[IronPython] pyc.py error compiling decimal.py

2010-04-29 Thread Lukas Cenovsky
Is the following error the same as in 
http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=26593


C:\Dos\IronPython-2.6.1>ipy.exe Tools\Scripts\pyc.py /target:dll 
Lib\decimal.py

Input Files:
   Lib\decimal.py
Output:
   decimal
Target:
   Dll
Platform:
   ILOnly
Machine:
   I386
Compiling...
Traceback (most recent call last):
 File "Tools\Scripts\pyc.py", line 159, in 
 File "Tools\Scripts\pyc.py", line 151, in Main
SystemError: CompileToMethod cannot compile constant 
'IronPython.Runtime.Types.BuiltinFunction' because it is a non-trivial 
value, such as a live object. Instead, create an expression tree that 
can cnstruct this value.


--
-- Lukáš

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


Re: [IronPython] AddReference to Silverlight toolkit assemblies

2010-04-28 Thread Lukas Cenovsky

Well, I was wrong when I said it worked. Here is the scenario:

I have necessary .dlls in separate file called /SLToolkit.zip/ which I 
reference in AppManifest.xaml:


 
   
   
 

There are the following files in /SLToolkit.zip/:

System.ComponentModel.DataAnnotations.dll
System.Windows.Controls.dll
System.Windows.Controls.Data.dll
System.Windows.Controls.Data.Input.dll
System.Windows.Data.dll


I want to use /ChildWindow/ control. It works when I use it in XAML and 
load the XAML with XamlReader. But it does not work when I want to load 
it from code. If fails on importing because /ChildWindow/ is not in 
/System.Windows.Controls/ namespace.


I put System.Windows.Controls.dll into .xap file and test the following 
in Silverlight REPL:


py> import System.Windows.Controls
=> None
py> dir(System.Windows.Controls)
=> ['Border', 'Button', 'Canvas', 'CheckBox', 
'CleanUpVirtualizedItemEventArgs', ...]
py> clr.AddReferenceToFile('System.Windows.Controls.dll')
=> None
py> dir(System.Windows.Controls)
=> ['Border', 'Button', 'Calendar', 'CalendarBlackoutDatesCollection', 
'CalendarDateChangedEventArgs', 'CalendarDateRange', 'CalendarMode', 
'CalendarModeChangedEventArgs', 'CalendarSelectionMode', 'Canvas', 
'CheckBox', 'ChildWindow', 'CleanUpVirtualizedItemEventArgs', ...]


It looks like the controls from System.Windows.Controls.dll are not 
merged into /System.Windows.Controls/ namespace.


Is it bug or do I do something wrong?

--
-- Lukáš


Jimmy Schementi wrote:


Lukas,

 

When you use ExtensionPart, it calls Assembly.Load on each file in the 
zip file referenced, so you don't need to do clr.Addreference.


 

System.Windows.Data.dll and System.Windows.Controls.Data.dll are not 
DLLs in Silverlight; they are in the Silverlight SDK. So you'll have 
to package them up into a separate zip file which you include in your 
AppManfest, just like you did with the SLToolkit.zip.


 


~js

 

*From:* users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Lukas Cenovsky

*Sent:* Tuesday, March 23, 2010 5:42 PM
*To:* users@lists.ironpython.com
*Subject:* [IronPython] AddReference to Silverlight toolkit assemblies

 


Hi all,
I use Silverlight toolkit in my IronPython Silverlight app. To lower 
bandwidth, I put all necessary Silverlight toolkit .dlls into separate 
file called /SLToolkit.zip/ which I reference in AppManifest.xaml:


  


  

This works nicely if I don't need to reference assembly already 
existing in Silverlight - e.g. I do


clr.AddReference('System.Windows.Controls.Data')

and use /DataGrid/. Unfortunately, when I need to reference 
/PagedCollectionView /from System.Windows.Data, this approach does not 
work. Trying


from System.Windows.Data import PagedCollectionView

fails on /ImportError: Cannot import name PagedCollectionView/. Doing

import System.Windows.Data
System.Windows.Data.PagedCollectionView(some_data)

fails with /AttributeError: attribute 'PagedCollectionView' of 
'namespace#' object is read-only/. When I try to add


clr.AddReference('System.Windows.Data')

if fails with: /IOError: [Errno 2] could not find assembly: 
System.Windows.Data (check the Web server)/.


The only way how to make this work is to put System.Windows.Data.dll 
into .xap file and reference it with


clr.AddReferenceToFile('System.Windows.Data.dll')
from System.Windows.Data import PagedCollectionView


Is there a way to make it work when System.Windows.Data.dll is in the 
separate file? Or should I use another approach?


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


Re: [IronPython] Validation in Silverlight

2010-04-27 Thread Lukas Cenovsky

Here are the example files.

Lukas Cenovsky wrote:

Hi Hall,
I'm trying to make Silverlight 3 validation working with IronPython 
but it seems there is necessary a small manual step.


I followed some tutorials and this should be enough:

1) Set binding to: Mode=TwoWay, ValidatesOnExceptions=True, 
NotifyOnValidationError=True

2) Raise Exception in the setter

Then the control with bound property should became invalid.

I tried it with TextBox and I failed - the control still appeared 
valid even when the exception was raised.


The solution is to manually set the control into invalid state (based 
on BindingValidationError event) - see attached files for example.


Does anybody know why the control is not set into invalid state 
automatically?


--
-- Lukáš

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




from System.Windows import Application
from System.Windows.Controls import UserControl

import clrtype
import pyevent
from System.ComponentModel import INotifyPropertyChanged, 
PropertyChangedEventArgs
from System.Windows import VisualStateManager
from System.Windows.Controls import ValidationErrorEventAction

class ValidationClass(INotifyPropertyChanged):
__metaclass__ = clrtype.ClrClass
PropertyChanged = None

def __init__(self, win):
self.win = win
self._text = 'text'
self.PropertyChanged, self._propertyChangedCaller = pyevent.make_event()

def add_PropertyChanged(self, value):
self.PropertyChanged += value

def remove_PropertyChanged(self, value):
self.PropertyChanged -= value

def OnPropertyChanged(self, propertyName):
if self.PropertyChanged is not None:
self._propertyChangedCaller(self, 
PropertyChangedEventArgs(propertyName))

@property
@clrtype.accepts()
@clrtype.returns(str)
def text(self):
return self._text

@text.setter
@clrtype.accepts(str)
@clrtype.returns()
def text(self, value):
if not value.startswith('text'):
self.win.FindName('tbError').Text = "value error"
raise Exception('value must start with text')
self.win.FindName('tbError').Text = ""
self._text = value
self.OnPropertyChanged('text')

class App:
def __init__(self):
self.root = Application.Current.LoadRootVisual(UserControl(), 
"app.xaml")
self.root.DataContext = ValidationClass(self.root)
self.root.BindingValidationError += self.OnBindingValidationError

def OnBindingValidationError(self, sender, event):
if event.Action == ValidationErrorEventAction.Added:
VisualStateManager.GoToState(event.OriginalSource, 
'InvalidUnfocused', True)
else:
VisualStateManager.GoToState(event.OriginalSource, 'Valid', True)

a = App()


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


[IronPython] Validation in Silverlight

2010-04-27 Thread Lukas Cenovsky

Hi Hall,
I'm trying to make Silverlight 3 validation working with IronPython but 
it seems there is necessary a small manual step.


I followed some tutorials and this should be enough:

1) Set binding to: Mode=TwoWay, ValidatesOnExceptions=True, 
NotifyOnValidationError=True

2) Raise Exception in the setter

Then the control with bound property should became invalid.

I tried it with TextBox and I failed - the control still appeared valid 
even when the exception was raised.


The solution is to manually set the control into invalid state (based on 
BindingValidationError event) - see attached files for example.


Does anybody know why the control is not set into invalid state 
automatically?


--
-- Lukáš

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


Re: [IronPython] AddReference to Silverlight toolkit assemblies

2010-04-26 Thread Lukas Cenovsky
Thanks. It works for me know. I don't remember exactly what I did wrong 
but probably I forgot to pack System.Windows.Controls.dll form SL SDK 
into SLToolkit.zip and it is probably referenced from 
System.Windows.Controls.Data.dll .


--
-- Lukáš


Jimmy Schementi wrote:


Lukas,

 

When you use ExtensionPart, it calls Assembly.Load on each file in the 
zip file referenced, so you don't need to do clr.Addreference.


 

System.Windows.Data.dll and System.Windows.Controls.Data.dll are not 
DLLs in Silverlight; they are in the Silverlight SDK. So you'll have 
to package them up into a separate zip file which you include in your 
AppManfest, just like you did with the SLToolkit.zip.


 


~js

 

*From:* users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Lukas Cenovsky

*Sent:* Tuesday, March 23, 2010 5:42 PM
*To:* users@lists.ironpython.com
*Subject:* [IronPython] AddReference to Silverlight toolkit assemblies

 


Hi all,
I use Silverlight toolkit in my IronPython Silverlight app. To lower 
bandwidth, I put all necessary Silverlight toolkit .dlls into separate 
file called /SLToolkit.zip/ which I reference in AppManifest.xaml:


  


  

This works nicely if I don't need to reference assembly already 
existing in Silverlight - e.g. I do


clr.AddReference('System.Windows.Controls.Data')

and use /DataGrid/. Unfortunately, when I need to reference 
/PagedCollectionView /from System.Windows.Data, this approach does not 
work. Trying


from System.Windows.Data import PagedCollectionView

fails on /ImportError: Cannot import name PagedCollectionView/. Doing

import System.Windows.Data
System.Windows.Data.PagedCollectionView(some_data)

fails with /AttributeError: attribute 'PagedCollectionView' of 
'namespace#' object is read-only/. When I try to add


clr.AddReference('System.Windows.Data')

if fails with: /IOError: [Errno 2] could not find assembly: 
System.Windows.Data (check the Web server)/.


The only way how to make this work is to put System.Windows.Data.dll 
into .xap file and reference it with


clr.AddReferenceToFile('System.Windows.Data.dll')
from System.Windows.Data import PagedCollectionView


Is there a way to make it work when System.Windows.Data.dll is in the 
separate file? Or should I use another approach?


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


Re: [IronPython] Still stuck on rich editor with IronPython and Silverlight

2010-04-22 Thread Lukas Cenovsky

I think when AppManifest.xaml is in app folder, Chiron won't generate it.

--
-- Lukáš


Michael Foord wrote:
Thanks very much - this is great news for us! I'm trying this now. 
Having to hardcode our AppManifest.xaml is unfortunate as we normally 
let Chiron generate this for us (whilst developing) - but I guess we 
could just recompile Chiron.


Much appreciated,

Michael

On 22/04/2010 23:13, Jimmy Schementi wrote:

AH! Thanks Dino!

In the XAP file there is an AppManifest.xaml, which specifies a 
version number. Ours (both what Chiron generates and what's on 
gestalt.ironpython.net) is still set to a version of SL2, for 
Moonlight compat, which turns on quirks mode when running in SL3+. 
Changing Chiron.exe.config's AppManifest template (or your own copy 
of AppManifest.xaml) to have SL4's version number will run without 
quirks mode enabled, hopefully letting you use the richtextbox.


For gestalt.ironpython.net, we will have multiple XAPs depending on 
what SL version you want to use, and the SL3 and 4 XAPs will have 
updates version numbers.


Michael, let me know how this works out for you.

~Jimmy

On Apr 22, 2010, at 1:11 PM, "Dino Viehland" wrote:

Ok, I know what's going on here, but I don't know the exact 
solution. I'm
hoping one of you two know the solution. The good news is there's no 
bug,

the rich text box isn't supposed to work! :)

What's going on is that quirks mode is disabling the creation of the
rich text box. This appears to be due to a version check against the
version that's coming from the XAP. So I guess fixing some 
Silverlight '
version specified in the XAP file will fix this - I don't know if 
that's
a XAP being generated by Chiron or if it's something on 
gestalt.ironpython.net.



-Original Message-
From: users-boun...@lists.ironpython.com [mailto:users-
boun...@lists.ironpython.com] On Behalf Of Michael Foord
Sent: Friday, April 16, 2010 6:21 PM
To: Discussion of IronPython
Cc: Jimmy Schementi
Subject: Re: [IronPython] Still stuck on rich editor with IronPython
and Silverlight

On 17/04/2010 03:19, Jimmy Schementi wrote:

Michael, let's get Dino in on this ...

Dino, This seems like our fault, but I'm not savvy enough to track it

down or verify my claim. Seems like it doesn't work regardless of
invoking via reflection or ref.emit code; calling it's constructor
10,000 times still gave the same result. As Michael said, doing
anything with RichTextBox fails when invoked from IronPython, but 
works

fine when invoked without IronPython on the stack (pure C# app, for
example). I'm amazed that it fails when *called* from C#, meaning that
IronPython is doing something to make statically compiled code fail.
Thanks for looking at this Jimmy. IronPython must be doing something
really quite impressive here. :-)

All the best,

Michael


We can look at this together on Monday unless you get to it sooner; I
thought I knew how to use windbg but failed miserably at doing 
anything

useful, so you'll have to help :)

~Jimmy

On Apr 16, 2010, at 6:01 PM, "Michael

Foord" wrote:



Hello all,

I'm still stuck on using the Silverlight 4 RichTextBox from

IronPython. Unfortunately this is blocking our project. :-(

Instantiating the RichTextBox directly or loading it from xaml

fails.

A wrapper class in C# that instantiates the RichTextBox and returns

it to IronPython fails.

A wrapper C# class that internally creates the RichTextBox but never

returns it to IronPython *still* fails. Anyone got any suggestions for
possible alternative approaches?

My latest (failing) attempt. C#:

public static class Foo
{
static RichTextEditor _editor = null;

public static void Create(StackPanel panel)
{
_editor = new RichTextEditor();
panel.Children.Add(_editor);
}
}

IronPython:

clr.AddReference('SilverlightTextEditor, Version=1.0.0.0,

Culture=neutral')

canv = Canvas()
xaml = Application.Current.LoadRootVisual(canv, "app.xaml")

from SilverlightTextEditor import Foo
panel = StackPanel()
xaml.Children.Add(panel)

Foo.Create(panel)

(Note that RichTextEditor is a standalone UserControl editor

component built on top of the RichTextBox. It works fine from C#.)

All the best,

Michael Foord

--
http://www.ironpythoninaction.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



--
http://www.ironpythoninaction.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] Bug when formating decimal type

2010-04-22 Thread Lukas Cenovsky
I haven ecountered a difference in IronPython and Python behaviors which 
looks like IronPython bug:


IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.4927
Type "help", "copyright", "credits" or "license" for more information.
>>> import decimal
>>> d = decimal.Decimal('3.5')
>>> d
Decimal('3.5')
>>> '{0}'.format(d)
Traceback (most recent call last):
 File "", line 1, in 
 File "C:\Dos\IronPython-2.6.1\Lib\decimal.py", line 3486, in __format__
 File "C:\Dos\IronPython-2.6.1\Lib\decimal.py", line 5416, in 
_parse_format_spe

cifier
ValueError: Invalid format specifier:
>>> '{0!s}'.format(d)
'3.5'

Python 2.6.4 (r264:75708, Oct 26 2009, 07:36:50) [MSC v.1500 64 bit 
(AMD64)] on win32

Type "help", "copyright", "credits" or "license" for more information.
>>> import decimal
>>> d = decimal.Decimal('3.5')
>>> d
Decimal('3.5')
>>> '{0}'.format(d)
'3.5'
>>> '{0!s}'.format(d)
'3.5'
>>>

--
-- Lukáš

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


[IronPython] AddReference to Silverlight toolkit assemblies

2010-03-23 Thread Lukas Cenovsky




Hi all,
I use Silverlight toolkit in my IronPython Silverlight app. To lower
bandwidth, I put all necessary Silverlight toolkit .dlls into separate
file called SLToolkit.zip which I reference in AppManifest.xaml:

  
    
    
  

This works nicely if I don't need to reference assembly already
existing in Silverlight - e.g. I do

clr.AddReference('System.Windows.Controls.Data')

and use DataGrid. Unfortunately, when I need to reference PagedCollectionView
from System.Windows.Data, this approach does not work. Trying 

from System.Windows.Data import PagedCollectionView

fails on ImportError: Cannot import name PagedCollectionView.
Doing 

import System.Windows.Data
System.Windows.Data.PagedCollectionView(some_data)

fails with AttributeError: attribute 'PagedCollectionView' of
'namespace#' object is read-only. When I try to add

clr.AddReference('System.Windows.Data')

if fails with: IOError: [Errno 2] could not find assembly:
System.Windows.Data (check the Web server).

The only way how to make this work is to put System.Windows.Data.dll
into .xap file and reference it with

clr.AddReferenceToFile('System.Windows.Data.dll')
from System.Windows.Data import PagedCollectionView


Is there a way to make it work when System.Windows.Data.dll
is in the separate file? Or should I use another approach?

Thanks, 

--
-- Lukáš



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


[IronPython] Want to write IronPython apps for Windows Mobile 7?

2010-03-18 Thread Lukas Cenovsky

Want to write IronPython apps for Windows Mobile 7? Comment here:
http://social.msdn.microsoft.com/Forums/en-US/windowsphone7series/thread/9e2c3ae7-0eba-4ca5-a920-018cc825cdfd

--
-- Lukáš

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


Re: [IronPython] IsolateStorage.GetUserStoreForApplication throws SystemError in IronPython 2.6

2010-03-16 Thread Lukas Cenovsky

You're trying 5 times :-)
Thanks for the workaround.

--
-- Lukáš


Dino Viehland wrote:

A possible work around for this is:

def f():
for i in xrange(200):
try:
return 
System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForSite()
except: pass

After enough invocations we will no longer use reflection to call it.

We just need to add IsolatedStorageFile to a black list of things that shouldn't
be invoked via reflection.

  

-Original Message-
From: users-boun...@lists.ironpython.com [mailto:users-
boun...@lists.ironpython.com] On Behalf Of Lukas Cenovsky
Sent: Tuesday, March 16, 2010 6:37 AM
To: Discussion of IronPython
Subject: [IronPython] IsolateStorage.GetUserStoreForApplication throws
SystemError in IronPython 2.6

Hi all,
one cannot use IsolatedStorage in IronPython 2.6.
Calling IsolatedStorageFile.GetUserStoreForApplication() throws

SystemError: Application code cannot access
System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForSite()
using Reflection.


It works fine in IronPython 2.0.2.

I've entered a bug:
http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=26488

--
-- 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


  


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


[IronPython] IsolateStorage.GetUserStoreForApplication throws SystemError in IronPython 2.6

2010-03-16 Thread Lukas Cenovsky

Hi all,
one cannot use IsolatedStorage in IronPython 2.6.
Calling IsolatedStorageFile.GetUserStoreForApplication() throws

SystemError: Application code cannot access
System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForSite()
using Reflection.


It works fine in IronPython 2.0.2.

I've entered a bug: 
http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=26488


--
-- Lukáš

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


Re: [IronPython] Problem in Reading IronPython Script

2010-03-05 Thread Lukas Cenovsky

Look here:
http://www.ironpython.info/index.php/Contents

--
-- Lukás(


Nishant Mittal wrote:

Hi All


Please let me know how to read ironpython script or call function using C#


Regards
Nishant


___
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] IronPython startup time

2010-02-26 Thread Lukas Cenovsky

Ken MacDonald wrote:

Hi,
I have inherited an IP project. Customer is complaining that startup 
time with no apparent progress takes quite a while, and would like 
something to happen prior to the time that the login screen finally 
appears. I have a splash screen, and have set it to splash prior to 
the login screen, now something appears at about ~~ 12 sec. rather 
than ~~15 sec. for the login screen, but is still kind of a long wait. 
I've tried moving the splash screen earlier, but it dies of missing 
resources; not sure just what. I'm wondering if there is a way of 
defining a really minimal splash screen that requires next to nothing 
to start up, and getting it to pop up in maybe 3 or 4 sec.?

Ken


I think you have to create the splash in C# or VB to display it sooner.

--
-- Lukáš

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


Re: [IronPython] Compiling .py to .dll to use with Silverlight

2010-02-26 Thread Lukas Cenovsky

Hi Jimmy,
PyCon's over, I checked your talk there (cool things!) but no mention 
about IronPython .dlls and Silverlight. Any progress on this issue?


All who need speed up IronPython Silverlight applications please vote:
http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=25680

--
-- Lukáš


Jimmy Schementi wrote:

No update yet, but I'm planning on looking at it for my PyCon talk ...

~Jimmy


  

-Original Message-
From: users-boun...@lists.ironpython.com [mailto:users-
boun...@lists.ironpython.com] On Behalf Of Lukas Cenovsky
Sent: Thursday, January 28, 2010 3:52 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Compiling .py to .dll to use with Silverlight

Any update on this issue? I'd like to see it working as it is quite an issue
for business apps.

For others interested please vote:
http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=25680

--
-- Lukáš


Michael Foord wrote:


Dino Viehland wrote:
  

I'm not aware of any working example of this.  In theory you can do
it by hand by just taking the resulting DLL that gets compiled on the
desktop and updating all of the assembly versions to be the
Silverlight assembly versions.  That can be done by sending it
through ildasm/ilasm.  You'd need to update all of the IronPython and
DLR assemblies as well as mscorlib and System all of which have
different versions on Silverlight vs the desktop CLR.



For the record I tried this and it didn't work for me. The resulting
assembly uses StrongBox (from memory) and possibly other features not
available in CoreCLR.

I would also love to see a solution to this as import time is a big
factor in the startup of IronPython Silverlight apps and pre-compiled
assemblies would help a lot.

All the best,

Michael

  


-Original Message-
From: users-boun...@lists.ironpython.com [mailto:users-
boun...@lists.ironpython.com] On Behalf Of Lukas Cenovsky
Sent: Sunday, November 22, 2009 1:27 PM
To: Discussion of IronPython
Subject: [IronPython] Compiling .py to .dll to use with Silverlight

Hi,
I'd like to know status of the $subj. I have found some discussions
(e.g. Michael tried to use pyc or
http://sdlsdk.codeplex.com/Thread/View.aspx?ThreadId=52207&ANCHOR
<http://sdlsdk.codeplex.com/Thread/View.aspx?ThreadId=52207&ANCHOR>)
but
no working example - is there any? And if not will be any? :-)
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


  

___
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] Importing standard Python libs

2010-02-21 Thread Lukas Cenovsky
I ethinům you will have to dive deeper and debug your code with Windbg. 
It's not so hard - I described the basics (for myself to remember them) 
on http://gui-at.blogspot.com/2010/01/windbg-for-beginners.html.


Basically run you code in Windbg and when you hit exception, you run 
!analyze -v. This tells you more about the exception so you might be 
able to figure out what's going on.


--
-- Lukáš



Lukáš Duběda wrote:

Hmm, but this is strange.

The Interop works, but IronPython throws a lot of exceptions
at me when executing, or rather, passing a string to execute
as a function, for example, in the remote application.

Here's the exception:

** Exception Text **
System.Runtime.InteropServices.COMException (0x80040201): An event was 
unable to invoke any of the subscribers (Exception from HRESULT: 
0x80040201)
   at 
System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 
errorCode, IntPtr errorInfo)
   at 
Microsoft.Scripting.ComInterop.ComRuntimeHelpers.CheckThrowException(Int32 
hresult, ExcepInfo& excepInfo, UInt32 argErr, String message)

   at CallSite.Target(Closure , CallSite , Object , String )
   at 
System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite 
site, T0 arg0, T1 arg1)

   at CallSite.Target(Closure , CallSite , Object , String )
   at CallSite.Target(Closure , CallSite , CodeContext , Object , 
String )
   at 
System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite 
site, T0 arg0, T1 arg1, T2 arg2)
   at onBtnPressed$101(Closure , PythonFunction , Object , Object , 
Object )
   at 
IronPython.Compiler.PythonCallTargets.OriginalCallTarget3(PythonFunction 
function, Object arg0, Object arg1, Object arg2)
   at 
IronPython.Runtime.PythonFunction.FunctionCaller`3.Call3(CallSite 
site, CodeContext context, Object func, T0 arg0, T1 arg1, T2 arg2)

   at CallSite.Target(Closure , CallSite , Object , Object , EventArgs )
   at 
System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite 
site, T0 arg0, T1 arg1, T2 arg2)

   at _Scripting_(Object[] , Object , EventArgs )
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at 
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 
msg, IntPtr wparam, IntPtr lparam)

***

the code that I execute is simple, it looks like this:

maxApp = 
Activator.CreateInstance(Type.GetTypeFromProgID('MAX.Application.2009'))


then:

maxApp.runMXS(r'colorMan.getColor #background')

this is a call to a function of the remote app (colorMan) and
its method for getting the app's color.

The weirdest thing is, some functions, even though they
throw an error, still get executed after I hit "Continue".

Do you have any idea what might be causing this?

Thanks a lot in advance, cheers,

Lukáš Duběda
Director
[T] +420 602 444 164

duber studio(tm)
[M] i...@duber.cz
[W] http://www.duber.cz

[A] R.A.Dvorského 601, Praha 10
[A] 10900, Czech Republic, Europe

Lukas Cenovsky wrote:

Lukáš Duběda wrote:

Hi Lukas,

thanks for the tip, it actually never occured to me.
I'm used to using the win32com module for communicating
with an OLE server I established in a separate application.

I'm tryint to send code in different language, native
to the app., via this OLE bridge and for that I used
to use win32com.client module and then I registered
the app and its exposed methods.

But now when I come to think of it, it might be a much
better idea doing it via .NET. However, I have
no idea where to start. :)


Check this page:
http://www.ironpython.info/index.php/Contents#Interop

--
-- 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



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


Re: [IronPython] Importing standard Python libs

2010-02-20 Thread Lukas Cenovsky

Brian Curtin wrote:
On Sat, Feb 20, 2010 at 13:20, Lukas Cenovsky <mailto:cenov...@bakalari.cz>> wrote:


Lukáš Duběda wrote:

Hi there everyone,

I'm having problems importing a module, concretely win32com,
from within
IronPython.

The problem is, when I run IronPython as a console, and add a
path to
the standard Python26 library, the module can be imported without
any problems, but as soon as I try to embed IronPython and call
it from within my application and then try to import the module,
even though I'd added the path to the sys.path prior to
importing the module, it still throws an error saying:
"No module named win32api".

I don't know what to do now. I've tried to manually add
all the sub-directories of the Lib direcotry from Python26.
I tried to copy the module's files to IronPython Lib directory,
but nothing worked.

Thanks a lot in advance, cheers,


I don't know why you can't import the win32com module but I would
not use it at all.

I would rather use the Win32 API directly from IronPython via
clrtype and pinvoke or via C# stub. For C# stub example see my
blog: http://gui-at.blogspot.com/2008/07/simulate-users-input.html

 
What's wrong with win32com/win32api...?


I think it is unecessary proxy level for accessing COM or win32api in 
IronPython.


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


Re: [IronPython] Importing standard Python libs

2010-02-20 Thread Lukas Cenovsky

Lukáš Duběda wrote:

Hi Lukas,

thanks for the tip, it actually never occured to me.
I'm used to using the win32com module for communicating
with an OLE server I established in a separate application.

I'm tryint to send code in different language, native
to the app., via this OLE bridge and for that I used
to use win32com.client module and then I registered
the app and its exposed methods.

But now when I come to think of it, it might be a much
better idea doing it via .NET. However, I have
no idea where to start. :)


Check this page:
http://www.ironpython.info/index.php/Contents#Interop

--
-- Lukáš

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


Re: [IronPython] Importing standard Python libs

2010-02-20 Thread Lukas Cenovsky

Lukáš Duběda wrote:

Hi there everyone,

I'm having problems importing a module, concretely win32com, from within
IronPython.

The problem is, when I run IronPython as a console, and add a path to
the standard Python26 library, the module can be imported without
any problems, but as soon as I try to embed IronPython and call
it from within my application and then try to import the module,
even though I'd added the path to the sys.path prior to
importing the module, it still throws an error saying:
"No module named win32api".

I don't know what to do now. I've tried to manually add
all the sub-directories of the Lib direcotry from Python26.
I tried to copy the module's files to IronPython Lib directory,
but nothing worked.

Thanks a lot in advance, cheers,


I don't know why you can't import the win32com module but I would not 
use it at all.


I would rather use the Win32 API directly from IronPython via clrtype 
and pinvoke or via C# stub. For C# stub example see my blog: 
http://gui-at.blogspot.com/2008/07/simulate-users-input.html


--
-- Lukáš

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


Re: [IronPython] clrtype: How to subclass ClrClass?

2010-02-07 Thread Lukas Cenovsky

That would be nice. Thanks.

--
-- Lukáš


Shri Borde wrote:

It is a know bug. I can take a look next week.

-Original Message-
From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of Michael Foord
Sent: Saturday, February 06, 2010 4:10 AM
To: Discussion of IronPython
Subject: Re: [IronPython] clrtype: How to subclass ClrClass?

On 06/02/2010 11:19, Lukas Cenovsky wrote:
  

Hi all,
it looks like I cannot subclass a class based on ClrClass metaclass:

IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.4927
Type "help", "copyright", "credits" or "license" for more information.


import clr
import clrtype

class Product(object):
  

... __metaclass__ = clrtype.ClrClass
...


p = Product()
print "CLR type name: %s" % p.GetType().FullName
  

CLR type name: Product


class MyProduct(Product):
  

... pass
...
Traceback (most recent call last):
File "", line 1, in 
KeyError: The given key was not present in the dictionary.

Is it a bug or am I doing something wrong? Thanks.



Hehe, I ran into this a couple of days ago on Silverlight as well.

All the best,

Michael

  

--
-- 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] clrtype: How to subclass ClrClass?

2010-02-06 Thread Lukas Cenovsky

Hi all,
it looks like I cannot subclass a class based on ClrClass metaclass:

IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.4927
Type "help", "copyright", "credits" or "license" for more information.
>>> import clr
>>> import clrtype
>>>
>>> class Product(object):
... __metaclass__ = clrtype.ClrClass
...
>>> p = Product()
>>> print "CLR type name: %s" % p.GetType().FullName
CLR type name: Product
>>>
>>> class MyProduct(Product):
... pass
...
Traceback (most recent call last):
 File "", line 1, in 
KeyError: The given key was not present in the dictionary.

Is it a bug or am I doing something wrong? Thanks.

--
-- Lukáš


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


[IronPython] IronPython 2.6 and Moonlight

2010-01-31 Thread Lukas Cenovsky

Hi all,
does anybody know why Silverlight app developed in IronPython 2.6 does 
not work in Moonlight 2? Is it because of SILVERLIGHT_3 flag? Is there 
any workaround?


I tested it with the SL template, Ubuntu 9.10, Firefox 3.5.7, Moonlight 2.0:
http://gui-at.cendaweb.cz/SLLinux/

--
-- Lukáš


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


Re: [IronPython] Compiling .py to .dll to use with Silverlight

2010-01-29 Thread Lukas Cenovsky

Looking forward to see it!

--
-- Lukáš


Jimmy Schementi wrote:

No update yet, but I'm planning on looking at it for my PyCon talk ...

~Jimmy


  

-Original Message-
From: users-boun...@lists.ironpython.com [mailto:users-
boun...@lists.ironpython.com] On Behalf Of Lukas Cenovsky
Sent: Thursday, January 28, 2010 3:52 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Compiling .py to .dll to use with Silverlight

Any update on this issue? I'd like to see it working as it is quite an issue
for business apps.

For others interested please vote:
http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=25680

--
-- Lukáš


Michael Foord wrote:


Dino Viehland wrote:
  

I'm not aware of any working example of this.  In theory you can do
it by hand by just taking the resulting DLL that gets compiled on the
desktop and updating all of the assembly versions to be the
Silverlight assembly versions.  That can be done by sending it
through ildasm/ilasm.  You'd need to update all of the IronPython and
DLR assemblies as well as mscorlib and System all of which have
different versions on Silverlight vs the desktop CLR.



For the record I tried this and it didn't work for me. The resulting
assembly uses StrongBox (from memory) and possibly other features not
available in CoreCLR.

I would also love to see a solution to this as import time is a big
factor in the startup of IronPython Silverlight apps and pre-compiled
assemblies would help a lot.

All the best,

Michael

  


-Original Message-
From: users-boun...@lists.ironpython.com [mailto:users-
boun...@lists.ironpython.com] On Behalf Of Lukas Cenovsky
Sent: Sunday, November 22, 2009 1:27 PM
To: Discussion of IronPython
Subject: [IronPython] Compiling .py to .dll to use with Silverlight

Hi,
I'd like to know status of the $subj. I have found some discussions
(e.g. Michael tried to use pyc or
http://sdlsdk.codeplex.com/Thread/View.aspx?ThreadId=52207&ANCHOR
<http://sdlsdk.codeplex.com/Thread/View.aspx?ThreadId=52207&ANCHOR>)
but
no working example - is there any? And if not will be any? :-)
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


  

___
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] Compiling .py to .dll to use with Silverlight

2010-01-28 Thread Lukas Cenovsky
Any update on this issue? I'd like to see it working as it is quite an 
issue for business apps.


For others interested please vote:
http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=25680

--
-- Lukáš


Michael Foord wrote:

Dino Viehland wrote:
I'm not aware of any working example of this.  In theory you can do 
it by

hand by just taking the resulting DLL that gets compiled on the desktop
and updating all of the assembly versions to be the Silverlight assembly
versions.  That can be done by sending it through ildasm/ilasm.  You'd
need to update all of the IronPython and DLR assemblies as well as 
mscorlib and System all of which have different versions on Silverlight

vs the desktop CLR.
  


For the record I tried this and it didn't work for me. The resulting 
assembly uses StrongBox (from memory) and possibly other features not 
available in CoreCLR.


I would also love to see a solution to this as import time is a big 
factor in the startup of IronPython Silverlight apps and pre-compiled 
assemblies would help a lot.


All the best,

Michael



 

-Original Message-
From: users-boun...@lists.ironpython.com [mailto:users-
boun...@lists.ironpython.com] On Behalf Of Lukas Cenovsky
Sent: Sunday, November 22, 2009 1:27 PM
To: Discussion of IronPython
Subject: [IronPython] Compiling .py to .dll to use with Silverlight

Hi,
I'd like to know status of the $subj. I have found some discussions
(e.g. Michael tried to use pyc or
http://sdlsdk.codeplex.com/Thread/View.aspx?ThreadId=52207&ANCHOR
<http://sdlsdk.codeplex.com/Thread/View.aspx?ThreadId=52207&ANCHOR>) 
but

no working example - is there any? And if not will be any? :-)
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
  






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


Re: [IronPython] IronPython.Modules.dll bug when access from Delphi

2010-01-18 Thread Lukas Cenovsky
Of course the bug was not in IronPython :-) Thanks Dino for helping me 
find it!


Check my question on StackOverflow 
(http://stackoverflow.com/questions/2048540/hosting-clr-in-delphi-with-jcl-example) 
how to work with .NET from Delphi Win32. Beware especially of different 
floating point exceptions behavior in Delphi (that was my problem). You 
have to call Set8087CW($133F); before any work with .NET. After that, 
it's only matter of creating IronPython engine etc.


--
-- Lukáš


Dino Viehland wrote:


It'll be interesting to see what windbg shows -- I just tried it and 
it works for me w/ or w/o IronPython.Modules.dll.


 

*From:* users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Lukas Cenovsky

*Sent:* Wednesday, January 13, 2010 11:21 AM
*To:* Discussion of IronPython
*Subject:* Re: [IronPython] IronPython.Modules.dll bug when access 
from Delphi


 


IpyTest is compiled IpyTest.dpr by Delphi 7. Yes, it hosts CLR.
I'll try the windbg.

--
-- Lukáš


Dino Viehland wrote:

Ok, Dave was also somehow able to get the attachment and send it to me...

 

What is IpyTest.exe?  It's a big unmanaged EXE which I'm not inclined 
to run.


 

Is this hosting the CLR somehow?  Could you attach the debugger using 
windbg


which is a free download and get the stack from there?

 

 

*From:* users-boun...@lists.ironpython.com 
<mailto:users-boun...@lists.ironpython.com> 
[mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Lukas Cenovsky

*Sent:* Wednesday, January 13, 2010 11:06 AM
*To:* Discussion of IronPython
*Subject:* Re: [IronPython] IronPython.Modules.dll bug when access 
from Delphi


 


I have created CodePlex issue:
http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=25933

Unfortunately, I have only VS Express so I cannot attach debugger to a 
process.


--
-- Lukáš


Dino Viehland wrote:

The attachment was deleted - can you post it somewhere?  For example you could
open a bug on our CodePlex site and attach it.  
 
Also do you have VisualStudio installed?  If so you could attach the debugger

to your process and send the stack trace of where it's hanging.
 
  


-Original Message-

From: users-boun...@lists.ironpython.com 
<mailto:users-boun...@lists.ironpython.com> [mailto:users-

boun...@lists.ironpython.com <mailto:boun...@lists.ironpython.com>] On 
Behalf Of Lukas Cenovsky

Sent: Wednesday, January 13, 2010 10:37 AM

To: Discussion of IronPython

Subject: [IronPython] IronPython.Modules.dll bug when access from Delphi

 


Hi,

I have almost succesfully managed to access IronPython from Delphi 7 
(Win32).

But I have also encountered a bug connected with IronPython.Modules.dll.

 


Here are steps to recreate it:

1. Unzip the attached file somewhere

2) Put IronPython IronPython-2.6 with IronPython dlls to the same folder (or

change the path in Host\build.bat)

3) Build the host with Host\build.bat

4) Run Host\Host.exe - it runs OK

5) Run Delphi\IpyTest.exe - it runs OK

6) Put IronPython.Modules.dll to Delphi\ folder

7) Run Delphi\IpyTest.exe - it freezes. It freezes during creating 
IronPython

engine.

8) Host\Host.exe runs fine with IronPython.Modules.dll

 


I don't know how to debug this problem - can somebody please look at it?

Thank you.

 


--

-- Lukáš



 
___

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

 

 




  
 
___

Users mailing list
Users@lists.ironpython.com <mailto: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] IronPython.Modules.dll bug when access from Delphi

2010-01-13 Thread Lukas Cenovsky

IpyTest is compiled IpyTest.dpr by Delphi 7. Yes, it hosts CLR.
I'll try the windbg.

--
-- Lukáš


Dino Viehland wrote:


Ok, Dave was also somehow able to get the attachment and send it to me...

 

What is IpyTest.exe?  It's a big unmanaged EXE which I'm not inclined 
to run.


 

Is this hosting the CLR somehow?  Could you attach the debugger using 
windbg


which is a free download and get the stack from there?

 

 

*From:* users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Lukas Cenovsky

*Sent:* Wednesday, January 13, 2010 11:06 AM
*To:* Discussion of IronPython
*Subject:* Re: [IronPython] IronPython.Modules.dll bug when access 
from Delphi


 


I have created CodePlex issue:
http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=25933

Unfortunately, I have only VS Express so I cannot attach debugger to a 
process.


--
-- Lukáš


Dino Viehland wrote:

The attachment was deleted - can you post it somewhere?  For example you could
open a bug on our CodePlex site and attach it.  
 
Also do you have VisualStudio installed?  If so you could attach the debugger

to your process and send the stack trace of where it's hanging.
 
  


-Original Message-

From: users-boun...@lists.ironpython.com 
<mailto:users-boun...@lists.ironpython.com> [mailto:users-

boun...@lists.ironpython.com <mailto:boun...@lists.ironpython.com>] On 
Behalf Of Lukas Cenovsky

Sent: Wednesday, January 13, 2010 10:37 AM

To: Discussion of IronPython

Subject: [IronPython] IronPython.Modules.dll bug when access from Delphi

 


Hi,

I have almost succesfully managed to access IronPython from Delphi 7 
(Win32).

But I have also encountered a bug connected with IronPython.Modules.dll.

 


Here are steps to recreate it:

1. Unzip the attached file somewhere

2) Put IronPython IronPython-2.6 with IronPython dlls to the same folder (or

change the path in Host\build.bat)

3) Build the host with Host\build.bat

4) Run Host\Host.exe - it runs OK

5) Run Delphi\IpyTest.exe - it runs OK

6) Put IronPython.Modules.dll to Delphi\ folder

7) Run Delphi\IpyTest.exe - it freezes. It freezes during creating 
IronPython

engine.

8) Host\Host.exe runs fine with IronPython.Modules.dll

 


I don't know how to debug this problem - can somebody please look at it?

Thank you.

 


--

-- Lukáš



 
___

Users mailing list
Users@lists.ironpython.com <mailto: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] IronPython.Modules.dll bug when access from Delphi

2010-01-13 Thread Lukas Cenovsky

I have created CodePlex issue:
http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=25933

Unfortunately, I have only VS Express so I cannot attach debugger to a 
process.


--
-- Lukáš


Dino Viehland wrote:

The attachment was deleted - can you post it somewhere?  For example you could
open a bug on our CodePlex site and attach it.  


Also do you have VisualStudio installed?  If so you could attach the debugger
to your process and send the stack trace of where it's hanging.

  

-Original Message-
From: users-boun...@lists.ironpython.com [mailto:users-
boun...@lists.ironpython.com] On Behalf Of Lukas Cenovsky
Sent: Wednesday, January 13, 2010 10:37 AM
To: Discussion of IronPython
Subject: [IronPython] IronPython.Modules.dll bug when access from Delphi

Hi,
I have almost succesfully managed to access IronPython from Delphi 7 (Win32).
But I have also encountered a bug connected with IronPython.Modules.dll.

Here are steps to recreate it:
1. Unzip the attached file somewhere
2) Put IronPython IronPython-2.6 with IronPython dlls to the same folder (or
change the path in Host\build.bat)
3) Build the host with Host\build.bat
4) Run Host\Host.exe - it runs OK
5) Run Delphi\IpyTest.exe - it runs OK
6) Put IronPython.Modules.dll to Delphi\ folder
7) Run Delphi\IpyTest.exe - it freezes. It freezes during creating IronPython
engine.
8) Host\Host.exe runs fine with IronPython.Modules.dll

I don't know how to debug this problem - can somebody please look at it?
Thank you.

--
-- 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] Silverlight DataBinding Not Working

2009-12-31 Thread Lukas Cenovsky

I overlooked you are doing ElementBinding.

It seems it does not work in IronPython - the Slider (element you are 
binding to) probably does not fire PropertyChanged event. I would blame 
some magic with codebehind files :-)


In this case, the slider is updated when the text box changes its value:
Value="8" />



In this case, the text box is updated when the slider changes its value:
Value="{Binding ElementName=textboxFontSize, Path=Text, Mode=TwoWay}" />



Finally this works but it not much usable:
Value="{Binding ElementName=textboxFontSize, Path=Text, Mode=TwoWay}" />



--
-- Lukáš

Shyam Gopale wrote:
But, I am just doing binding between elements. Is this still required. 
If you see my XAML I am just binding the value of a slider to the 
fontsize of a textblock. I am not sure if the Ironpython code hits 
that path.
 
Thanks,

Shyam

On Wed, Dec 30, 2009 at 10:02 PM, Lukas Cenovsky <mailto:cenov...@bakalari.cz>> wrote:


Shyam Gopale wrote:

Hi,
I am trying out some sample Silverlight code with IronPython
and I found that the data binding does not work properly.
The app.xaml is as below:
http://schemas.microsoft.com/client/2007";
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml";>








This XAML when used in a C# Silverlight app reflects the
correct data binding behaviour but does not work when used
with IronPython and Chiron. Mainly the font size of the text
block is not updated.
Does anyone have any idea about this?

Check my blog about binding in Silverlight:

http://gui-at.blogspot.com/2009/11/inotifypropertychanged-and-databinding.html

--
-- Lukáš


___
Users mailing list
Users@lists.ironpython.com <mailto: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


  1   2   >