Re: [IronPython] Command line
The reason arguments aren't getting passed is because file associations by default only pass the file name, not any additional arguments. You can see the registry entry for the file association by running the following IPy code: # Reads the registry key containing the command to run for .py files from Microsoft.Win32 import Registry openkey = Registry.ClassesRoot.OpenSubKey regkey = openkey(openkey('.py').GetValue('') + r'\shell\open\command') print regkey.GetValue('') which will print something like: "C:\path\to\ipy.exe" "%1" To pass more arguments, you'd have to add "%*" to that registry entry. In Windows XP I think you can do it from Windows Explorer, Tools | Options | File Associations, find .py association and edit it. In Windows Vista I don't know how to fix it besides manually modifying the registry entry, e.g.: # Warning: modifies the registry, don't run unless you know what you're doing from Microsoft.Win32 import Registry openkey = Registry.ClassesRoot.OpenSubKey regkey = openkey(openkey('.py').GetValue('') + r'\shell\open\command', True) regkey.SetValue('', regkey.GetValue('') + ' %*') John -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Iain Sent: Tuesday, June 12, 2007 10:18 PM To: Discussion of IronPython Subject: Re: [IronPython] Command line What I didn't make clear was that the extra option (in this case the word test) was missing when using the file association. Iain. Martin Maly wrote: > That seems correct. If I read your message correctly, when you run the .py > file directly and rely on the file association, the python file name will get > passed to the ipy.exe as full path. It is consistent with what I am seeing > with simple test using notepad: > > If, from command line I start "x.txt", notepad will launch with the command > line: > > "C:\WINDOWS\system32\NOTEPAD.EXE" D:\Dev\Gen\bin\Debug\x.txt > > Martin > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Iain > Sent: Tuesday, June 12, 2007 9:18 PM > To: Discussion of IronPython > Subject: [IronPython] Command line > > If I associate ipy.exe with *.py files then run the IronPython files > directory I am not seeing any command line argument that I try to pass > in to the script. > > I have a file called cmdline_test.py with the following two lines, > import System > print System.Environment.CommandLine > > If I run "C:\Program Files\IronPython\ipy.exe" cmdline_test.py test I > will get > "C:\Program Files\IronPython\ipy.exe" cmdline_test.py test > > If I run cmdline_test.py test I then get > "C:\Program Files\IronPython\ipy.exe" "C:\Scripts\cmdline_test.py" > > Is this the expected behavior? > > Thanks > > Iain. > ___ > 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] Command line
What I didn't make clear was that the extra option (in this case the word test) was missing when using the file association. Iain. Martin Maly wrote: > That seems correct. If I read your message correctly, when you run the .py > file directly and rely on the file association, the python file name will get > passed to the ipy.exe as full path. It is consistent with what I am seeing > with simple test using notepad: > > If, from command line I start "x.txt", notepad will launch with the command > line: > > "C:\WINDOWS\system32\NOTEPAD.EXE" D:\Dev\Gen\bin\Debug\x.txt > > Martin > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Iain > Sent: Tuesday, June 12, 2007 9:18 PM > To: Discussion of IronPython > Subject: [IronPython] Command line > > If I associate ipy.exe with *.py files then run the IronPython files > directory I am not seeing any command line argument that I try to pass > in to the script. > > I have a file called cmdline_test.py with the following two lines, > import System > print System.Environment.CommandLine > > If I run "C:\Program Files\IronPython\ipy.exe" cmdline_test.py test I > will get > "C:\Program Files\IronPython\ipy.exe" cmdline_test.py test > > If I run cmdline_test.py test I then get > "C:\Program Files\IronPython\ipy.exe" "C:\Scripts\cmdline_test.py" > > Is this the expected behavior? > > Thanks > > Iain. > ___ > 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] Command line
That seems correct. If I read your message correctly, when you run the .py file directly and rely on the file association, the python file name will get passed to the ipy.exe as full path. It is consistent with what I am seeing with simple test using notepad: If, from command line I start "x.txt", notepad will launch with the command line: "C:\WINDOWS\system32\NOTEPAD.EXE" D:\Dev\Gen\bin\Debug\x.txt Martin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Iain Sent: Tuesday, June 12, 2007 9:18 PM To: Discussion of IronPython Subject: [IronPython] Command line If I associate ipy.exe with *.py files then run the IronPython files directory I am not seeing any command line argument that I try to pass in to the script. I have a file called cmdline_test.py with the following two lines, import System print System.Environment.CommandLine If I run "C:\Program Files\IronPython\ipy.exe" cmdline_test.py test I will get "C:\Program Files\IronPython\ipy.exe" cmdline_test.py test If I run cmdline_test.py test I then get "C:\Program Files\IronPython\ipy.exe" "C:\Scripts\cmdline_test.py" Is this the expected behavior? Thanks Iain. ___ 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] Command line
Looks like I've worked it out for myself. It looks like that is the behavior you will get if you use the 'Always open with this applications' option when you use 'Open With..' I fixed it by undoing that change and changing what was run for all Python.File types. Iain. Iain wrote: > If I associate ipy.exe with *.py files then run the IronPython files > directory I am not seeing any command line argument that I try to pass > in to the script. > > I have a file called cmdline_test.py with the following two lines, > import System > print System.Environment.CommandLine > > If I run "C:\Program Files\IronPython\ipy.exe" cmdline_test.py test I > will get > "C:\Program Files\IronPython\ipy.exe" cmdline_test.py test > > If I run cmdline_test.py test I then get > "C:\Program Files\IronPython\ipy.exe" "C:\Scripts\cmdline_test.py" > > Is this the expected behavior? > > Thanks > > Iain. > ___ > 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] Command line
If I associate ipy.exe with *.py files then run the IronPython files directory I am not seeing any command line argument that I try to pass in to the script. I have a file called cmdline_test.py with the following two lines, import System print System.Environment.CommandLine If I run "C:\Program Files\IronPython\ipy.exe" cmdline_test.py test I will get "C:\Program Files\IronPython\ipy.exe" cmdline_test.py test If I run cmdline_test.py test I then get "C:\Program Files\IronPython\ipy.exe" "C:\Scripts\cmdline_test.py" Is this the expected behavior? Thanks Iain. ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] WPF objects not available?
You need to add references to the WPF assemblies from IronPython. There's a section on how to use WPF from IronPython in the tutorial which is part of the distribution. The code you need is roughly (emphasizing roughly, because "from module import *" is best avoided for possible name clashes) import clr clr.AddReferenceByPartialName("PresentationCore") clr.AddReferenceByPartialName("PresentationFramework") clr.AddReferenceByPartialName("WindowsBase") clr.AddReferenceByPartialName("IronPython") clr.AddReferenceByPartialName("Microsoft.Scripting") from math import * from System import * from System.Windows import * from System.Windows.Media import * from System.Windows.Media.Animation import * from System.Windows.Controls import * from System.Windows.Shapes import * Martin From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of mike arty Sent: Tuesday, June 12, 2007 12:45 PM To: users@lists.ironpython.com Subject: [IronPython] WPF objects not available? 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
Re: [IronPython] Unable to integrate IronPython 1.1 with VS2005 standard edition
Sounds like this might be related to http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1055922&SiteID=1 ... -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Rowe Sent: Tuesday, June 12, 2007 2:17 AM To: users@lists.ironpython.com Subject: Re: [IronPython] Unable to integrate IronPython 1.1 with VS2005 standard edition On 12/06/07, Dave Fugate <[EMAIL PROTECTED]> wrote: > Does it still fail if you run "msbuild IronPython.sln" from a VS2005 or .NET > SDK command prompt? Yes, it gives me the same VS error from the .NET SDK command prompt. The console gives me: Target SettingUpDevenv: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.com /rt "Software\Microsoft\VisualStudio\8.0Exp" /setup C:\Program Files\Visual Studio 2005 SDK\2007.02\VisualStudioIntegration\Tools\Build\Microsoft.VsSDK.targets(228,5): error MSB6006: "devenv.com" exited with code 2. > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Rowe > Sent: Monday, June 11, 2007 6:13 AM > To: users@lists.ironpython.com > Subject: [IronPython] Unable to integrate IronPython 1.1 with VS2005 standard > edition > > I can open IronPython.sln ok, but when I try to build it VS crashes > ("Microsoft Visual Studio has encountered a problem and needs to > close"). The error signature is: > AppName: devenv.exe AppVer: 8.0.50727.42 AppStamp:4333e699 > ModName: msenv.dll ModVer: 8.0.50727.42 ModStamp:4333e919 > fDebug: 0 Offset: 001bb493 > > Now I'm stuck -- how do I get past that? > -- > Tim Rowe -- Tim Rowe ___ 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 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-F5A1E805680D&displaylang=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
[IronPython] WPF objects not available?
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
Re: [IronPython] Newline oddities
I think the correct behavior would be to use os.linesep which is "\r\n" as you state: IronPython console: IronPython 2.0 (2.0.0.0) on .NET 2.0.50727.1366 Copyright (c) Microsoft Corporation. All rights reserved. >>> import os >>> os.linesep '\r\n' Filed as CodePlex Work Item #11016 (http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=11016). From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thane Plummer Sent: Tuesday, June 12, 2007 7:44 AM To: users@lists.ironpython.com Subject: [IronPython] Newline oddities IPY.exe 1.1 and 2.0 both emit the newline sequence as: "\r\r\n" (hex 0x000D 0x000D 0x000A) Instead of the more standard sequence of: "\r\n"(hex 0x000D 0x000A) This behavior is not seen in -X:TabCompletion mode in IPY 1.1. I know that there are a lot of irregularities in representing the newline sequence, but this is a new one for me. Is this behavior intended? --Thane P.S. I've "fixed" the behavior so my IDE works nicely, otherwise it doesn't recognize the newline. Thane Plummer TKP Corp. No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.14/845 - Release Date: 6/12/2007 6:39 AM ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] -X:MTA fails in IP 2.0
Thanks! Filed as CodePlex Work Item #11014 (http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=11014). As for -X:TabCompletion, did you mean that it does not work for simple variable expansion (see http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=10928) or something else entirely? 11014 11014 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thane Plummer Sent: Tuesday, June 12, 2007 7:43 AM To: users@lists.ironpython.com Subject: [IronPython] -X:MTA fails in IP 2.0 -- C:\Python\IronPython-2.0A1>ipy -X:MTA File -X:MTA does not exist. C:\Python\IronPython-2.0A1> -- This is unique to IPY 2.0, and is not seen in IPY 1.1 Also, -X:TabCompletion doesn't work in IPY 2.0 Thane Plummer TKP Corp. No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.14/845 - Release Date: 6/12/2007 6:39 AM ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
[IronPython] Newline oddities
IPY.exe 1.1 and 2.0 both emit the newline sequence as: "\r\r\n" (hex 0x000D 0x000D 0x000A) Instead of the more standard sequence of: "\r\n"(hex 0x000D 0x000A) This behavior is not seen in -X:TabCompletion mode in IPY 1.1. I know that there are a lot of irregularities in representing the newline sequence, but this is a new one for me. Is this behavior intended? --Thane P.S. I've "fixed" the behavior so my IDE works nicely, otherwise it doesn't recognize the newline. Thane Plummer TKP Corp. No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.14/845 - Release Date: 6/12/2007 6:39 AM ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
[IronPython] -X:MTA fails in IP 2.0
-- C:\Python\IronPython-2.0A1>ipy -X:MTA File -X:MTA does not exist. C:\Python\IronPython-2.0A1> -- This is unique to IPY 2.0, and is not seen in IPY 1.1 Also, -X:TabCompletion doesn't work in IPY 2.0 Thane Plummer TKP Corp. No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.14/845 - Release Date: 6/12/2007 6:39 AM ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] Unable to integrate IronPython 1.1 with VS2005 standard edition
On 12/06/07, Dave Fugate <[EMAIL PROTECTED]> wrote: > Does it still fail if you run "msbuild IronPython.sln" from a VS2005 or .NET > SDK command prompt? Yes, it gives me the same VS error from the .NET SDK command prompt. The console gives me: Target SettingUpDevenv: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.com /rt "Software\Microsoft\VisualStudio\8.0Exp" /setup C:\Program Files\Visual Studio 2005 SDK\2007.02\VisualStudioIntegration\Tools\Build\Microsoft.VsSDK.targets(228,5): error MSB6006: "devenv.com" exited with code 2. > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Rowe > Sent: Monday, June 11, 2007 6:13 AM > To: users@lists.ironpython.com > Subject: [IronPython] Unable to integrate IronPython 1.1 with VS2005 standard > edition > > I can open IronPython.sln ok, but when I try to build it VS crashes > ("Microsoft Visual Studio has encountered a problem and needs to > close"). The error signature is: > AppName: devenv.exe AppVer: 8.0.50727.42 AppStamp:4333e699 > ModName: msenv.dll ModVer: 8.0.50727.42 ModStamp:4333e919 > fDebug: 0 Offset: 001bb493 > > Now I'm stuck -- how do I get past that? > -- > Tim Rowe -- Tim Rowe ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] Reading Text files with open
John Messerly wrote: >Actually, it's a result of System.Text.ASCIIEncoding, which replaces bytes >greater than 0x7f with a question mark. I filed this as CodePlex work item >#10983 >(http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=10983). > > > Thanks. With CPython, the only difference between reading with 'r' and 'rb' is the handling of newlines. Michael http://www.voidspace.org.uk/ironpython/index.shtml >Thanks, > >John > >-Original Message- >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Foord >Sent: Monday, June 11, 2007 4:04 PM >To: Discussion of IronPython >Subject: [IronPython] Reading Text files with open > >Hello all, > >If I create a file with the following code: > >open(r'c:\temp\test.txt', 'w').write('\xa33') > >And then read it in using the Python 'open', I get different results >with Python and IronPython: > >CPython 2.4.4: > > >>> data = open(r'c:\temp\test.txt').read() > >>> data >'\xa33' > >>> ord(data[0]) >163 > >IronPython 1.1: > > >>> data = open(r'c:\temp\test.txt').read() > >>> data >'?3' > >>> ord(data[0]) >63 > >If I use the 'rb' flag with IronPython then the right thing happens, but >this isn't binary data... > >Is there any way round this - I guess it is a consequence of .NET strings. > >Michael >___ >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