From pgquiles at elpauer.org Mon Dec 3 23:35:38 2012 From: pgquiles at elpauer.org (Pau Garcia i Quiles) Date: Mon, 3 Dec 2012 23:35:38 +0100 Subject: [Ironpython-users] Reminder: FOSDEM CrossDesktop DevRoom 2013 - Call for Talks In-Reply-To: References: Message-ID: Hello, The Call for Talks for the CrossDesktop DevRoom at FOSDEM 2013 is officially open and will close in two weeks (Dec 14th). Please submit your talk proposals ASAP! --8<--- * FOSDEM is one of the largest gatherings of Free Software contributors in the world and happens each February in Brussels (Belgium). One of the tracks will be the CrossDesktop DevRoom, which will host Desktop-related talks. We are now inviting proposals for talks about Free/Libre/Open-source Software on the topics of Desktop development, Desktop applications and interoperativity amongst Desktop Environments. This is a unique opportunity to show novel ideas and developments to a wide technical audience. Topics accepted include, but are not limited to: Enlightenment, Gnome, KDE, Unity, XFCE, Windows, Mac OS X, general desktop matters, applications that enhance desktops and web (when related to desktop). Talks can be very specific, such as developing mobile applications with Qt Quick; or as general as predictions for the fusion of Desktop and web in 5 years time. Topics that are of interest to the users and developers of all desktop environments are especially welcome. The FOSDEM 2012 schedule might give you some inspiration: https://archive.fosdem.org/2012/schedule/track/crossdesktop_devroom.html Please include the following information when submitting a proposal: - Your name - The title of your talk (please be descriptive, as titles will be listed with around 250 from other projects) - Short abstract of one or two paragraphs - Short bio - Requested time: from 15 to 45 minutes. Normal duration is 30 minutes. Longer duration requests must be properly justified. The deadline for submissions is December 14th 2012. FOSDEM will be held on the weekend of 2-3 February 2013. Please submit your proposals to crossdesktop-devroom at lists.fosdem.org (subscribtion page for the mailing list: https://lists.fosdem.org/listinfo/crossdesktop-devroom ) -- The CrossDesktop DevRoom 2013 Organization Team* --8<--- -- Pau Garcia i Quiles http://www.elpauer.org (Due to my workload, I may need 10 days to answer) -------------- next part -------------- An HTML attachment was scrubbed... URL: From no_reply at codeplex.com Sat Dec 8 12:18:42 2012 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 8 Dec 2012 03:18:42 -0800 Subject: [Ironpython-users] IronPython, Daily Digest 12/7/2012 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New comment] match cpython behaviour - types.ModuleType() ---------------------------------------------- ISSUES 1. [New comment] match cpython behaviour - types.ModuleType() http://ironpython.codeplex.com/workitem/33173 User kent37 has commented on the issue: "This bug prevents ipython from working in IronPython 2.7.3." ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cold_fusion at fastmail.fm Sun Dec 9 19:11:16 2012 From: cold_fusion at fastmail.fm (cold_fusion at fastmail.fm) Date: Sun, 09 Dec 2012 20:11:16 +0200 Subject: [Ironpython-users] WF and Ipy Message-ID: <1355076676.6809.140661163820337.20480A6A@webmail.messagingengine.com> Hello, I have a WPF app (written in C#) which re-hosts the WF designer along with a toolbox control, and I want to add activities written as python classes (inherited from NativeActivity) to the toolbox. Creating a class and wrapping it in ToolboxItemWrapper works fine, but the problem arises when trying to add the wrapped object to a ToolboxCategory, I get an exception claiming that the assembly file cannot be found: "Could not load file or assembly 'Snippets.scripting, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified." I suppose this happens because the Snippets.scripting assembly is dynamic and ToolboxCategory.Add tries to load it from file for some reason. Can anyone see a way around this? Regards, Avi -- http://www.fastmail.fm - Accessible with your email software or over the web From kent3737 at gmail.com Mon Dec 10 16:17:30 2012 From: kent3737 at gmail.com (Kent Johnson) Date: Mon, 10 Dec 2012 10:17:30 -0500 Subject: [Ironpython-users] Help with NumPy Message-ID: Hi, Where is the best place to get help on NumPy for IronPython? (I cross-posted also to the SciPy4dotNet list but that list looks kind of dead...) My current question is, how can I create a numpy.ndarray from a System.Array? I hoped it would just work to pass the Array to ndarray() or asarray() but neither of these seem to work. I am working with large, 3-dimensional arrays so it would be nice to avoid copying the array in a loop. More generally, what is the current status of NumPy and SciPy for IronPython? The projects don't show any signs of life - no checkins since the original release, no activity on the mailing list, very difficult to even find a place to ask questions. It kind of looks like Microsoft commissioned the original work but after the release there is no funding and no community. I'm most interested in finding sources for help and documentation. Thanks for any help, tips or pointers, Kent From JackieSproat at smarttech.com Mon Dec 10 18:03:10 2012 From: JackieSproat at smarttech.com (Jackie Sproat) Date: Mon, 10 Dec 2012 17:03:10 +0000 Subject: [Ironpython-users] FW: IronPython WPF application Message-ID: <927A025C392E9746A0DE744619AE6B01087B090E@CALMAIL-MBX3.smarttech.inc> I am simply trying to get the handle to a WPF window, but it doesn't seem to be working. I am as new to WPF as I am to IronPython so please forgive me :) >From what I have read I believe the handle is not getting set in __init__ because it is only available at run_time(?) Therefore, have to add Loaded="Window_Loaded" in MyWindow.xaml so that handle is guaranteed to be set after window is loaded(?) However, this requires a routed event handler which, I know nothing about but I do know the line: ((MyWindow)(target)).Loaded += System.Windows.RoutedEventHandler(this.Window_Loaded); Works in C#, not sure what the equivalent line would be in IronPython? Please help, I simply want to run MyWindow and get a handle to it! Here is a snippet of my code: class MyWindow(Window): def __init__(self): wpf.LoadComponent(self, 'WpfApp_Test.xaml') self.hWnd = WindowInteropHelper(self).Handle #self.hWnd is not getting set dir(self.hWnd) def Window_Loaded(self): self.hWnd = WindowInteropHelper(self).Handle #never gets called if __name__ == '__main__': Application().Run(MyWindow()) #((MyWindow)(target)).Loaded += System.Windows.RoutedEventHandler(MyWindow().Window_Loaded) Actual, WPF IronPython app (VS2010) is contained in .zip folder attached (just need to rename .zzz to .zip and decompress) Cheers, Jackie -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: WpfApp_Test.zzz Type: application/octet-stream Size: 5619 bytes Desc: WpfApp_Test.zzz URL: From mvanderkolff at gmail.com Mon Dec 10 20:26:44 2012 From: mvanderkolff at gmail.com (Michael van der Kolff) Date: Tue, 11 Dec 2012 06:26:44 +1100 Subject: [Ironpython-users] FW: IronPython WPF application In-Reply-To: <927A025C392E9746A0DE744619AE6B01087B090E@CALMAIL-MBX3.smarttech.inc> References: <927A025C392E9746A0DE744619AE6B01087B090E@CALMAIL-MBX3.smarttech.inc> Message-ID: Hmm. Perhaps you should have a look at the WPF example here: http://www.ironpython.info/index.php/WPF_Example. That one doesn't try to load its UI out of an XML file. There appear to be some tricks applicable to XAML with WPF, relating to where you can load the XML from: http://stackoverflow.com/questions/710329/load-external-xaml-file-using-loadcomponent It seems that the XAML may be subject to an interesting variant of their site-origin policy :( Cheers, Michael On Tue, Dec 11, 2012 at 4:03 AM, Jackie Sproat wrote: > ** ** > > I am simply trying to get the handle to a WPF window, but it doesn?t seem > to be working.**** > > I am as new to WPF as I am to IronPython so please forgive me J**** > > > From what I have read I believe the handle is not getting set in __init__ > because it is only available at run_time(?)**** > > Therefore, have to add Loaded=?Window_Loaded? in MyWindow.xaml so that > handle is guaranteed to be set after window is loaded(?)**** > > However, this requires a routed event handler which, I know nothing about > but I do know the line: **** > > ** ** > > ((MyWindow)(target)).Loaded += > System.Windows.RoutedEventHandler(this.Window_Loaded);**** > > Works in C#, not sure what the equivalent line would be in IronPython?**** > > ** ** > > Please help, I simply want to run MyWindow and get a handle to it!**** > > ** ** > > ** ** > > Here is a snippet of my code:**** > > class MyWindow(Window):**** > > def __init__(self):**** > > wpf.LoadComponent(self, 'WpfApp_Test.xaml') **** > > self.hWnd = WindowInteropHelper(self).Handle #self.hWnd is not > getting set**** > > dir(self.hWnd)**** > > def Window_Loaded(self):**** > > self.hWnd = WindowInteropHelper(self).Handle #never gets called*** > * > > **** > > if __name__ == '__main__':**** > > Application().Run(MyWindow())**** > > #((MyWindow)(target)).Loaded += > System.Windows.RoutedEventHandler(MyWindow().Window_Loaded)**** > > ** ** > > Actual, WPF IronPython app (VS2010) is contained in .zip folder attached > (just need to rename .zzz to .zip and decompress)**** > > ** ** > > Cheers,**** > > Jackie**** > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > http://mail.python.org/mailman/listinfo/ironpython-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ward.matt at gmail.com Mon Dec 10 21:44:13 2012 From: ward.matt at gmail.com (Matt Ward) Date: Mon, 10 Dec 2012 20:44:13 +0000 Subject: [Ironpython-users] FW: IronPython WPF application In-Reply-To: <927A025C392E9746A0DE744619AE6B01087B090E@CALMAIL-MBX3.smarttech.inc> References: <927A025C392E9746A0DE744619AE6B01087B090E@CALMAIL-MBX3.smarttech.inc> Message-ID: Hi, The Window_Loaded event handler is not being run since it is missing two parameters. This is causing wpf.LoadComponent to not wire it up for you. If you change the code to the following then the event handler will run and you will be able to access the window handle. def Window_Loaded(self, sender, e): self.hWnd = WindowInteropHelper(self).Handle Alternatively to wire up the event handler in code you can use: def __init__(self): wpf.LoadComponent(self, 'WpfApp_Test.xaml') self.Loaded += self.Window_Loaded Regards, Matt On 10 December 2012 17:03, Jackie Sproat wrote: > > > I am simply trying to get the handle to a WPF window, but it doesn?t seem to > be working. > > I am as new to WPF as I am to IronPython so please forgive me J > > > From what I have read I believe the handle is not getting set in __init__ > because it is only available at run_time(?) > > Therefore, have to add Loaded=?Window_Loaded? in MyWindow.xaml so that > handle is guaranteed to be set after window is loaded(?) > > However, this requires a routed event handler which, I know nothing about > but I do know the line: > > > > ((MyWindow)(target)).Loaded += > System.Windows.RoutedEventHandler(this.Window_Loaded); > > Works in C#, not sure what the equivalent line would be in IronPython? > > > > Please help, I simply want to run MyWindow and get a handle to it! > > > > > > Here is a snippet of my code: > > class MyWindow(Window): > > def __init__(self): > > wpf.LoadComponent(self, 'WpfApp_Test.xaml') > > self.hWnd = WindowInteropHelper(self).Handle #self.hWnd is not > getting set > > dir(self.hWnd) > > def Window_Loaded(self): > > self.hWnd = WindowInteropHelper(self).Handle #never gets called > > > > if __name__ == '__main__': > > Application().Run(MyWindow()) > > #((MyWindow)(target)).Loaded += > System.Windows.RoutedEventHandler(MyWindow().Window_Loaded) > > > > Actual, WPF IronPython app (VS2010) is contained in .zip folder attached > (just need to rename .zzz to .zip and decompress) > > > > Cheers, > > Jackie > > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > http://mail.python.org/mailman/listinfo/ironpython-users > From dalius.dobravolskas at gmail.com Tue Dec 11 12:26:32 2012 From: dalius.dobravolskas at gmail.com (Dalius Dobravolskas) Date: Tue, 11 Dec 2012 13:26:32 +0200 Subject: [Ironpython-users] POST requests to IronPython CGI under IIS 7.5 Message-ID: Hi, I have created python CGI script that should handle POST requests. I'm running this script under IIS 7.5. It works without problems if I'm using CPython but with IronPython I have problem (therefore I know it is IronPython problem and not IIS). If POST request is longer than 320 symbols then my script freezes. Initially I was trying to use python cgi module - it was working until I tried POST request with more data. Then I tried to go deeper and tried to parse request manually - then I found out that reading from sys.stdin freezes my script when more data than 320 symbols is passed to script. As temporary solution I will use GET requests (but kitten is killed when you use GET to modify data) or I will use alternative to CGI scripts (any recommendations). I have created bug reports here: http://ironpython.codeplex.com/workitem/33556 Regards, Dalius Dobravolskas -------------- next part -------------- An HTML attachment was scrubbed... URL: From JackieSproat at smarttech.com Tue Dec 11 04:28:49 2012 From: JackieSproat at smarttech.com (Jackie Sproat) Date: Tue, 11 Dec 2012 03:28:49 +0000 Subject: [Ironpython-users] FW: IronPython WPF application In-Reply-To: References: <927A025C392E9746A0DE744619AE6B01087B090E@CALMAIL-MBX3.smarttech.inc>, Message-ID: <927A025C392E9746A0DE744619AE6B01087B0A3C@CALMAIL-MBX3.smarttech.inc> Thank you Matt and everyone who responded! This was exactly what I was looking for! Cheers, Jackie ________________________________________ From: Matt Ward [ward.matt at gmail.com] Sent: December 10, 2012 1:44 PM To: Jackie Sproat Cc: ironpython-users at python.org Subject: Re: [Ironpython-users] FW: IronPython WPF application Hi, The Window_Loaded event handler is not being run since it is missing two parameters. This is causing wpf.LoadComponent to not wire it up for you. If you change the code to the following then the event handler will run and you will be able to access the window handle. def Window_Loaded(self, sender, e): self.hWnd = WindowInteropHelper(self).Handle Alternatively to wire up the event handler in code you can use: def __init__(self): wpf.LoadComponent(self, 'WpfApp_Test.xaml') self.Loaded += self.Window_Loaded Regards, Matt On 10 December 2012 17:03, Jackie Sproat wrote: > > > I am simply trying to get the handle to a WPF window, but it doesn?t seem to > be working. > > I am as new to WPF as I am to IronPython so please forgive me J > > > From what I have read I believe the handle is not getting set in __init__ > because it is only available at run_time(?) > > Therefore, have to add Loaded=?Window_Loaded? in MyWindow.xaml so that > handle is guaranteed to be set after window is loaded(?) > > However, this requires a routed event handler which, I know nothing about > but I do know the line: > > > > ((MyWindow)(target)).Loaded += > System.Windows.RoutedEventHandler(this.Window_Loaded); > > Works in C#, not sure what the equivalent line would be in IronPython? > > > > Please help, I simply want to run MyWindow and get a handle to it! > > > > > > Here is a snippet of my code: > > class MyWindow(Window): > > def __init__(self): > > wpf.LoadComponent(self, 'WpfApp_Test.xaml') > > self.hWnd = WindowInteropHelper(self).Handle #self.hWnd is not > getting set > > dir(self.hWnd) > > def Window_Loaded(self): > > self.hWnd = WindowInteropHelper(self).Handle #never gets called > > > > if __name__ == '__main__': > > Application().Run(MyWindow()) > > #((MyWindow)(target)).Loaded += > System.Windows.RoutedEventHandler(MyWindow().Window_Loaded) > > > > Actual, WPF IronPython app (VS2010) is contained in .zip folder attached > (just need to rename .zzz to .zip and decompress) > > > > Cheers, > > Jackie > > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > http://mail.python.org/mailman/listinfo/ironpython-users > From no_reply at codeplex.com Wed Dec 12 16:24:53 2012 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 12 Dec 2012 07:24:53 -0800 Subject: [Ironpython-users] IronPython, Daily Digest 12/11/2012 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New issue] IronPython freezes on stdin in IIS7 CGI when doing POST request bigger than 320 symbols ---------------------------------------------- ISSUES 1. [New issue] IronPython freezes on stdin in IIS7 CGI when doing POST request bigger than 320 symbols http://ironpython.codeplex.com/workitem/33556 User daliusd has proposed the issue: "I'm have configured IIS 7 to use IronPython for CGI scripts (http://www.tikalk.com/net/configuring-ironpython-cgi-iis-7). Not let's say I have following Python script that simply reads from stdin (that's done for POST requests). I have used python cgi module initially but it has been freezing for me for some reason and I have limited that to stdin eventually. -------- import sys import os print 'Status: 200 OK' print 'Content-type: application/json' print data_len = int(os.environ.get('CONTENT_LENGTH', 0)) data = '' if data_len != 0: for i in xrange(data_len): data += sys.stdin.read(1) -------- Now make Python POST request for this script that has more than 320 bytes of data. It will freeze for you and will not return any data. Feel free to contact me if you have more questions. IronPython versions used: 2.6 for .NET 4.0, 2.7 OS: Windows 7 The very same script works without problems when using CPython 2.6 under the same IIS 7 configuration." ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From JackieSproat at smarttech.com Thu Dec 13 17:14:31 2012 From: JackieSproat at smarttech.com (Jackie Sproat) Date: Thu, 13 Dec 2012 16:14:31 +0000 Subject: [Ironpython-users] Type Error: not all arguments converted during string formatting Message-ID: <927A025C392E9746A0DE744619AE6B01087B0FF7@CALMAIL-MBX3.smarttech.inc> Test.py works as expected with: ? Python test.py ? Ipy test.py Type Error: not all arguments converted during string formatting Why does os.system command work using python but not ironPython? Is there a workaround (that doesn't involve using subprocess.Popen (b/c the actual exe I need to run doesn't work with subprocess) Please help, Jackie -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test.py Type: application/octet-stream Size: 733 bytes Desc: test.py URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: test.txt URL: From doug.blank at gmail.com Thu Dec 13 18:05:02 2012 From: doug.blank at gmail.com (Doug Blank) Date: Thu, 13 Dec 2012 12:05:02 -0500 Subject: [Ironpython-users] Type Error: not all arguments converted during string formatting In-Reply-To: <927A025C392E9746A0DE744619AE6B01087B0FF7@CALMAIL-MBX3.smarttech.inc> References: <927A025C392E9746A0DE744619AE6B01087B0FF7@CALMAIL-MBX3.smarttech.inc> Message-ID: Could it be that you have a \N in your filename? Shouldn't that be \\N? -Doug -------------- next part -------------- An HTML attachment was scrubbed... URL: From JackieSproat at smarttech.com Fri Dec 14 19:23:19 2012 From: JackieSproat at smarttech.com (Jackie Sproat) Date: Fri, 14 Dec 2012 18:23:19 +0000 Subject: [Ironpython-users] Running IronPython WPF app on seperate thread Message-ID: <927A025C392E9746A0DE744619AE6B01087B11B3@CALMAIL-MBX3.smarttech.inc> Question: How do I run the IronPython wpf app on its own thread so I can check class variables (self.age, self._textBox1) while the application is running? Is it easier to use IronPython decorator (my Python @run_async doesn't work) or .NET Threading or IronPython threading (are STATHREADs supported in IronPython)? And how do I define a class method that can be run without an instance of the class? For example, If I add new method Run_App_in_own_thread() this app will create an instance of WpfApplication1? Do I add this method to its own class and import that class in WpfApplication1 class or is there a better way? BACKGROUND: I created a simple IronPython wpf application in VS2010, it looks something like this: class WpfApplication1(Window): def __init__(self): self.age = 36 self = wpf.LoadComponent(self, 'WpfApplication1.xaml') self.Loaded += self.Window_Loaded self._textBox1.Text = 'My Text' def get_textBox1(self): return self._textBox1 def set_textBox1(self, value): self._textBox1 = value textBox1 = property(get_textBox1, set_textBox1) when a specific event is triggered on wpf UI I change self.age and self._textBox1: def myEvent(self, group): text = "testing" if not System.String.IsNullOrEmpty(text): self.set_textBox1(text) #set _textBox1 self.age = 100 Finally, I have two more WpfApplication1 class methods where the goal to at pass on the property values (for test/verification): def Provide_Age(self): return self.age def Provide_Text(self): self.get_textBox1() #return _textBox1 Question: How do I run the wpf app? Note: I want it on its own thread or so I can check Age and text before and after UI interactions... # I want something like this: - if __name__ == '__main__': - try: - app = WpfApplication1()#one instance of the class - app.Run_App_on_new_Thread() - Sleep(10) #while user interacts with UI - #verify OUTPUT - Age = app.Provide_Age() - except Exception, e: - print "Caught exception: %s" % str(e) - raise - Background: - Run from VS2010 - wpf app runs and takes input - I can step through and see age and textBox1 being set in self > .dict > age ... - Run from __main__ using simply: Application().Run(WpfApplication1()) with command: ? ipy WpfApplication1.py wpf app runs and take input but, it is not on different Thread so I can no longer use command line or continue in __main__ to call Provide_Age(), Provide_Text()... - - tried to run using the following BUT IT DIDN'T WORK - APP DOESN'T even start and no exception thrown: - def Run_Application_Thread(self): - - ''' WARNING: Not sure if I can run multiple instances of wpf app...''' - try: - thrd = Thread(ThreadStart(self.thread_start)) - thrd.ApartmentState = ApartmentState.STA - thrd.IsBackground = True - thrd.Start() - except Exception, e: - print "Caught exception: %s" % str(e) - raise - clr.SetCommandDispatcher(self.DispatchConsoleCommand) - - - def thread_start(self): - try: - self.Application().Run(WpfApplication1()) - finally: - print "finally" - clr.SetCommandDispatcher(None) - - if __name__ == '__main__': - try: - app = WpfApplication1()#one instance of the class - app.Run_Application_Thread() #creates another instance of the class...which I think is where my problem is ... - #but I NEED AN INSTACE TO CALL THE CLASS METHOD!!!!!!!!!!!!!!!!!!?????????? - except Exception, e: - print "Caught exception: %s" % str(e) - raise - - -------------- next part -------------- An HTML attachment was scrubbed... URL: From mvanderkolff at gmail.com Sat Dec 15 03:35:18 2012 From: mvanderkolff at gmail.com (Michael van der Kolff) Date: Sat, 15 Dec 2012 13:35:18 +1100 Subject: [Ironpython-users] ctypes/struct: Why does this not work? Message-ID: For background, I'm trying to port paramiko to IronPython. With the IronPyCrypto, we seem to have everything working apart from Pageant support. The question is, why does this not work? This is a simplified version of what Paramiko does - but the point is, run it on CPython and we have different behaviour. Cheers, Michael import ctypes, ctypes.wintypes, array, mmap _WM_COPYDATA = 74 _PAGEANT_MAGIC = 0x804e50ba _MAX_MSG_LEN = 8192 class COPYDATASTRUCT(ctypes.Structure): _fields_ = [ ('num_data', ctypes.c_uint32), ('data_size', ctypes.wintypes.DWORD), ('data_loc', ctypes.c_void_p), ] hWnd = ctypes.windll.user32.FindWindowA(b'Pageant', b'Pageant') #This works on IronPython tagname = "PageantRequest5" pymap = mmap.mmap(-1,_MAX_MSG_LEN,tagname=tagname, access=mmap.ACCESS_WRITE) pymap[0:5] = '\0\0\0\x01\x0b' #A request of length one asking for keys from pageant cbuf = array.array('c', bytes(tagname + '\0')) _addr, _size = cbuf.buffer_info() cds = COPYDATASTRUCT(_PAGEANT_MAGIC, _size, _addr) response = ctypes.windll.user32.SendMessageA(hWnd, _WM_COPYDATA, ctypes.sizeof(cds), ctypes.byref(cds)) print response #On CPython 2.7, 1; on Ironpython, 0. #On CPython, at this stage we can read out the response just by manipulating the mmap object. -------------- next part -------------- An HTML attachment was scrubbed... URL: From duane.mccollum at comcast.net Sat Dec 15 07:05:35 2012 From: duane.mccollum at comcast.net (duane.mccollum at comcast.net) Date: Sat, 15 Dec 2012 06:05:35 +0000 (UTC) Subject: [Ironpython-users] Can't get download from codeplex Message-ID: <252011116.1324317.1355551535131.JavaMail.root@sz0056a.emeryville.ca.mail.comcast.net> I can't seem to get Iron Python to download from codeplex. is there any reason why it's not downloading in either Firefox 10 or IE 8 on WinXP ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From mvanderkolff at gmail.com Sat Dec 15 08:23:28 2012 From: mvanderkolff at gmail.com (Michael van der Kolff) Date: Sat, 15 Dec 2012 18:23:28 +1100 Subject: [Ironpython-users] Can't get download from codeplex In-Reply-To: <252011116.1324317.1355551535131.JavaMail.root@sz0056a.emeryville.ca.mail.comcast.net> References: <252011116.1324317.1355551535131.JavaMail.root@sz0056a.emeryville.ca.mail.comcast.net> Message-ID: You are actually trying http://ironpython.codeplex.com/downloads/get/423690right? In any case, works for me. Cheers, Michael On Sat, Dec 15, 2012 at 5:05 PM, wrote: > I can't seem to get Iron Python to download from codeplex. is there any > reason why it's not downloading in either Firefox 10 or IE 8 on WinXP? > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > http://mail.python.org/mailman/listinfo/ironpython-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bruno.gallart at orange.fr Sun Dec 16 12:29:38 2012 From: bruno.gallart at orange.fr (bruno gallart) Date: Sun, 16 Dec 2012 12:29:38 +0100 Subject: [Ironpython-users] Newbee in .Net - IronPython with Word - Sharpdevelop Message-ID: <50CDB0A2.4080902@orange.fr> Hi all, :-) First, felicitations for this python's implementation. It is great ! A really pleasure ! 8-) I did a program to spell the Word's documents with Hunspell's library for .Net .. NHunspell. The program works well in the case where the user gives the path and the name of the Word's Document. Now, I should like to give the possibility to the user to check his Word's document opened. But, if I do "ActiveDocument" after "Word.Application" this method gives nothing because it is a new instance of Word and the "ActiveDocument" is possible only when the document has the focus. But when I launch my program the Word's document loose the focus. My question : How can I get the Word's document active or all the Word's documents active ? I try with GetObject (I see in VB.net) but I don't know if this command exists and how program with ? Or with the "object.Tasks.Item(x)" but i don't know to do the link between the "Task.name" and the name of the Word's document... Well I am in the fog. :-[ If somebody can give me some informations ???:-[ Cheers and thanks for your patience Bruno From no_reply at codeplex.com Mon Dec 17 09:50:02 2012 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 17 Dec 2012 00:50:02 -0800 Subject: [Ironpython-users] IronPython, Daily Digest 12/16/2012 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New issue] Unclosed file handles after execution of ZipFile.extractall method ---------------------------------------------- ISSUES 1. [New issue] Unclosed file handles after execution of ZipFile.extractall method http://ironpython.codeplex.com/workitem/33571 User constantineiv has proposed the issue: "After extracting some zip archive by zipfile.ZipFile.extractall method there are sometimes unclosed handles to archive file (after execution under context manager or after explict archive closing by close method). These open handles prevent later deletion of archive zip file. This issue manifested only in IronPython, never noticed in CPython. Please consider following code run in IPy 2.7.3 and Win7 (also tested in IPy 2.7.1 and Win2003): -------------------------------------------- import zipfile import subprocess archive_path = r'c:\dir\archive.zip' unpack_path = r'c:\dir\unpacked' handle_tool_path = r'c:\dir\handle.exe' def print_archive_handles(archive_path): p = subprocess.Popen([handle_tool_path, archive_path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) stdout, stderr = p.communicate() print stdout with zipfile.ZipFile(archive_path) as z: z.extractall(unpack_path) print_archive_handles(archive_path) -------------------------------------------- Print output is: Handle v3.46 Copyright (C) 1997-2011 Mark Russinovich Sysinternals - www.sysinternals.com ipy.exe pid: 7944 type: File 620: C:\dir\archive.zip As seen in above output of handle.exe tool (downloadable from http://technet.microsoft.com/en-US/sysinternals), there is an open handle to archive file even after an archive is closed in context manager." ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From no_reply at codeplex.com Tue Dec 18 09:46:56 2012 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 18 Dec 2012 00:46:56 -0800 Subject: [Ironpython-users] IronPython, Daily Digest 12/17/2012 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New comment] Unclosed file handles after execution of ZipFile.extractall method ---------------------------------------------- ISSUES 1. [New comment] Unclosed file handles after execution of ZipFile.extractall method http://ironpython.codeplex.com/workitem/33571 User jdhardy has commented on the issue: "This almost certainly a difference in the garbage collectors - IronPython doesn't clean things up as promptly as CPython does, and zipfile has had dependencies on the CPython before. This is another one, I'm guessing." ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From unigee at gmail.com Tue Dec 18 13:27:08 2012 From: unigee at gmail.com (Ian Gorse) Date: Tue, 18 Dec 2012 12:27:08 +0000 Subject: [Ironpython-users] No module named datetime Message-ID: Hi list, I'm new to mailing lists so apologise if this is done incorrectly - I didn't know how to search the existing archives. I am still fairly new to IronPython but managed to pick it up quite quickly, however I have come to a stumbling block. I have currently developed a C# application that converts data into specific file formats. I am using IronPython to handle the conversion process which allows me to create new converters and modifiy existing ones on the fly without re-complication of the C# application. Its wonderful and I couldn't be any happier about it. However, its time to run the application in a production environment. Once I have my software installed on a test pc (that has no developement tools installed), executing the software throws the Exception.. 'No module named datetime' And I re-created the error using a simple python script import datetime now = datetime.datetime.now() I guess I could get around it by using he .NET DateTime object but I would prefer to use the python datetime if I can. What do I need to do to make this work? Thanks From misnomer at gmail.com Tue Dec 18 13:33:13 2012 From: misnomer at gmail.com (Nicholas Devenish) Date: Tue, 18 Dec 2012 12:33:13 +0000 Subject: [Ironpython-users] No module named datetime In-Reply-To: References: Message-ID: <6BA4626C-F587-4279-983C-B3AD1A9A305C@gmail.com> Hi Ian, The default runtime files for IronPython don't include the python standard library - they are installed when you install IronPython development, which is why it works on your development machine. The solution is to either include the standard library sources, and set up your application to point to them, or compile the standard library into an extra assembly that you distribute with your application, using the pyc tool. Nick On 18 Dec 2012, at 12:27, Ian Gorse wrote: > Hi list, > > I'm new to mailing lists so apologise if this is done incorrectly - I > didn't know how to search the existing archives. > > I am still fairly new to IronPython but managed to pick it up quite > quickly, however I have come to a stumbling block. > > I have currently developed a C# application that converts data into > specific file formats. I am using IronPython to handle the conversion > process which allows me to create new converters and modifiy existing > ones on the fly without re-complication of the C# application. > Its wonderful and I couldn't be any happier about it. > > However, its time to run the application in a production environment. > > Once I have my software installed on a test pc (that has no > developement tools installed), executing the software throws the > Exception.. > > 'No module named datetime' > > And I re-created the error using a simple python script > > import datetime > now = datetime.datetime.now() > > I guess I could get around it by using he .NET DateTime object but I > would prefer to use the python datetime if I can. > > What do I need to do to make this work? > > Thanks > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > http://mail.python.org/mailman/listinfo/ironpython-users From Piotr.Nestorow at systemverification.com Tue Dec 18 14:36:45 2012 From: Piotr.Nestorow at systemverification.com (Piotr Nestorow) Date: Tue, 18 Dec 2012 14:36:45 +0100 Subject: [Ironpython-users] Using Autofac with IronPython Message-ID: <90CF25803C44814EA1B29B33259679C601E0BB311E@sr01259> Hi Is it possible to use Autofac in IronPython scripts? More exactly: Is it possible to use Autofac to find and register component types in an assembly and then use the components in the Python script? Example code: import clr clr.AddReference('Autofac') import System import Autofac clr.ImportExtensions(Autofac) from Autofac import ContainerBuilder builder = ContainerBuilder() builder.RegisterAssemblyTypes(System.Reflection.Assembly.Load("Some.Assembly")) container = builder.Build() # some object o = container.Resolve[ISomeInterface]() o.SomeMethod() Any comments, examples, etc. ? Regards Piotr -------------- next part -------------- An HTML attachment was scrubbed... URL: From rome at Wintellect.com Tue Dec 18 18:39:38 2012 From: rome at Wintellect.com (Keith Rome) Date: Tue, 18 Dec 2012 17:39:38 +0000 Subject: [Ironpython-users] No module named datetime In-Reply-To: References: Message-ID: <4C554C3A47C5024ABDE00E94DA17BC4D2D7C98A9@BN1PRD0712MB633.namprd07.prod.outlook.com> Hello Ian. The easiest thing would probably be to just use the meta_path importer feature. This allows you to package up all of the standard library directly into your compiled host application, and the python runtime will be able to find them. The steps are pretty simple: 1. Find the standard library files. Default location is usually something like C:\python27\. 2. Zip that entire folder up into a single zip file. You can optionally omit files that you know won't be needed at runtime. 3. Add the zip file to your c# project file as an embedded resource (add it to the project, and then in the file properties make sure it is set to the right build action). 4. Add a little bit of code to your Python engine startup code. Here is a simplified example of how I do it (my embedded file was named "python_27_lib.zip"), but this isn't the only way: public ScriptEngine CreateEngine() { var options = new Dictionary(); ScriptRuntimeSetup setup = Python.CreateRuntimeSetup(options); var pyRuntime = new ScriptRuntime(setup); var engineInstance = Python.GetEngine(pyRuntime); // use embedded python lib var asm = this.GetType().Assembly; var resQuery = from name in asm.GetManifestResourceNames() where name.ToLowerInvariant().EndsWith("python_27_lib.zip") select name; var resName = resQuery.Single(); var importer = new ResourceMetaPathImporter(asm, resName); dynamic sys = engineInstance.GetSysModule(); sys.meta_path.append(importer); sys.path = new List(); return engineInstance; } Keith Rome Senior Consultant and Architect MCPD-EAD, MCSD, MCDBA, MCTS-WPF, MCTS-TFS, MCTS-WSS Wintellect | 770.617.4016 | krome at wintellect.com www.wintellect.com -----Original Message----- From: Ironpython-users [mailto:ironpython-users-bounces+rome=wintellect.com at python.org] On Behalf Of Ian Gorse Sent: Tuesday, December 18, 2012 7:27 AM To: ironpython-users at python.org Subject: [Ironpython-users] No module named datetime Hi list, I'm new to mailing lists so apologise if this is done incorrectly - I didn't know how to search the existing archives. I am still fairly new to IronPython but managed to pick it up quite quickly, however I have come to a stumbling block. I have currently developed a C# application that converts data into specific file formats. I am using IronPython to handle the conversion process which allows me to create new converters and modifiy existing ones on the fly without re-complication of the C# application. Its wonderful and I couldn't be any happier about it. However, its time to run the application in a production environment. Once I have my software installed on a test pc (that has no developement tools installed), executing the software throws the Exception.. 'No module named datetime' And I re-created the error using a simple python script import datetime now = datetime.datetime.now() I guess I could get around it by using he .NET DateTime object but I would prefer to use the python datetime if I can. What do I need to do to make this work? Thanks _______________________________________________ Ironpython-users mailing list Ironpython-users at python.org http://mail.python.org/mailman/listinfo/ironpython-users From jdhardy at gmail.com Tue Dec 18 20:42:05 2012 From: jdhardy at gmail.com (Jeff Hardy) Date: Tue, 18 Dec 2012 11:42:05 -0800 Subject: [Ironpython-users] Using Autofac with IronPython In-Reply-To: <90CF25803C44814EA1B29B33259679C601E0BB311E@sr01259> References: <90CF25803C44814EA1B29B33259679C601E0BB311E@sr01259> Message-ID: I've never heard of anyone trying to use it before. You might have to try it out and let us know if you run into difficulty. - Jeff On Tue, Dec 18, 2012 at 5:36 AM, Piotr Nestorow wrote: > Hi > > Is it possible to use Autofac in IronPython scripts? > More exactly: Is it possible to use Autofac to find and register component > types in an assembly and then use the components in the Python script? > > Example code: > > > import > > clr > > clr.AddReference( > > 'Autofac') > > import System > > import > > Autofac > > clr.ImportExtensions(Autofac) > > from > > Autofac import ContainerBuilder > > builder = ContainerBuilder() > > builder.RegisterAssemblyTypes(System.Reflection.Assembly.Load( > > "Some.Assembly")) > > container = builder.Build() > > # some object > > o = container.Resolve[ISomeInterface]() > > o.SomeMethod() > > > > > > Any comments, examples, etc. ? > > > > Regards > > Piotr > > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > http://mail.python.org/mailman/listinfo/ironpython-users > From JackieSproat at smarttech.com Tue Dec 18 22:54:10 2012 From: JackieSproat at smarttech.com (Jackie Sproat) Date: Tue, 18 Dec 2012 21:54:10 +0000 Subject: [Ironpython-users] Using System.Diagnostics.Process results in Errno 22 Message-ID: <927A025C392E9746A0DE744619AE6B01087B18F2@CALMAIL-MBX3.smarttech.inc> Using python I have no problem starting my process with subprocess.Popen('java -jar "C:\Program Files (x86)\Sikuli X\sikuli-script.jar" ' + finalname, shell=True) But, because the select module is not available, you can't use the subprocess module in IronPython. So, I have to use System.Diagnostics.Process instead. However, using this with IronPython, results in Errno 22: The system cannot find the file specified... file_name = 'java -jar "C:\Program Files\Sikuli X\sikuli-script.jar" ' file_name = "\"" + file_name + "\"" try: p = Process() p.StartInfo.UseShellExecute = True p.StartInfo.RedirectStandardOutput = False p.StartInfo.FileName = file_name print p.StartInfo.FileName p.StartInfo.Arguments = arg_file print p.StartInfo.Arguments p.StartInfo.WorkingDirectory = cwd_is p.Start() Any suggestions greatly appreciated. Cheers, Jackie -------------- next part -------------- A non-text attachment was scrubbed... Name: ipyRunSikuli.py Type: application/octet-stream Size: 1732 bytes Desc: ipyRunSikuli.py URL: From jdhardy at gmail.com Wed Dec 19 00:22:50 2012 From: jdhardy at gmail.com (Jeff Hardy) Date: Tue, 18 Dec 2012 15:22:50 -0800 Subject: [Ironpython-users] Using System.Diagnostics.Process results in Errno 22 In-Reply-To: <927A025C392E9746A0DE744619AE6B01087B18F2@CALMAIL-MBX3.smarttech.inc> References: <927A025C392E9746A0DE744619AE6B01087B18F2@CALMAIL-MBX3.smarttech.inc> Message-ID: On Tue, Dec 18, 2012 at 1:54 PM, Jackie Sproat wrote: > However, using this with IronPython, results in Errno 22: The system cannot find the file specified... > > file_name = 'java -jar "C:\Program Files\Sikuli X\sikuli-script.jar" ' My guess is the backslashes are causing problems. You have two options: 1) Escape the backslashes: file_name = 'java -jar "C:\\Program Files\\Sikuli X\\sikuli-script.jar" ' 2) Use a raw string, which disables backslash escapes (also useful for regexes): file_name = r'java -jar "C:\Program Files\Sikuli X\sikuli-script.jar" ' - Jeff From jdhardy at gmail.com Wed Dec 19 00:26:07 2012 From: jdhardy at gmail.com (Jeff Hardy) Date: Tue, 18 Dec 2012 15:26:07 -0800 Subject: [Ironpython-users] ctypes/struct: Why does this not work? In-Reply-To: References: Message-ID: On Fri, Dec 14, 2012 at 6:35 PM, Michael van der Kolff wrote: > For background, I'm trying to port paramiko to IronPython. With the > IronPyCrypto, we seem to have everything working apart from Pageant support. > > The question is, why does this not work? This is a simplified version of > what Paramiko does - but the point is, run it on CPython and we have > different behaviour. > > Cheers, > > Michael > > import ctypes, ctypes.wintypes, array, mmap > > _WM_COPYDATA = 74 > _PAGEANT_MAGIC = 0x804e50ba > _MAX_MSG_LEN = 8192 > > class COPYDATASTRUCT(ctypes.Structure): > _fields_ = [ > ('num_data', ctypes.c_uint32), > ('data_size', ctypes.wintypes.DWORD), > ('data_loc', ctypes.c_void_p), > ] > > hWnd = ctypes.windll.user32.FindWindowA(b'Pageant', b'Pageant') #This works > on IronPython > > tagname = "PageantRequest5" > pymap = mmap.mmap(-1,_MAX_MSG_LEN,tagname=tagname, access=mmap.ACCESS_WRITE) > pymap[0:5] = '\0\0\0\x01\x0b' #A request of length one asking for keys from > pageant > > cbuf = array.array('c', bytes(tagname + '\0')) > _addr, _size = cbuf.buffer_info() > cds = COPYDATASTRUCT(_PAGEANT_MAGIC, _size, _addr) > response = ctypes.windll.user32.SendMessageA(hWnd, _WM_COPYDATA, > ctypes.sizeof(cds), ctypes.byref(cds)) > print response #On CPython 2.7, 1; on Ironpython, 0. > #On CPython, at this stage we can read out the response just by manipulating > the mmap object. Hard to say. It could be a bug in ctypes (it's not perfect), but debugging that could be tricky. I looped Dino in to see if he knows more. - Jeff From no_reply at codeplex.com Wed Dec 19 15:25:58 2012 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 19 Dec 2012 06:25:58 -0800 Subject: [Ironpython-users] IronPython, Daily Digest 12/18/2012 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New comment] Unclosed file handles after execution of ZipFile.extractall method ---------------------------------------------- ISSUES 1. [New comment] Unclosed file handles after execution of ZipFile.extractall method http://ironpython.codeplex.com/workitem/33571 User kent37 has commented on the issue: "The 'with' clause should remove any dependence on the garbage collector. The documentation for ZipFile shows its use in a 'with' clause and says it should close the file. http://docs.python.org/2/library/zipfile.html#zipfile-objects" ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From JackieSproat at smarttech.com Wed Dec 19 15:19:10 2012 From: JackieSproat at smarttech.com (Jackie Sproat) Date: Wed, 19 Dec 2012 14:19:10 +0000 Subject: [Ironpython-users] Using System.Diagnostics.Process results in Errno 22 In-Reply-To: References: <927A025C392E9746A0DE744619AE6B01087B18F2@CALMAIL-MBX3.smarttech.inc> Message-ID: <927A025C392E9746A0DE744619AE6B01087B1999@CALMAIL-MBX3.smarttech.inc> Curt, Thanks for the suggestion. I believe you are right. I no longer get the error message, but the command itself is not successful. Is there any other way in IronPython to run commands ? Cheers, Jackie From: Curt Hagenlocher [mailto:curt at hagenlocher.org] Sent: Tuesday, December 18, 2012 4:03 PM To: Jackie Sproat Subject: Re: [Ironpython-users] Using System.Diagnostics.Process results in Errno 22 I believe StartInfo.FileName really needs to be a file name, and not a command line. Set it to java.exe and put everything else into Arguments. On Tue, Dec 18, 2012 at 1:54 PM, Jackie Sproat > wrote: Using python I have no problem starting my process with subprocess.Popen('java -jar "C:\Program Files (x86)\Sikuli X\sikuli-script.jar" ' + finalname, shell=True) But, because the select module is not available, you can't use the subprocess module in IronPython. So, I have to use System.Diagnostics.Process instead. However, using this with IronPython, results in Errno 22: The system cannot find the file specified... file_name = 'java -jar "C:\Program Files\Sikuli X\sikuli-script.jar" ' file_name = "\"" + file_name + "\"" try: p = Process() p.StartInfo.UseShellExecute = True p.StartInfo.RedirectStandardOutput = False p.StartInfo.FileName = file_name print p.StartInfo.FileName p.StartInfo.Arguments = arg_file print p.StartInfo.Arguments p.StartInfo.WorkingDirectory = cwd_is p.Start() Any suggestions greatly appreciated. Cheers, Jackie _______________________________________________ Ironpython-users mailing list Ironpython-users at python.org http://mail.python.org/mailman/listinfo/ironpython-users -------------- next part -------------- An HTML attachment was scrubbed... URL: From JackieSproat at smarttech.com Wed Dec 19 15:20:38 2012 From: JackieSproat at smarttech.com (Jackie Sproat) Date: Wed, 19 Dec 2012 14:20:38 +0000 Subject: [Ironpython-users] Using System.Diagnostics.Process results in Errno 22 In-Reply-To: References: <927A025C392E9746A0DE744619AE6B01087B18F2@CALMAIL-MBX3.smarttech.inc> Message-ID: <927A025C392E9746A0DE744619AE6B01087B19A7@CALMAIL-MBX3.smarttech.inc> Thanks for the suggestion - I tried both solutions but, neither one of them solves the problem. System.Diagnostics.Process seems to only work if you want to launch an .exe with given arguments -----Original Message----- From: Jeff Hardy [mailto:jdhardy at gmail.com] Sent: Tuesday, December 18, 2012 4:23 PM To: Jackie Sproat Cc: ironpython-users at python.org Subject: Re: [Ironpython-users] Using System.Diagnostics.Process results in Errno 22 On Tue, Dec 18, 2012 at 1:54 PM, Jackie Sproat wrote: > However, using this with IronPython, results in Errno 22: The system cannot find the file specified... > > file_name = 'java -jar "C:\Program Files\Sikuli X\sikuli-script.jar" ' My guess is the backslashes are causing problems. You have two options: 1) Escape the backslashes: file_name = 'java -jar "C:\\Program Files\\Sikuli X\\sikuli-script.jar" ' 2) Use a raw string, which disables backslash escapes (also useful for regexes): file_name = r'java -jar "C:\Program Files\Sikuli X\sikuli-script.jar" ' - Jeff From curt at hagenlocher.org Wed Dec 19 15:31:51 2012 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Wed, 19 Dec 2012 06:31:51 -0800 Subject: [Ironpython-users] Using System.Diagnostics.Process results in Errno 22 In-Reply-To: <927A025C392E9746A0DE744619AE6B01087B1999@CALMAIL-MBX3.smarttech.inc> References: <927A025C392E9746A0DE744619AE6B01087B18F2@CALMAIL-MBX3.smarttech.inc> <927A025C392E9746A0DE744619AE6B01087B1999@CALMAIL-MBX3.smarttech.inc> Message-ID: Arg, bitten again by "reply-to"! You might need to supply a full path to java.exe in the file name. The "os.exec*" family of functions should work on IronPython, as should "os.system". On Wed, Dec 19, 2012 at 6:19 AM, Jackie Sproat wrote: > Curt,**** > > Thanks for the suggestion. I believe you are right. I no longer get the > error message, but the command itself is not successful.**** > > Is there any other way in IronPython to run commands ?**** > > ** ** > > Cheers,**** > > Jackie**** > > ** ** > > *From:* Curt Hagenlocher [mailto:curt at hagenlocher.org] > *Sent:* Tuesday, December 18, 2012 4:03 PM > *To:* Jackie Sproat > *Subject:* Re: [Ironpython-users] Using System.Diagnostics.Process > results in Errno 22**** > > ** ** > > I believe StartInfo.FileName really needs to be a file name, and not a > command line. Set it to java.exe and put everything else into Arguments.** > ** > > On Tue, Dec 18, 2012 at 1:54 PM, Jackie Sproat > wrote:**** > > Using python I have no problem starting my process with > subprocess.Popen('java -jar "C:\Program Files (x86)\Sikuli > X\sikuli-script.jar" ' + finalname, shell=True) > > But, because the select module is not available, you can't use the > subprocess module in IronPython. > So, I have to use System.Diagnostics.Process instead. > > However, using this with IronPython, results in Errno 22: The system > cannot find the file specified... > > file_name = 'java -jar "C:\Program Files\Sikuli X\sikuli-script.jar" ' > file_name = "\"" + file_name + "\"" > try: > p = Process() > p.StartInfo.UseShellExecute = True > p.StartInfo.RedirectStandardOutput = False > p.StartInfo.FileName = file_name > print p.StartInfo.FileName > p.StartInfo.Arguments = arg_file > print p.StartInfo.Arguments > p.StartInfo.WorkingDirectory = cwd_is > p.Start() > > Any suggestions greatly appreciated. > Cheers, > Jackie > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > http://mail.python.org/mailman/listinfo/ironpython-users**** > > ** ** > -------------- next part -------------- An HTML attachment was scrubbed... URL: From unigee at gmail.com Wed Dec 19 15:44:48 2012 From: unigee at gmail.com (Ian Gorse) Date: Wed, 19 Dec 2012 14:44:48 +0000 Subject: [Ironpython-users] No module named datetime In-Reply-To: <4C554C3A47C5024ABDE00E94DA17BC4D2D7C98A9@BN1PRD0712MB633.namprd07.prod.outlook.com> References: <4C554C3A47C5024ABDE00E94DA17BC4D2D7C98A9@BN1PRD0712MB633.namprd07.prod.outlook.com> Message-ID: Thank you both. I will look into this when I get back to the office. P.S I am not sure if this is replying to the whole mailing list or not. Sorry for the amateurish attempts! On Tue, Dec 18, 2012 at 5:39 PM, Keith Rome wrote: > Hello Ian. The easiest thing would probably be to just use the meta_path importer feature. This allows you to package up all of the standard library directly into your compiled host application, and the python runtime will be able to find them. The steps are pretty simple: > > 1. Find the standard library files. Default location is usually something like C:\python27\. > 2. Zip that entire folder up into a single zip file. You can optionally omit files that you know won't be needed at runtime. > 3. Add the zip file to your c# project file as an embedded resource (add it to the project, and then in the file properties make sure it is set to the right build action). > 4. Add a little bit of code to your Python engine startup code. Here is a simplified example of how I do it (my embedded file was named "python_27_lib.zip"), but this isn't the only way: > > public ScriptEngine CreateEngine() > { > var options = new Dictionary(); > ScriptRuntimeSetup setup = Python.CreateRuntimeSetup(options); > var pyRuntime = new ScriptRuntime(setup); > var engineInstance = Python.GetEngine(pyRuntime); > > // use embedded python lib > var asm = this.GetType().Assembly; > var resQuery = > from name in asm.GetManifestResourceNames() > where name.ToLowerInvariant().EndsWith("python_27_lib.zip") > select name; > var resName = resQuery.Single(); > var importer = new ResourceMetaPathImporter(asm, resName); > dynamic sys = engineInstance.GetSysModule(); > sys.meta_path.append(importer); > sys.path = new List(); > > return engineInstance; > } > > > Keith Rome > Senior Consultant and Architect > MCPD-EAD, MCSD, MCDBA, MCTS-WPF, MCTS-TFS, MCTS-WSS > Wintellect | 770.617.4016 | krome at wintellect.com > www.wintellect.com > > -----Original Message----- > From: Ironpython-users [mailto:ironpython-users-bounces+rome=wintellect.com at python.org] On Behalf Of Ian Gorse > Sent: Tuesday, December 18, 2012 7:27 AM > To: ironpython-users at python.org > Subject: [Ironpython-users] No module named datetime > > Hi list, > > I'm new to mailing lists so apologise if this is done incorrectly - I didn't know how to search the existing archives. > > I am still fairly new to IronPython but managed to pick it up quite quickly, however I have come to a stumbling block. > > I have currently developed a C# application that converts data into specific file formats. I am using IronPython to handle the conversion process which allows me to create new converters and modifiy existing ones on the fly without re-complication of the C# application. > Its wonderful and I couldn't be any happier about it. > > However, its time to run the application in a production environment. > > Once I have my software installed on a test pc (that has no developement tools installed), executing the software throws the Exception.. > > 'No module named datetime' > > And I re-created the error using a simple python script > > import datetime > now = datetime.datetime.now() > > I guess I could get around it by using he .NET DateTime object but I would prefer to use the python datetime if I can. > > What do I need to do to make this work? > > Thanks > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > http://mail.python.org/mailman/listinfo/ironpython-users > > From JackieSproat at smarttech.com Wed Dec 19 15:48:23 2012 From: JackieSproat at smarttech.com (Jackie Sproat) Date: Wed, 19 Dec 2012 14:48:23 +0000 Subject: [Ironpython-users] Using System.Diagnostics.Process results in Errno 22 In-Reply-To: References: <927A025C392E9746A0DE744619AE6B01087B18F2@CALMAIL-MBX3.smarttech.inc> <927A025C392E9746A0DE744619AE6B01087B1999@CALMAIL-MBX3.smarttech.inc> Message-ID: <927A025C392E9746A0DE744619AE6B01087B19CE@CALMAIL-MBX3.smarttech.inc> Thanks os.popen is working for me! From: Curt Hagenlocher [mailto:curt at hagenlocher.org] Sent: Wednesday, December 19, 2012 7:32 AM To: Jackie Sproat Cc: ironpython-users at python.org Subject: Re: [Ironpython-users] Using System.Diagnostics.Process results in Errno 22 Arg, bitten again by "reply-to"! You might need to supply a full path to java.exe in the file name. The "os.exec*" family of functions should work on IronPython, as should "os.system". On Wed, Dec 19, 2012 at 6:19 AM, Jackie Sproat > wrote: Curt, Thanks for the suggestion. I believe you are right. I no longer get the error message, but the command itself is not successful. Is there any other way in IronPython to run commands ? Cheers, Jackie From: Curt Hagenlocher [mailto:curt at hagenlocher.org] Sent: Tuesday, December 18, 2012 4:03 PM To: Jackie Sproat Subject: Re: [Ironpython-users] Using System.Diagnostics.Process results in Errno 22 I believe StartInfo.FileName really needs to be a file name, and not a command line. Set it to java.exe and put everything else into Arguments. On Tue, Dec 18, 2012 at 1:54 PM, Jackie Sproat > wrote: Using python I have no problem starting my process with subprocess.Popen('java -jar "C:\Program Files (x86)\Sikuli X\sikuli-script.jar" ' + finalname, shell=True) But, because the select module is not available, you can't use the subprocess module in IronPython. So, I have to use System.Diagnostics.Process instead. However, using this with IronPython, results in Errno 22: The system cannot find the file specified... file_name = 'java -jar "C:\Program Files\Sikuli X\sikuli-script.jar" ' file_name = "\"" + file_name + "\"" try: p = Process() p.StartInfo.UseShellExecute = True p.StartInfo.RedirectStandardOutput = False p.StartInfo.FileName = file_name print p.StartInfo.FileName p.StartInfo.Arguments = arg_file print p.StartInfo.Arguments p.StartInfo.WorkingDirectory = cwd_is p.Start() Any suggestions greatly appreciated. Cheers, Jackie _______________________________________________ Ironpython-users mailing list Ironpython-users at python.org http://mail.python.org/mailman/listinfo/ironpython-users -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Wed Dec 19 17:44:38 2012 From: jdhardy at gmail.com (Jeff Hardy) Date: Wed, 19 Dec 2012 08:44:38 -0800 Subject: [Ironpython-users] WF and Ipy In-Reply-To: <1355076676.6809.140661163820337.20480A6A@webmail.messagingengine.com> References: <1355076676.6809.140661163820337.20480A6A@webmail.messagingengine.com> Message-ID: On Sun, Dec 9, 2012 at 10:11 AM, wrote: > Hello, > > I have a WPF app (written in C#) which re-hosts the WF designer along > with a toolbox control, and I want to add activities written as python > classes (inherited from NativeActivity) to the toolbox. > Creating a class and wrapping it in ToolboxItemWrapper works fine, but > the problem arises when trying to add the wrapped object to a > ToolboxCategory, I get an exception claiming that the assembly file > cannot be found: > > "Could not load file or assembly 'Snippets.scripting, Version=0.0.0.0, > Culture=neutral, PublicKeyToken=null' or one of its dependencies. The > system cannot find the file specified." > > I suppose this happens because the Snippets.scripting assembly is > dynamic and ToolboxCategory.Add tries to load it from file for some > reason. > > Can anyone see a way around this? First off, sorry for taking so long to get back to you. The issue here is that IronPython does not (currently) generate assemblies that can be consumed from other .NET languages directly. I'm working on fixing that, but it's a difficult problem and I wouldn't expect it until 2.7.4, sometime in the middle of next year. In the meantime, one option is to manually build a shim library that hosts IronPython and calls the Python code. It's a bit tedious to do for every activity, but if you're writing a tool anyway there may be ways to automate generating them. I wish I had a better story for you right now, but it's going to be a little while longer before it's supported directly. - Jeff From jdhardy at gmail.com Wed Dec 19 17:47:39 2012 From: jdhardy at gmail.com (Jeff Hardy) Date: Wed, 19 Dec 2012 08:47:39 -0800 Subject: [Ironpython-users] Help with NumPy In-Reply-To: References: Message-ID: On Mon, Dec 10, 2012 at 7:17 AM, Kent Johnson wrote: > Hi, > > Where is the best place to get help on NumPy for IronPython? (I > cross-posted also to the SciPy4dotNet list but that list looks kind of > dead...) Unfortunately, I don't know if there is a good spot. > > My current question is, how can I create a numpy.ndarray from a > System.Array? I hoped it would just work to pass the Array to > ndarray() or asarray() but neither of these seem to work. I am working > with large, 3-dimensional arrays so it would be nice to avoid copying > the array in a loop. > > More generally, what is the current status of NumPy and SciPy for > IronPython? The projects don't show any signs of life - no checkins > since the original release, no activity on the mailing list, very > difficult to even find a place to ask questions. It kind of looks like > Microsoft commissioned the original work but after the release there > is no funding and no community. That's pretty much it, unfortuantely. I think the core bits are part of numpy proper, but there was no real handoff to a new maintainer. > > I'm most interested in finding sources for help and documentation. I'm afraid you might be on your own :|. Not what you wanted to hear, I'm sure. - Jeff From jdhardy at gmail.com Wed Dec 19 17:51:34 2012 From: jdhardy at gmail.com (Jeff Hardy) Date: Wed, 19 Dec 2012 08:51:34 -0800 Subject: [Ironpython-users] POST requests to IronPython CGI under IIS 7.5 In-Reply-To: References: Message-ID: On Tue, Dec 11, 2012 at 3:26 AM, Dalius Dobravolskas wrote: > Hi, > > I have created python CGI script that should handle POST requests. I'm > running this script under IIS 7.5. It works without problems if I'm using > CPython but with IronPython I have problem (therefore I know it is > IronPython problem and not IIS). If POST request is longer than 320 symbols > then my script freezes. Initially I was trying to use python cgi module - it > was working until I tried POST request with more data. Then I tried to go > deeper and tried to parse request manually - then I found out that reading > from sys.stdin freezes my script when more data than 320 symbols is passed > to script. > > As temporary solution I will use GET requests (but kitten is killed when you > use GET to modify data) or I will use alternative to CGI scripts (any > recommendations). > > I have created bug reports here: > http://ironpython.codeplex.com/workitem/33556 Thanks for the issue report. I have no idea if it's an IronPython issue or an IIS issue, but since you say it works with normal Python, my guess is IronPython somewhere. One alternative is NWSGI (http://nwsgi.codeplex.com/) which uses IronPython to implement the standard Python WSGI interface. - Jeff From dmp1991 at gmail.com Wed Dec 19 19:32:45 2012 From: dmp1991 at gmail.com (David Peterson) Date: Wed, 19 Dec 2012 18:32:45 +0000 Subject: [Ironpython-users] Help with NumPy In-Reply-To: References: Message-ID: <75F1C504-EADF-45D9-AAA2-9C3A92C1D7FB@gmail.com> You could always try the Enthought, or Continuum IO, dev mailing lists. As I understand it, people at these companies were involved in porting NumPy to IronPython? -- Dave On 19 Dec 2012, at 16:47, Jeff Hardy wrote: > On Mon, Dec 10, 2012 at 7:17 AM, Kent Johnson wrote: >> Hi, >> >> Where is the best place to get help on NumPy for IronPython? (I >> cross-posted also to the SciPy4dotNet list but that list looks kind of >> dead...) > > Unfortunately, I don't know if there is a good spot. > >> >> My current question is, how can I create a numpy.ndarray from a >> System.Array? I hoped it would just work to pass the Array to >> ndarray() or asarray() but neither of these seem to work. I am working >> with large, 3-dimensional arrays so it would be nice to avoid copying >> the array in a loop. >> >> More generally, what is the current status of NumPy and SciPy for >> IronPython? The projects don't show any signs of life - no checkins >> since the original release, no activity on the mailing list, very >> difficult to even find a place to ask questions. It kind of looks like >> Microsoft commissioned the original work but after the release there >> is no funding and no community. > > That's pretty much it, unfortuantely. I think the core bits are part > of numpy proper, but there was no real handoff to a new maintainer. > >> >> I'm most interested in finding sources for help and documentation. > > I'm afraid you might be on your own :|. Not what you wanted to hear, I'm sure. > > - Jeff > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > http://mail.python.org/mailman/listinfo/ironpython-users From kent3737 at gmail.com Wed Dec 19 21:31:39 2012 From: kent3737 at gmail.com (Kent Johnson) Date: Wed, 19 Dec 2012 15:31:39 -0500 Subject: [Ironpython-users] Help with NumPy In-Reply-To: <75F1C504-EADF-45D9-AAA2-9C3A92C1D7FB@gmail.com> References: <75F1C504-EADF-45D9-AAA2-9C3A92C1D7FB@gmail.com> Message-ID: Thank you everyone who offered suggestions. One of the Numpy for .NET developers confirmed that the project is pretty much dead, and also that there is no way to get a .NET array into a Numpy ndarray without copying the values. (See https://mail.enthought.com/pipermail/scipy4dotnet/2012-December/000165.html) The latter is a non-starter for me, I have some very large arrays I want to work with and copying them in IronPython code is not realistic. I have figured out how to get the data into CPython and I'm working with it there. Kent -------------- next part -------------- An HTML attachment was scrubbed... URL: From dalius.dobravolskas at gmail.com Thu Dec 20 07:11:57 2012 From: dalius.dobravolskas at gmail.com (Dalius Dobravolskas) Date: Thu, 20 Dec 2012 08:11:57 +0200 Subject: [Ironpython-users] POST requests to IronPython CGI under IIS 7.5 In-Reply-To: References: Message-ID: Thank you, Jeff, Here is another alternative that fits my needs: http://www.voidspace.org.uk/ironpython/simple_http_server.shtml Best regards, Dalius On Wed, Dec 19, 2012 at 6:51 PM, Jeff Hardy wrote: > On Tue, Dec 11, 2012 at 3:26 AM, Dalius Dobravolskas > wrote: > > Hi, > > > > I have created python CGI script that should handle POST requests. I'm > > running this script under IIS 7.5. It works without problems if I'm using > > CPython but with IronPython I have problem (therefore I know it is > > IronPython problem and not IIS). If POST request is longer than 320 > symbols > > then my script freezes. Initially I was trying to use python cgi module > - it > > was working until I tried POST request with more data. Then I tried to go > > deeper and tried to parse request manually - then I found out that > reading > > from sys.stdin freezes my script when more data than 320 symbols is > passed > > to script. > > > > As temporary solution I will use GET requests (but kitten is killed when > you > > use GET to modify data) or I will use alternative to CGI scripts (any > > recommendations). > > > > I have created bug reports here: > > http://ironpython.codeplex.com/workitem/33556 > > Thanks for the issue report. I have no idea if it's an IronPython > issue or an IIS issue, but since you say it works with normal Python, > my guess is IronPython somewhere. > > One alternative is NWSGI (http://nwsgi.codeplex.com/) which uses > IronPython to implement the standard Python WSGI interface. > > - Jeff > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bruno.gallart at orange.fr Fri Dec 21 19:10:03 2012 From: bruno.gallart at orange.fr (bruno gallart) Date: Fri, 21 Dec 2012 19:10:03 +0100 Subject: [Ironpython-users] [Newbee ironpython and WinForms] Problem of encodage with a ListBox (Winforms) - accented characters Message-ID: <50D4A5FB.2080109@orange.fr> Hi, I am doing a spellchecker with the Hunspell ' library for .Net -- > Nhunspell for a language of south of Europe (WinForms). My program runs well, it checks a Word's document, gives all the wrong words etc... With a button I pass all the wrong words and for every word, it gives me, in a ListBox, all the suggestions for this word. My problem: If the suggestion is a word without accented character I can choose it and put it in the Word's document, it is fine ! But if this word has accented character when I choose it in the listbox (it is seen well with the accented character) I have an error message (in french) but it is a problem of encoding (my translation not very good "impossible to give an encoding from the unicode page") in french ("Impossible de traduire les octets [E8] ? l'index 0 ? partir de la page de codes sp?cifi?e en Unicode"). It is for exemple, for the words " ?me " , "?bra" etc... I am a newbee in .NET and Winforms, I am quite lost My questions : My program is encoding in UTF-8, What encoding gives the string coming from " listBox.SelectedItem " I think Unicode ? The NHunspell's files for check ( xx.aff and ww.dic ) are with " alphabet occidental" ("iso-8859-15") What can I do ? I transform the encoding of the ListBox's string ... but how ? I don't know the command . Or there is an another thing to do ? Thanks for your patience Bruno From no_reply at codeplex.com Sat Dec 22 09:31:16 2012 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 22 Dec 2012 00:31:16 -0800 Subject: [Ironpython-users] IronPython, Daily Digest 12/21/2012 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New comment] Failing cmath tests ---------------------------------------------- ISSUES 1. [New comment] Failing cmath tests http://ironpython.codeplex.com/workitem/28352 User HenrySeg has commented on the issue: "I ran into similar problems with the following script: import cmath c = (-2.70563e-05+2.71051e-20j) s = cmath.sqrt(c) print c, s, s*s The output in IronPython: (-2.70563e-05+2.71051e-20j) infj (-inf+nanj) The output in my OS python implementation: (-2.70563e-05+2.71051e-20j) (2.60547442983e-18+0.00520156707157j) (-2.70563e-05+2.71051e-20j)" ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bruno.gallart at orange.fr Sun Dec 23 19:04:19 2012 From: bruno.gallart at orange.fr (bruno gallart) Date: Sun, 23 Dec 2012 19:04:19 +0100 Subject: [Ironpython-users] [Newbee ironpython and WinForms] Problem of encodage with a ListBox (Winforms) - accented characters In-Reply-To: <50D4A5FB.2080109@orange.fr> References: <50D4A5FB.2080109@orange.fr> Message-ID: <50D747A3.4060808@orange.fr> I found the error (I think !). I should to unicode my choice. In the listbox was "self._ltSuggestions.SelectedItem" but the encoding was wrong. After research I put "unicode(self._ltSuggestions.SelectedItem)" and it works well. I hope ! Good Christmas and good year for all the ironpython's users. Best wishes, Bruno Le 21/12/2012 19:10, bruno gallart a ?crit : > Hi, > > I am doing a spellchecker with the Hunspell ' library for .Net -- > > Nhunspell for a language of south of Europe (WinForms). > > My program runs well, it checks a Word's document, gives all the wrong > words etc... With a button I pass all the wrong words and for every > word, it gives me, in a ListBox, all the suggestions for this word. > > My problem: > If the suggestion is a word without accented character I can choose it > and put it in the Word's document, it is fine ! But if this word has > accented character when I choose it in the listbox (it is seen well > with the accented character) I have an error message (in french) but > it is a problem of encoding (my translation not very good "impossible > to give an encoding from the unicode page") in french ("Impossible de > traduire les octets [E8] ? l'index 0 ? partir de la page de codes > sp?cifi?e en Unicode"). It is for exemple, for the words " ?me " , > "?bra" etc... > > I am a newbee in .NET and Winforms, I am quite lost > My questions : > My program is encoding in UTF-8, > What encoding gives the string coming from " listBox.SelectedItem " I > think Unicode ? > The NHunspell's files for check ( xx.aff and ww.dic ) are with " > alphabet occidental" ("iso-8859-15") > > What can I do ? I transform the encoding of the ListBox's string ... > but how ? I don't know the command . Or there is an another thing to do ? > > Thanks for your patience > > Bruno > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > http://mail.python.org/mailman/listinfo/ironpython-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From no_reply at codeplex.com Fri Dec 28 09:44:30 2012 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 28 Dec 2012 00:44:30 -0800 Subject: [Ironpython-users] IronPython, Daily Digest 12/27/2012 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New comment] Iron Python drops core when trying to execute a Iron Python script. ---------------------------------------------- ISSUES 1. [New comment] Iron Python drops core when trying to execute a Iron Python script. http://ironpython.codeplex.com/workitem/33390 User Subramanya_M_S has commented on the issue: "I am using .Net 4.5 with Visual Studio 2010, on Windows Server 2008 R2. This is part of the script that caused the core. def runShellCommandAction(_session, _env, run_shell_command, with_arguments="", without_waiting=False, timeout_after=0.0): shellCommandName = run_shell_command argSpec = with_arguments #displayName = _env["display_name"] displayName = shellCommandName def tail_minus_f(fileName, maxLinesReturned=0): oldSize=0 while True: currentSize = os.path.getsize(fileName) if currentSize<=oldSize: yield [] continue file = open(fileName, 'rb') file.seek(oldSize) lines=[] for line in file: line = line.strip() if (line): lines.append(line) if maxLinesReturned and len(lines)>=maxLinesReturned: break oldSize = file.tell() file.close() yield lines if shellCommandName != os.path.basename(shellCommandName): raise ValueError("shell command name incorrect. %s" % shellCommandName) ext = os.path.splitext(shellCommandName) print "Extention = " + str(ext) shellCommand = "" newargs = "" if ext[1] == ".ps1": shellCommand = "powershell.exe" newargs = "-ExecutionPolicy Unrestricted -File " elif ext[1] == ".sh": shellCommand = "posix.exe" newargs = "/u /c /usr/local/bin/bash " elif ext[1] == ".bash": shellCommand = "posix.exe" newargs = "/u /c /usr/local/bin/bash " elif ext[1] == ".csh": shellCommand = "posix.exe" newargs = "/u /c /bin/csh " elif ext[1] == ".ksh": shellCommand = "posix.exe" newargs = "/u /c /bin/ksh " elif ext[1] == ".pl": shellCommand = "perl.exe " elif ext[1] == ".py": shellCommand = "ipy64.exe " elif shellCommandName == "sleep": shellCommand = "powershell.exe" newargs = "-ExecutionPolicy Unrestricted -Command " else : shellCommand = shellCommandName; print "ShellCommand = " + str(shellCommand) shellCommandsFolder = "" sharedLoc = os.environ["LMSRVSHARED"].strip('\\') if shellCommand == "posix.exe": shellCommandsFolder = "/dev/fs/" + sharedLoc.replace(":","") + "/tenant%s/scripts/ContactStrategy" % str(_session.tenant.id) shellCommandsFolder = shellCommandsFolder.replace("\\","/") else: shellCommandsFolder = os.environ["LMSRVSHARED"] + "\\tenant%s\\scripts\\ContactStrategy" % str(_session.tenant.id) if shellCommandName == "sleep": absoluteCommandPath = "sleep" elif shellCommand != shellCommandName: if shellCommand == "posix.exe": absoluteCommandPath = '"' + shellCommandsFolder + "/" + shellCommandName + '"' else: absoluteCommandPath = '"' + os.path.join(shellCommandsFolder, shellCommandName) + '"' else: absoluteCommandPath = "" args = argSpec.split() commandLine = '%s' % ' '.join([absoluteCommandPath]+args) if shellCommand != shellCommandName: commandLine = newargs + commandLine print "Execute Line: %s" % shellCommand+" "+commandLine args = [shellCommand,commandLine] child = subprocess.Popen(args,env,shell=True,stdout=PIPE,stderr=PIPE) outFileIter = child.stdout errFileIter = child.stderr def insertFileLinesToMessages(fileIter, msgType): for line in fileIter: print "message", line, msgType _session.messages.insert(msgType, "CS_MSG", [ "%s - %s" % (displayName, line)]) def isSubprocessComplete(): if child.poll() is None: return retry() print 'Return Code: ' + str(child.returncode) if child.returncode==127: return finished(ERROR, "FT_FILE_NOENT(%s)" % absoluteCommandPath) if child.returncode==126: return finished(ERROR, "%s - Permission denied" % absoluteCommandPath) if child.returncode>0: return finished(ERROR, "%s returned %s" % (shellCommandName,child.returncode)) if child.returncode<0: return finished(ERROR, " %s was iterrupted by signal %s" % (shellCommandName, -child.returncode))" ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: