Re: [IronPython] Non-English Version of Win XP needed
Works for me also. Swedish xp(sv-FI) On Feb 14, 2011 7:11 AM, Jeff Hardy jdha...@gmail.com wrote: I'd like one other person to confirm this is fixed before I close - Spanish or German preferably, since they are mentioned in the bug. - Jeff On Sun, Feb 13, 2011 at 12:20 AM, Jörgen Stenarson jorgen.stenar...@bostream.nu wrote: Jeff Hardy skrev 2011-02-13 06:25: It looks like http://ironpython.codeplex.com/workitem/14022 will only repro on non-english versions of XP that use , as the decimal separator instead of . If you have one of those, can you see if the issue is still present in 2.7B2. From the notes, it looks like just changing the locale is not enough - it has to be a non-english version. - Jeff ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com Hi, I could not reproduce the problem on my machine (swedish windows xp) IronPython 2.7 Beta 2 (2.7.0.20) on .NET 4.0.30319.1 Type help, copyright, credits or license for more information. 3.14 3.14 3,14 (3, 14) import math 3.14159265359 3.14159265359 float(repr(float(repr(math.pi 3.141592653589793 /Jörgen ___ 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] overriding methods defined in C# classes
Shouldn't your c# methods be protected virtual to be overridable? On Jul 9, 2010 7:41 PM, Marcin Krol mrk...@gmail.com wrote: Hello Michael and everyone, (sigh, I sent reply recently while I meant to start a new thread, this is it) Michael Foord wrote: I recommend using the Visual Studio C# designer and then subclass the classes it generates from IronPython. I set out to do just that and stumbled upon a problem: I generated Windows form in C#, compiled into assembly (ip_cl1), copied to python project folder: clr.AddReference('ip_cl1') .. from ip_cl1 import Form1 class Form1Inh(Form1): def __init__(self): Form1.__init__(self) def comboBox1_SelectedIndexChanged(self, sender, event): self.BackColor = Color.Azure This doesn't work, i.e. method comboBox1_SelectedIndexChanged doesn't get called. I have to expicitly add EventHandler in Python: class Form1Inh(Form1): def __init__(self): Form1.__init__(self) self.box1.SelectedIndexChanged += EventHandler(self.comboBox1_SelectedIndexChanged); def comboBox1_SelectedIndexChanged(self, sender, event): self.BackColor = Color.Azure Is there some way of simply overriding methods in Python so that they do get called by form events? In Form1.cs I have: namespace ip_cl1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } protected void box1_SelectedIndexChanged(object sender, EventArgs e) { } protected void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { } } } -- Regards, mk -- Premature optimization is the root of all fun. -- Regards, mk -- Premature optimization is the root of all fun. ___ 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] I can't install the MSI for IP2.6 RC1
On Fri, Jan 8, 2010 at 2:40 PM, Sandy Walsh swa...@impathnetworks.comwrote: Jonathan, not sure if you ever got an answer to this problem. I'm have the same issue. The offending operation seems to be: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ngen.exe install C:\Program Files\IronPython 2.6\Microsoft.Scripting.dll /queue:1 One thing I noticed is when I run 'ngen queue status' directly I get this: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727ngen queue status Microsoft (R) CLR Native Image Generator - Version 2.0.50727.3053 Copyright (c) Microsoft Corporation. All rights reserved. The specified service does not exist as an installed service. (Exception from HRESULT: 0x80070424) ... but now I'm trying to find what the queue service runs under and how to fix it. at least on my XP x86 machine it is: Display name: .NET Runtime Optimization Service v2.0.50727_X86 Service name: clr_optimization_v2.0.50727_32 Startup type: manual Did you have any luck? -Sandy ___ 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 with Creating Executable using SharpDevelop
On Mon, Jul 13, 2009 at 7:26 PM, Dave Fugate dfug...@microsoft.com wrote: On a related note, I strongly suspect we'll be using different assembly version numbers for IronPython 2.6.0/2.6.1/etc... Can't you update AssemblyFileVersion and leave AssemblyVersion or is there a problem with that too? -Original Message- From: users-boun...@lists.ironpython.com [mailto: users-boun...@lists.ironpython.com] On Behalf Of Michael Foord Sent: Monday, July 13, 2009 4:00 AM To: Discussion of IronPython Subject: Re: [IronPython] Problem with Creating Executable using SharpDevelop Jeff Hardy wrote: On Fri, Jul 10, 2009 at 12:50 PM, Michael Foordfuzzy...@voidspace.org.uk wrote: Are there issues around assembly versions and the GAC? I'm thinking particularly of where newer versions of IronPython are released as drop-in replacements so the version numbers are not updated. If a previous version is in the GAC isn't there a likelihood that an application that ships with a newer version will still load the GAC'd older version... ? My *impression* was that adding stuff to the GAC was a recipe for DLL hell and therefore it was better left to individual users rather than being automatic on installation. This opinion may be ill-informed however... You just have to be *really* careful with you assembly versions, and what kinds of changes cause a rev of version numbers. However, I don't think it should be the default, but it would be nice to have the option during installation. I think gacutil is only included in the SDK anyway. Right. I think the issue of version numbering is tricky, which is why I'm nervous about IronPython being GAC'd. As an example, the IronPython 2.0.1 and 2.0 assemblies have the same version numbers - and I understand why and don't disagree with this decision - but the net result is that Resolver One required 2.0.1 and would probably fail if the user has 2.0 in the GAC. I certainly wouldn't object to it being an installer option, but it would still make me nervous... :-) Having minor IronPython versions have new assembly versions would probably help - but with the disadvantage that they are no longer drop-in replacements. Michael - Jeff ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ___ 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] Question Regarding WPF : DataBinding, DataTemplates and C# Extensions
As the error message says, it cannot find the type LocalTimes. Normally you have to map an xml namespace into the corresponding clr namespace by adding something along the lines of xmlns:src=clr-namespace:Whatever.Namespace;assembly=TheAssemblyName to the xaml file and then you would declare the objectDataProvider like this instead ObjectDataProvider x:Key=localTimes ObjectType={x:Type src:LocalTimes}/ However, I'm not sure how it works if you don't put LocalTimes in a namespace On Mon, Nov 3, 2008 at 6:08 PM, Dino Viehland [EMAIL PROTECTED] wrote: Declaring an interface from Python is easy: import System class MyComparer(System.IComparable): def CompareTo(self, other): print 'compared' return -1 a = MyComparer() b = MyComparer() c = MyComparer() l = System.Collections.ArrayList([a,b,c]) l.Sort() prints: compared compared compared compared compared Unfortunately I don't know enough about WPF to know why you'd get the exception you're seeing. One thing that might help would be running with –X:ExceptionDetail so you get the full .NET stack trace as well. That might help someone else on the list identify what's going on. *From:* [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] *On Behalf Of *Rob Oakes *Sent:* Sunday, November 02, 2008 9:01 PM *To:* users@lists.ironpython.com *Subject:* [IronPython] Question Regarding WPF : DataBinding, DataTemplates and C# Extensions Dear Group, I have a rather involved question (more accurately series of questions) regarding WPF, particularly how it relates to DataBinding and DataTemplates. I will do my best to keep this posting to a reasonable length, but ... well ... I guess this serves somewhat as a warning ;) If you will spare me a bit of background, I recently began trying to learn IronPython after hearing an enthusiastic endorsement from a friend and colleague. While not a programmer or computer scientist by training (on the opposite of the spectrum, actually, my degree is in biomedical engineering); I have found myself increasing needing to work with programming tools in the past few years. This friend pointed me toward the .Net framework, and IronPython in particular as a potential solution to several major issues we have been facing with our primary data processing tool: Matlab. As a trial test, I therefore decided to create a small program in IronPython, namely, a Podcast Aggregator. I purchased a Manning Early Access Program copy of Michael Foord's (excellent BTW) book, IronPython in Action and started trying to work toward my small test project. As I also wanted to learn WPF (not to mention make my little program as pretty as possible), I decided to write the user interface for my aggregator in .xaml. So, with that background out of the way, I arrive at a few questions. The first of these is somewhat of a follow-up to a topic addressed in May on this very list somewhat recently (reference: http://lists.ironpython.com/pipermail/users-ironpython.com/2007-May/004912.html). In the original post, the author (Bish Bosh) asked what the best method of referring to Python types in Xaml was. Later in the discussion, Dino Viehland offered that it might be best to: Declare an interface in C# (or find an existing one which has what you want) and inherit and implement the interfaces in Python. Then the interface will be the bridge between the static and dynamic worlds (reference: http://lists.ironpython.com/pipermail/users-ironpython.com/2007-May/004913.html ). So, my first question: After reading all the material I have been able to find on the subject, I have not been able to locate a good tutorial or example of how this might be done. Might it be possible to get some additional information on how this can be accomplished? A simple example of how it can then be integrated into IronPython code would be extremely appreciated. I have made an effort using the information available in the IronPython tutorial and a relatively simple XAML example (reference: http://blah.winsmarts.com/2007-3-WPF__The_DataTemplate,_choosing_how_your_data_will_look_like.aspx), but I have had no luck in creating a test application that will successfully load and perform as advertised. Using the xaml, C# and mainWindow.py file below, I receive the error: SystemError: Type reference cannot find public type named 'LocalTimes' I am at the end of my rope and am not sure what I should try next. Are there any ideas on how I might successfully implement a custom C# interface? Sincerely, Rob Oakes PS, Here is the source code for the simple test case I have been working with. Main IPY script, called from command line with ipy TestApp.py import clr import os import WindowsRSS clr.AddReference(PresentationFramework) clr.AddReference(PresentationCore) clr.AddReferenceToFile(IFancyData.dll)
Re: [IronPython] Talk to Python script from C# app...
As Curt already told you: But your program almost certainly makes use of parts of the standard CPython library, which you'd then have to copy over as well. On Fri, Jun 13, 2008 at 8:30 PM, Bob Rosembob [EMAIL PROTECTED] wrote: Curt, I copied all the files (app.exe + cycle.py + python.exe + python25.dll) to another PC, which doesn't have Python installed, and ran it. I got error saying that it can't import string module (No module named string). Any ideas? Thanks, Bob - Original Message From: Curt Hagenlocher [EMAIL PROTECTED] To: Discussion of IronPython users@lists.ironpython.com Sent: Thursday, June 12, 2008 3:18:09 PM Subject: Re: [IronPython] Talk to Python script from C# app... Whether it's CPython or IronPython, you're going to have to deploy something to the user's PC if you want to run a Python program there. IronPython doesn't have any kind of installer; you just copy its modules over with your application. But your program almost certainly makes use of parts of the standard CPython library, which you'd then have to copy over as well. Even though CPython has an installer under Windows, I suspect you can still do an xcopy deployment of it to most machines provided that you also grab a copy of Python25.dll from the Windows directory. To try with IronPython, You can run ipy.exe the same way as you're running python.exe. But you'd want to try this from a command prompt first before going to the trouble of changing your C# program. On Wed, Jun 11, 2008 at 3:40 PM, Bob Rosembob [EMAIL PROTECTED] wrote: Thank you Michael and Curt for your quick response. I got the script working using the following logic: private Process P; ... string python = @C:\Python25\python.exe; string pyscript = @IronPython\cycle_LR.py; P = new Process(); P.OutputDataReceived += new DataReceivedEventHandler(OnOutputDataReceived); P.ErrorDataReceived += new DataReceivedEventHandler(OnErrorReceived); P.StartInfo.UseShellExecute = false; P.StartInfo.RedirectStandardOutput = true; P.StartInfo.RedirectStandardError = true; P.StartInfo.CreateNoWindow = true; P.StartInfo.FileName = @python.ToString(); P.StartInfo.Arguments = -u + pyscript.ToString() + @ IronPython\cycle.ini; P.Start(); P.BeginOutputReadLine(); P.BeginErrorReadLine(); As you probably guessed I installed latest Python 2.5.2 on my machine. Now, do I need to include Python 2.5.2 into my deployment package and install it on the user's PC or I can some how embed it into my application? If the former then you can use System.Process to launch the script with IronPython. You will need to download (rather than install) and launch the script with 'ipy.exe args...'. Wouldn't this approach be simpler, since I don't have to install python on user's PC? How exactly can I run ipy.exe with the args? Curt, The script that I have to use was created in 2004 and probably was not tested with IronPython. The guy who created it left the company and nobody modified the script since. Thank you very much, Bob - Original Message From: Michael Foord [EMAIL PROTECTED] To: Discussion of IronPython users@lists.ironpython.com Sent: Wednesday, June 11, 2008 1:29:27 PM Subject: Re: [IronPython] Talk to Python script from C# app... Hello Bob, The question is, do you want to run it in the same way you would launch any command line application from C# and collect the results from standard out - or do you want to embed IronPython and run the script 'inside' your application? If the former then you can use System.Process to launch the script with IronPython. You will need to download (rather than install) and launch the script with 'ipy.exe args...'. If the latter then how you do it depends on whether you use IronPython 1 or 2 and what exactly your use case is. Michael Foord http://www.ironpythoninaction.com/ Bob Rosembob wrote: Hello there, I have a C# application and a 3rd party Python script that the application should run. The script is called periodical with some arguments, performs some calculations and returns the results. I'm running Vista VS2005. What should I do to run the script from my application? I assume I need to install IronPython on my PC. How exactly should I do it? Thanks for your help. Bob ___ 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
Re: [IronPython] Using and IronPython 1.1 Dictionary from C#
Actually, I don't really have a clue about this but Tuple key = new Tuple(new object[col, row]); seems like it doesn't do what it probably should do, or do you intend to pass a multidimensional array to the Tuple constructor? /Simon On Fri, Apr 18, 2008 at 4:39 PM, Michael Foord [EMAIL PROTECTED] wrote: Hello all, I'm trying to use an IronPython (1.1) dictionary from C#, where the dictionary is keyed by tuples. I am printing the keys - so I can see that the values I want are in the dictionary, but I can't fetch them. I have tried various approaches - the problem seems to be that when I create a new Tuple from two integers it isn't recognised as a valid key. Any suggestions/corrections. Code below (range is a Python 'Dict'): System.Console.WriteLine(Keys: {0}, range.keys()); for (int row = minRow; row (maxRow + 1); row++) { for (int col = minCol; col (maxCol+1); col++) { Tuple key = new Tuple(new object[col, row]); object val = range.GetValue(key); if (val != null) { try { result = (Double)FloatOps.Add(result, val); } catch (Exception e) { System.Console.WriteLine(e); } } else { System.Console.WriteLine(No Value for col {0} row {1}, col, row); } } I'm aware that the cast there is 'dubious', but as my code never reaches it it hasn't been a problem so far! Michael Foord ___ 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] More Performance comparisons - dictionary updates and tuples
from random import random try: import clr from System import DateTime def timeit(func): start = DateTime.Now func() end = DateTime.Now print func.__name__, 'took %s ms' % (end - start).TotalMilliseconds Just a small nitpick or whatever, you might want to consider using the System.Diagnostics.StopWatch class as it Provides a set of methods and properties that you can use to accurately measure elapsed time. i.e. try: import clr from System.Diagnostics import StopWatch def timeit(func): watch = StopWatch() watch.Start() func() watch.Stop() print func.__name__, 'took %s ms' % watch.Elapsed.TotalMilliseconds ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] DLR/ToyScript: Parser generator?
F# [1] also has some kind of lex and yacc according to [2], I've never used them myself, but being a .NET citizen one would think they should be able to spit out something appropriate? [1] http://research.microsoft.com/fsharp/fsharp.aspx [2]http://research.microsoft.com/fsharp/ergonomics.aspx On Thu, Mar 13, 2008 at 11:26 PM, Lee Culver [EMAIL PROTECTED] wrote: I'm actually quite handy with Lex and Yacc, I don't think they'll emit C# will they? -Lee *From:* [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] *On Behalf Of *Miha Valencic *Sent:* Thursday, March 13, 2008 2:18 PM *To:* Discussion of IronPython *Subject:* Re: [IronPython] DLR/ToyScript: Parser generator? You might also take a look at Lex Yacc. http://dinosaur.compilertools.net/ On a related note: I was attending one of Martins talks in 2007 and remember him saying that he created LOL-code script on a flight to Barcelona. So, I think there must be some tools that can be used to do it. Check out his LOLcode project and look for clues there. rgds, Miha. On Thu, Mar 13, 2008 at 7:40 PM, Masters, Christopher [EMAIL PROTECTED] wrote: Have a look a GOLD http://www.devincook.com/goldparser/ ___ 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] Announcement: Project to get some CPython C extensions running under IronPython
On 10/13/07, Dino Viehland [EMAIL PROTECTED] wrote: +1 on the MC++, this seems like an ideal use of it. Just a little nitpick, hopefully were talking about C++/CLI and not the antique Managed Extensions for C++ regards, Simon *From:* [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] *On Behalf Of *Curt Hagenlocher *Sent:* Friday, October 12, 2007 11:38 AM *To:* Discussion of IronPython *Subject:* Re: [IronPython] Announcement: Project to get some CPython C extensions running under IronPython On 10/12/07, *Giles Thomas* [EMAIL PROTECTED] wrote: What is the best architecture? We're thinking of this as being a bit of C# managed code to interface with the C extension, and a thin Python wrapper on top. The module's existing C extension and Python code would sandwich this layer. Let us know if this is a silly idea :-) My two cents would be this: using Managed C++, try for source compatibility first. It will almost certainly be less work than binary compatibility -- especially given your restricted test case -- and you're not likely to do much coding that wouldn't be needed for binary compatibility anyway. -- Curt Hagenlocher [EMAIL PROTECTED] ___ 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] Bug report
That's not a bug.. backslash is an escape character and \b happens to be the escape sequence for the bell character. You either need to escape the backslashes (with another backslash) or use raw strings e.g. c:\\windows\\bin rc:\windows\bin /Simon ps. who is adding a bin folder under c:\windows, that doesn't sound like the greatest idea.. ? ..or was it just a random name for demo purposes? On 7/16/07, 陶祖洪 [EMAIL PROTECTED] wrote: Hi Dino, I met a IronPython bug, does this bug has been reported? IronPython 1.1 (1.1) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. import sys sys.path.append(c:\\bin) sys.path ['D:\\Python\\IronPython', 'D:\\Python\\IronPython\\Lib', 'c:\\bin'] sys.path.append(c:\windows) sys.path ['D:\\Python\\IronPython', 'D:\\Python\\IronPython\\Lib', 'c:\\bin', 'c:\\windows'] sys.path.append(c:\windows\bin) sys.path ['D:\\Python\\IronPython', 'D:\\Python\\IronPython\\Lib', 'c:\\bin', 'c:\\windows', 'c:\\windows\x08in'] Andy.Tao ___ 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] Bug report
On 7/16/07, 陶祖洪 [EMAIL PROTECTED] wrote: Yes, it just a demo path, not a real path, :-) But when I use capital character, it work well, please see follow example: yes of course, since \B isn't a recognized escape sequence (nor is \w)... (case sensitivity you know...) /S IronPython 1.1 (1.1) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. import sys sys.path.append(c:\\bin) sys.path ['D:\\Python\\IronPython', 'D:\\Python\\IronPython\\Lib', 'c:\\bin'] sys.path.append(c:\windows) sys.path ['D:\\Python\\IronPython', 'D:\\Python\\IronPython\\Lib', 'c:\\bin', 'c:\\windows'] sys.path.append(c:\windows\bin) sys.path ['D:\\Python\\IronPython', 'D:\\Python\\IronPython\\Lib', 'c:\\bin', 'c:\\windows', 'c:\\windows\x08in'] sys.path.append(c:\windows\Bin) sys.path ['D:\\Python\\IronPython', 'D:\\Python\\IronPython\\Lib', 'c:\\bin', 'c:\\windows', 'c:\\windows\x08in', 'c:\\windows\\Bin'] -- *From:* Simon Dahlbacka [mailto:[EMAIL PROTECTED] *Sent:* Monday, July 16, 2007 15:57 *To:* [EMAIL PROTECTED]; Discussion of IronPython *Subject:* Re: [IronPython] Bug report That's not a bug.. backslash is an escape character and \b happens to be the escape sequence for the bell character. You either need to escape the backslashes (with another backslash) or use raw strings e.g. c:\\windows\\bin rc:\windows\bin /Simon ps. who is adding a bin folder under c:\windows, that doesn't sound like the greatest idea.. ? ..or was it just a random name for demo purposes? On 7/16/07, 陶祖洪 [EMAIL PROTECTED] wrote: Hi Dino, I met a IronPython bug, does this bug has been reported? IronPython 1.1 (1.1) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. import sys sys.path.append(c:\\bin) sys.path ['D:\\Python\\IronPython', 'D:\\Python\\IronPython\\Lib', 'c:\\bin'] sys.path.append(c:\windows) sys.path ['D:\\Python\\IronPython', 'D:\\Python\\IronPython\\Lib', 'c:\\bin', 'c:\\windows'] sys.path.append(c:\windows\bin) sys.path ['D:\\Python\\IronPython', 'D:\\Python\\IronPython\\Lib', 'c:\\bin', 'c:\\windows', 'c:\\windows\x08in'] Andy.Tao ___ 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] WMI in .NET?
I've tried using pywin32 with no luck (with complaints that the win32api module in win32com does not exist). that would be expected as pywin et al consists of native code that IronPython doesn't support. Is there a better .NET way to go about getting WMI information? yes, look at the System.Management namespace and/or use mgmtclassgen.exe to generate strongly typed (c#) proxies for the wmi classes you need. ( Mgmtclassgen.exe resides in the .NET SDK) Google knows the fine details. regards, Simon ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] WPF objects not available?
If this is visual studio you're talking about, you'll probably need either Visual Studio 2005 extensions for .NET Framework 3.0 (WCF WPF), November 2006 CTP( http://www.microsoft.com/downloads/details.aspx?familyid=F54F5537-CC86-4BF5-AE44-F5A1E805680Ddisplaylang=en ) or beta 1 of Visual Studio 2008 ( http://msdn2.microsoft.com/en-us/vstudio/aa700831.aspx), the previous being a slightly lighter download, and will probably work good enough for your purposes. The reason for this being necessary is AFAIK that the .NET 3.0 runtime installer GAC:s the necessary assemblies, but doesn't put them anywhere else for referencing.. /S On 6/12/07, mike arty [EMAIL PROTECTED] wrote: This question may be off-topic. I'm using IronPython to work w/Net. I recently installed the .Net 3.0 framework and the C# SDK, but the only object I have available in System.Windows is Forms. I'm not seeing any of the new WPF modules, .Media, etc... Any ideas? WPF is included w/the .Net 3.0 install from the MSDN web site right? Input greatly appreciated! -mike ___ 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] wierd import problem
On 4/24/07, Dino Viehland [EMAIL PROTECTED] wrote: Oh, it seems to be the presence of the '.dll' in the filename (although I still haven't looked too deeply to understand the exception). See below for the 3 different variations I've tried. The .NET loader will append .dll/.exe for you automatically. F:\repro\foo\Foo\bin\Debugdir Volume in drive F is New Volume Volume Serial Number is F62E-82C1 Directory of F:\repro\foo\Foo\bin\Debug 04/23/2007 01:45 PMDIR . 04/23/2007 01:45 PMDIR .. 04/23/2007 01:42 PM 4,096 Foo.Bar.dll 04/23/2007 01:42 PM11,776 Foo.Bar.pdb 04/23/2007 01:42 PM 4,096 Foo.exe 04/23/2007 01:42 PM11,776 Foo.pdb 04/10/2007 10:17 AM71,016 ipy.exe 04/10/2007 10:17 AM62,824 ipyw.exe 04/10/2007 10:17 AM50,536 IronMath.dll 04/10/2007 10:17 AM 1,373,544 IronPython.dll 04/23/2007 01:45 PMDIR tmp 8 File(s) 1,589,664 bytes 3 Dir(s) 35,566,551,040 bytes free F:\repro\foo\Foo\bin\Debug.\ipy.exe IronPython 1.1 (1.1) on .NET 2.0.50727.1318 Copyright (c) Microsoft Corporation. All rights reserved. import clr clr.AddReferenceToFile('Foo.bar.dll') import Foo.Bar Traceback (most recent call last): File , line 0, in stdin##14 File , line 0, in __import__##7 SystemError: F:\repro\foo\Foo\bin\Debug\Foo.exe is not pre-compiled module; try again after deleting it. ^Z F:\repro\foo\Foo\bin\Debug.\ipy.exe IronPython 1.1 (1.1) on .NET 2.0.50727.1318 Copyright (c) Microsoft Corporation. All rights reserved. import clr clr.AddReference('Foo.bar.dll') import Foo.Bar Traceback (most recent call last): File , line 0, in stdin##14 File , line 0, in __import__##7 SystemError: F:\repro\foo\Foo\bin\Debug\Foo.exe is not pre-compiled module; try again after deleting it. ^Z F:\repro\foo\Foo\bin\Debugipyd IronPython console: IronPython 2.0 (2.0.0.0) on .NET 2.0.50727.1318 Copyright (c) Microsoft Corporation. All rights reserved. import clr clr.AddReference('foo.bar') import Foo.Bar dir(Foo.Bar) ['Bar'] Was the switching to another executable intentional? ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] C#, Types and IronPython
Several of the MSDN examples use 'typeof(int)', why not just specify 'Int32' ? I guess it makes the code less platform dependent ?? Oh well. they are not the same thing In CLS (or whatever the .net type system is called), System.Int32 is the normal integer type, that you can type just int in C# is just syntactic sugar. In normal cases you work with variables, but in some cases you want to work with the types (just as you can use e.g. type(42) in python), in that case you can use either typeof(int) or int foo=42;foo.GetType() (or Type.GetType (System.Int32) ) and of these the former is more efficient if the type you want is known at compile time.. hope this helps, Simon ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] Method invocation when assigned to instancediffers from default assignment?
snip -Original Message- Here's a simple scenario I can think of where instances might have callable attributes that don't need (or want) self automatically put in as the first argument: --Reply-- But see, wouldn't it be nice, in your example, to do this: import sys class Logger(object) : writer = sys.stdout.write def __init__(self, writer=None) : if writer is not None : self.writer = writer def Log(self, message) : self.writer(message) Temp = Logger() OtherTemp = Logger() ErrorLog = Logger(sys.stderr.write) #At a later point in time... messageCount = 0 def myLogger(message): global messageCount messageCount += 1 sys.stdout.write( + str(messageCount) + + message) Logger.writer = myLogger Temp.Log(SomeMessage) OtherTemp.Log(SomeMessage) ErrorLog.Log(SomeError) As neither Temp nor TempOther have their own instanced function, Log would have to fallback on the class function, which is now different, just like any other class variable. But we can't do that as a function attached to a class is considered an unbound method. This inconsistency is what has me confused about the utility of this ability. FWIW, if you want to add a new instance method to an already instantiated class, in python you can do import new Temp.writer = new.instancemethod(myLogger, Temp, Logger) (Haven't tried it IronPython though..) ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] Using 3rd party Python modules
Is there a way to use these modules [VideoCapture, PIL] on IronPython? No, as of now IronPython does not support dll:s/pyd:s (which are the same thing). And this support is unlikely to appear in a near future due to implementation problems, so your best bet is to find pure python modules that does what you want or find a .NET assembly that does what you want. /Simon ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
[IronPython] site.py discrepancy
if I put a site.py file with the following contents# begin site.pyprint Hello World# end site.pynext to IronPythonConsole.exeand start ironpython I get the following output:Hello World IronPython 1.0.60619 (Beta) on .NET 2.0.50727.42Copyright (c) Microsoft Corporation. All rights reserved.so site is automatically importedbut when I do a dir()then I see ['__builtins__', '__doc__', '__name__', 'site']while in CPytion the 'site' is not in dir()/SimonBTW. it seems I cannot copy from the IronPythonConsole window (at least not like from a normal cmd window, i.e. right-click - Mark - select, rightclick), I don't get a rightclick menu? ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
[IronPython] help / help()
CPython 2.4.1: helpType help() for interactive help, or help(object) for help about object. help()Welcome to Python 2.4! This is the online help utility.If this is your first time using Python, you should definitely check out the tutorial on the Internet at http://www.python.org/doc/tut/.Enter the name of any module, keyword, or topic to get help on writingPython programs and using Python modules. To quit this help utility and return to the interpreter, just type quit.To get a list of available modules, keywords, or topics, type modules,keywords, or topics. Each module also comes with a one-line summary of what it does; to list the modules whose summaries contain a given wordsuch as spam, type modules spam.helpIronPython beta8: helpbuilt-in function help help()Traceback (most recent call last): File , line 0, in stdin##7TypeError: help() takes exactly 1 argument (0 given) ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
[IronPython] __slots__ and __str__/__repr__
CPython2.4.1class foo(object):... __slots__ = [bar]...foo.barmember 'foo' of 'foo' objects f = foo() f.barTraceback (most recent call last): File stdin, line 1, in ?AttributeError: barIronpython beta8class foo(object):... __slots__ = [bar]foo.barproperty# foo on Object_1 f = foo() f.barTraceback (most recent call last): File , line 0, in stdin##42 File , line 0, in get_bar##43AttributeError: 'class '__main__.foo'' object has no attribute 'bar' ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] __slots__ and __str__/__repr__
no, not at all, I just played around at the console trying to find bugs.. :)That said, it probably would suck pretty badly if I was using doctest or something similar../SOn 7/6/06, Dino Viehland [EMAIL PROTECTED] wrote: Thanks again for the bug report. I've opened bug 797 to track this one http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPythonWorkItemId=797 Is this currently blocking you? The reason I ask is we're only differing by a couple of things (the property name being the obviously most egregious one) and it'd be nice to have an idea how we should prioritize this. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Simon Dahlbacka Sent: Wednesday, July 05, 2006 12:29 PM To: Discussion of IronPython Subject: [IronPython] __slots__ and __str__/__repr__ CPython2.4.1 class foo(object): ... __slots__ = [bar] ... foo.bar member 'foo' of 'foo' objects f = foo() f.bar Traceback (most recent call last): File stdin, line 1, in ? AttributeError: bar Ironpython beta8 class foo(object): ... __slots__ = [bar] foo.bar property# foo on Object_1 f = foo() f.bar Traceback (most recent call last): File , line 0, in stdin##42 File , line 0, in get_bar##43 AttributeError: 'class '__main__.foo'' object has no attribute 'bar' ___users mailing listusers@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] Visual studio and IronPython
On 5/22/06, Michael Foord [EMAIL PROTECTED] wrote: Aaron Marten wrote: Hi Donald, I wrote a blog entry about this a while back. Right now, you'll need to go download the April 2006 release of the Visual Studio SDK and build the IronPythonIntegration sample to use IronPython in Visual Studio. I've tried to install the Visual Studio SDK with Visual Studio ExpressC# (the free one), but it refuses to play ball. (It insists that VisualStudio isn't installed.)Is this the expected behaviour ? [Aron Marten] More at: http://blogs.msdn.com/aaronmar/archive/2006/02/16/533273.aspxQuote from above blog:What version of Visual Studio do I need? Can I use this with an Express edition? Unfortunately, no. The Visual Studio Express editions do not support extensibility (addins packages). This is a limitation of the Express products and not a limitation we are placing on thesample. You will need Visual Studio Standard or higher to build and use the sample. ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] from xml import xpath
Re pyd:s playing tricks..In this case it's not any pyd:s that is playing tricks but C:\Python24\Lib\xml\__init__.py :_MINIMUM_XMLPLUS_VERSION = (0, 8, 4) try: import _xmlplusexcept ImportError: passelse: try: v = _xmlplus.version_info except AttributeError: # _xmlplus is too old; ignore it pass else: if v = _MINIMUM_XMLPLUS_VERSION: import sys sys.modules[__name__] = _xmlplus else: del v (PyXML installs itself as _xmplus)On 5/19/06, Dino Viehland [EMAIL PROTECTED] wrote: This is probably really tough to do – in order to know the PYD is playing tricks we'd need to support using the PYD, and then it's not a problem anymore. I'll open a bug on this anyway to see if we can make the experience better, but I have no idea what sort of time frame we'd be able to do this in (another option for us would be to create an xpath wrapper around System.Xml.XPath which looks like pyxml, but it'd not solve any larger problems around PYDs in general). Do you want to help develop Dynamic languages on CLR? ( http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038) From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]] On Behalf Of Greg Lee Sent: Friday, May 19, 2006 10:18 AM To: Discussion of IronPython Subject: Re: [IronPython] from xml import xpath Is a better diagnostic message possible? This would let us distinguish a pyd problem from playing tricks with paths, and presumably there might be some value in fixing any problems in the latter. -Original Message- From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]]On Behalf Of Dino Viehland Sent: Wednesday, May 17, 2006 11:50 AM To: Discussion of IronPython Subject: Re: [IronPython] from xml import xpath You're right, I did miss that… Looking at this page: http://pyxml.sourceforge.net/topics/howto/section-install.html It would seem that you may be right about the Pyd's (it at least requires a C compiler, making that likely – and almost guaranteeing it won't work w/ IronPython). Unfortunately we don't support PYD's currently (and aren't likely to soon) so most likely this won't currently work. If you absolutely need XPath support in the mean time I'd suggest using .NET's XMLPath (and if you need to work on both you could make a thin wrapper over either PyXml for CPython and .NET's XPath support). For example: import clr clr.AddReference('System.Xml') import System.Xml.XPath as XPath xpathDoc = XPath.XPathDocument('file://foo.txt') Do you want to help develop Dynamic languages on CLR? ( http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038) From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]] On Behalf Of Simon Dahlbacka Sent: Wednesday, May 17, 2006 11:41 AM To: Discussion of IronPython Subject: Re: [IronPython] from xml import xpath Dino, you seemed to have missed the part about pyxml.. It works in cpython with pyxml installed. However, pyxml is playing tricks with paths etc, and there might even be pyd:s involved.. C:\Python24python.exe Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import xml xml.__file__ 'C:\\Python24\\lib\\site-packages\\_xmlplus\\__init__.pyc' from xml import xpath On 5/17/06, Dino Viehland [EMAIL PROTECTED] wrote: This doesn't work for my in CPython 2.4 either, so I think the docs are wrong: from xml import xpath Traceback (most recent call last): File stdin, line 1, in ? ImportError: cannot import name xpath import sys sys.version '2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]' Do you want to help develop Dynamic languages on CLR? ( http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038) From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]] On Behalf Of Greg Lee Sent: Tuesday, May 16, 2006 3:17 PM To: users@lists.ironpython.com Subject: [IronPython] from xml import xpath I'm porting an application that uses PyXML. The following from the PyXml documentation http://pyxml.sourceforge.net/topics/howto/section-XPath.html doesn't work: from xml import xpath Traceback (most recent call last): File , line 0, in input##113 ImportError: cannot import xpath from xml Any suggestions? I messed around with adding site-packages to IRONPYTHONPATH but other BadThings happened. Here's the installation: Microsoft Windows XP [Version 5.1.2600] IronPython 1.0.60420 (Beta) on .NET 2.0.50727.42 python 2.4.2 pyxml 0.8.4 pywin32 205 py2exe 0.6.3 IRONPYTHONPATH = c:\python24\lib ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ___users mailing listusers@lists.ironpython.com http
Re: [IronPython] from xml import xpath
Dino, you seemed to have missed the part about pyxml..It works in cpython with pyxml installed. However, pyxml is playing tricks with paths etc, and there might even be pyd:s involved..C:\Python24python.exe Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32Type help, copyright, credits or license for more information. import xml xml.__file__'C:\\Python24\\lib\\site-packages\\_xmlplus\\__init__.pyc' from xml import xpathOn 5/17/06, Dino Viehland [EMAIL PROTECTED] wrote: This doesn't work for my in CPython 2.4 either, so I think the docs are wrong: from xml import xpath Traceback (most recent call last): File stdin, line 1, in ? ImportError: cannot import name xpath import sys sys.version '2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]' Do you want to help develop Dynamic languages on CLR? ( http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038) From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]] On Behalf Of Greg Lee Sent: Tuesday, May 16, 2006 3:17 PM To: users@lists.ironpython.com Subject: [IronPython] from xml import xpath I'm porting an application that uses PyXML. The following from the PyXml documentation http://pyxml.sourceforge.net/topics/howto/section-XPath.html doesn't work: from xml import xpath Traceback (most recent call last): File , line 0, in input##113 ImportError: cannot import xpath from xml Any suggestions? I messed around with adding site-packages to IRONPYTHONPATH but other BadThings happened. Here's the installation: Microsoft Windows XP [Version 5.1.2600] IronPython 1.0.60420 (Beta) on .NET 2.0.50727.42 python 2.4.2 pyxml 0.8.4 pywin32 205 py2exe 0.6.3 IRONPYTHONPATH = c:\python24\lib ___users mailing listusers@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