From no_reply at codeplex.com Wed Feb 4 10:38:01 2015 From: no_reply at codeplex.com (CodePlex) Date: 4 Feb 2015 01:38:01 -0800 Subject: [Ironpython-users] IronPython, Daily Digest 2/3/2015 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New issue] Index out of bounds in array ---------------------------------------------- ISSUES 1. [New issue] Index out of bounds in array http://ironpython.codeplex.com/workitem/35825 User varnonga has proposed the issue: "I've been running a python script in a test I am developing. I keep getting an error for "index was out of bounds for the array". It is getting this when it tries to access a sub python script I have called "Debug_function.py". This file has some of the tools I use during the test. I have used this file in another script file I have without issue. When I run it with my new script file "Galley_Test.py". I get the error. Can you point me in the right direction. I can only upload one file. So I'll upload the main script file first "Galley_Test.py", then come back (if possible) and upload my external function file "Debug_function.py". This is the first time I've tried to use this system, so I hope it works as I expect." ---------------------------------------------- ---------------------------------------------- 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 chris40knaack at gmail.com Wed Feb 4 04:47:19 2015 From: chris40knaack at gmail.com (Chris Knaack) Date: Tue, 3 Feb 2015 22:47:19 -0500 Subject: [Ironpython-users] Fwd: Help with 2 issues embedding IronPython into C# app. In-Reply-To: References: Message-ID: ---------- Forwarded message ---------- From: Chris Knaack Date: Tue, Feb 3, 2015 at 10:35 PM Subject: Help with 2 issues embedding IronPython into C# app. To: users at lists.ironpython.com I have figured out how to use Iron Python to implement a function in a py file that is called from my C# program. I am currently using the pyc script to convert the script into a "dll". I have to issues. 1) The first time I execute my function, it is really slow to respond. Is this the JIT start up for IronPython? Can I ngen my pyc'ed py file? 2) If I implement smaller helper functions in my py module and call them from my function called from the C# app, I can step through it correctly in VS2012 and see the correct behavior, however I am not able to use return values from my helper functions? Thanks for any insights you can share -------------- next part -------------- An HTML attachment was scrubbed... URL: From no_reply at codeplex.com Thu Feb 5 12:33:33 2015 From: no_reply at codeplex.com (CodePlex) Date: 5 Feb 2015 03:33:33 -0800 Subject: [Ironpython-users] IronPython, Daily Digest 2/4/2015 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New comment] Index out of bounds in array 2. [Status update] Index out of bounds in array ---------------------------------------------- ISSUES 1. [New comment] Index out of bounds in array http://ironpython.codeplex.com/workitem/35825 User slide_o_mix has commented on the issue: "

We've generally moved the project over to github (https://github.com/IronLanguages/main), so please add issues there. There is also a mailing list (https://mail.python.org/mailman/listinfo/ironpython-users) that you can send questions to.

"----------------- 2. [Status update] Index out of bounds in array http://ironpython.codeplex.com/workitem/35825 User slide_o_mix has updated the issue: Status has changed from Proposed to Closed with the following comment, "Please use GitHub." ---------------------------------------------- ---------------------------------------------- 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 Andrew.Stephens at nu-ins.com Mon Feb 9 16:52:35 2015 From: Andrew.Stephens at nu-ins.com (Andrew Stephens) Date: Mon, 9 Feb 2015 15:52:35 +0000 Subject: [Ironpython-users] Are imports cached? Message-ID: <620E6490461DDB44942EB371DFAEA70AD90CDF56@EXCH01.nu-ins.local> Just a quick question ? does IronPython still cache imports? If so, is there a way to clear the cache or must I instantiate a new ScriptEngine? I?ve hit a similar issue as posted here: http://stackoverflow.com/questions/11625321/ironpython-hosting-caching-imported-module and was wondering if this is still the expected behaviour. Thanks in advance Andrew Stephens | Senior Software Engineer Andrew.Stephens at nu-ins.com [cid:image246072.PNG at a651e96d.42ab0c63] T: +44 (0) 1978 661304 | F: +44 (0) 1978 664301 | W: www.nu-ins.com Unit 74 Clywedog Road South , Wrexham Industrial Estate, Wrexham, LL13 9XS | Nu Instruments Ltd is registered in England, No.: 3046042. Registered Office: Seacourt Tower, West Way, Oxford OX2 0FB. VAT No.: GB 616 3733 45 This message is confidential and may contain privileged information and is protected by copyright. If you are not the intended recipient you should not copy or disclose this message to anyone but should kindly notify the sender and delete the message. Opinions, conclusions and other information in this message which do not relate to the official business of Nu Instruments Ltd shall be understood as neither given nor endorsed by it. Neither the Company nor the sender accepts any responsibility or liability for any loss or damage arising from the presence of any computer virus or similar harmful code contained in this email or attachment/s. It is your responsibility to scan this email and any attachments. The Company reserves the right to access and disclose all messages sent over its email system. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image246072.PNG Type: image/png Size: 7416 bytes Desc: image246072.PNG URL: From no_reply at codeplex.com Fri Feb 13 09:28:20 2015 From: no_reply at codeplex.com (CodePlex) Date: 13 Feb 2015 00:28:20 -0800 Subject: [Ironpython-users] IronPython, Daily Digest 2/12/2015 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New issue] Unpacking a class that contains __iter__ fails ---------------------------------------------- ISSUES 1. [New issue] Unpacking a class that contains __iter__ fails http://ironpython.codeplex.com/workitem/35843 User Matthew94 has proposed the issue: "I have a class that overrides iter to allow me to unpack it like a tuple. It works just fine on CPython 2.7 but fails on IronPython 2.7. As seen below the Error is: TypeError: print() argument after * must be a sequence, not Object_1$1 Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information. >>> import register >>> a = register.Register() Traceback (most recent call last): File "", line 1, in TypeError: __init__() takes exactly 4 arguments (1 given) >>> a = register.Register(0,0,0) >>> from __future__ import print_function >>> print(*a) 0 0 0 >>> exit() ... IronPython 2.7.5 (2.7.5.0) on .NET 4.0.30319.18408 (32-bit) Type "help", "copyright", "credits" or "license" for more information. >>> import register >>> from __future__ import print_function >>> a = register.Register(0,0,0) >>> print(*a) Traceback (most recent call last): File "", line 1, in TypeError: print() argument after * must be a sequence, not Object_1$1 " ---------------------------------------------- ---------------------------------------------- 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 Fri Feb 20 12:44:11 2015 From: no_reply at codeplex.com (CodePlex) Date: 20 Feb 2015 03:44:11 -0800 Subject: [Ironpython-users] IronPython, Daily Digest 2/19/2015 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New comment] Lower casing non-ASCII characters does not work ---------------------------------------------- ISSUES 1. [New comment] Lower casing non-ASCII characters does not work http://ironpython.codeplex.com/workitem/33133 User pekkaklarck has commented on the issue: "

This seems to be fixed in 2.7.5. Was it already fixed in 2.7.4?

Thanks @paweljasinski for an alternative workaround.

" ---------------------------------------------- ---------------------------------------------- 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 Sat Feb 21 16:34:29 2015 From: no_reply at codeplex.com (CodePlex) Date: 21 Feb 2015 07:34:29 -0800 Subject: [Ironpython-users] IronPython, Daily Digest 2/20/2015 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New comment] Lower casing non-ASCII characters does not work 2. [New issue] Problem with API in IronPython ---------------------------------------------- ISSUES 1. [New comment] Lower casing non-ASCII characters does not work http://ironpython.codeplex.com/workitem/33133 User paweljasinski has commented on the issue: "

I believe it is fixed in 2.7.4

$ git tag --contains c02becc
ipy-2.7.4
ipy-2.7.4-a1
ipy-2.7.4-b1
ipy-2.7.4-b2
ipy-2.7.4-rc1
ipy-2.7.5
ipy-2.7.5-b1
ipy-2.7.5-b2
ipy-2.7.5-b3
ipy-2.7.5-rc1
ipy-2.7.5-rc2


--pawel

"----------------- 2. [New issue] Problem with API in IronPython http://ironpython.codeplex.com/workitem/35858 User Dado87 has proposed the issue: "Hi everyone, I have an issue with running of some code in IronPyrhon (actually in GHPython script Editor, which uses IronPython). I want to run some structural engineering software (Strand7) externaly with the help of API of this software. If I run it in Python IDLE it works well, but inside Iron I get some error. Please look at the attached .pdf file. Code is writen below. Do somebody know what's wrong? Any sugestions? Thanks for the answears! Regards, Damir from St7API import * import ctypes import os import sys # Error checking function. Turns a non-zero integer returned by Strand API call into a Python exception def ChkErr(ErrorCode): ErrorOccured = (ErrorCode != 0) if ErrorOccured: ErrorString = ctypes.create_string_buffer(kMaxStrLen) # Attempt to get API error string iErr = St7GetAPIErrorString(ErrorCode, ErrorString, kMaxStrLen) # If that failed, attempt to retrive a solver error string if iErr: iErr = St7GetSolverErrorString(ErrorCode, ErrorString, kMaxStrLen) if not iErr: raise Exception('%s (%d)' % (ErrorString.value, ErrorCode)) else: raise Exception('An unknown error occured (%d)' % ErrorCode) return ErrorOccured # Program def CreatePoint(pCoord) ChkErr(St7Init()) def RunPlateDemo(modPath, nIters = 1, showWindow = True, maxThickness = 2): # Wrap everything in a try/except/finally block so the API is unloaded even after an exception try: # Initialise ChkErr(St7Init()) # Open the file ChkErr(St7OpenFile(1, modPath, r'c:\Users\D.Kovacevic\AppData\Local\Temp'.encode())) # Show the model window if that was requested if showWindow: ChkErr(St7CreateModelWindow(1)) ChkErr(St7ShowModelWindow(1)) ChkErr(St7PositionModelWindow(1, 0, 0, 640, 480)) # Set results file name to model name without extension resFileName = os.path.splitext(modPath)[0] ChkErr(St7SetResultFileName(1, resFileName)) # Perform optimsation several times if requested for iIter in range(nIters): # Run Linear Static Solver ChkErr(St7RunSolver(1, stLinearStaticSolver, smBackgroundRun, 1)) # Open results files nPrim, nSec = ctypes.c_int(), ctypes.c_int() ChkErr(St7OpenResultFile(1, resFileName + '.lsa'.encode(), ''.encode(), False, nPrim, nSec)) # Get the number of plates and iterate over them, saving the VM stress nPlatesCtypes = ctypes.c_int() numPoints, numCols = ctypes.c_int(), ctypes.c_int() ChkErr(St7GetTotal(1, tyPLATE, nPlatesCtypes)) # Build dictionary of PlateNum->VM Stress plateVM = {} plateResultArrayType = ctypes.c_double * kMaxPlateResult plateResArray = plateResultArrayType() print (plateResArray) for iPlate in range(1, nPlatesCtypes.value + 1): ChkErr(St7GetPlateResultArray(1, rtPlateStress, stPlateCombined, iPlate, 1, AtCentroid, psPlateMidPlane, 0, numPoints, numCols, plateResArray)) plateVM[iPlate] = plateResArray[ipPlateCombVonMises] # Close results file ChkErr(St7CloseResultFile(1)) # Get the units unitsArrayType = ctypes.c_long * kLastUnit units = unitsArrayType() ChkErr(St7GetUnits(1, units)) vmVals = plateVM.values() meanVM = sum(vmVals)/len(vmVals) print('[%d/%d] Min/Mean/Max VM Stress: %f/%f/%f %s'%(iIter+1, nIters, min(vmVals), meanVM, max(vmVals), unitStrings.get(units[ipSTRESSU], '??Units'))) # Modify plate thicknesses plateAttributeType = ctypes.c_double * kMaxAttributeDoubles plateAttribs = plateAttributeType() for iPlate in range(1, nPlatesCtypes.value + 1): ChkErr(St7GetPlateThickness2(1, iPlate, plateAttribs)) newThickness = min([plateAttribs[ipTHICKM] * plateVM[iPlate]/meanVM, maxThickness]) plateAttribs[ipTHICKM] = newThickness plateAttribs[ipTHICKB] = newThickness ChkErr(St7SetPlateThickness2(1, iPlate, plateAttribs)) if showWindow: ChkErr(St7UpdateElementPropertyData(1, ptPLATEPROP, 1)) ChkErr(St7RedrawModel(1, True)) # Save and close ChkErr(St7SaveFile(1)) finally: # These calls are made even if an exception was raised in the main block if showWindow: ChkErr(St7DestroyModelWindow(1)) St7CloseFile(1) St7Release() path = "OptimisationModel.st7" pathx = str(path) pathy = pathx.encode() RunPlateDemo(modPath = pathy, nIters = 2) " ---------------------------------------------- ---------------------------------------------- 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 Sun Feb 22 11:53:54 2015 From: no_reply at codeplex.com (CodePlex) Date: 22 Feb 2015 02:53:54 -0800 Subject: [Ironpython-users] IronPython, Daily Digest 2/21/2015 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New comment] datetime.strptime with %f error 2. [Status update] Unpacking a class that contains __iter__ fails 3. [Status update] Problem with API in IronPython ---------------------------------------------- ISSUES 1. [New comment] datetime.strptime with %f error http://ironpython.codeplex.com/workitem/34706 User pekkaklarck has commented on the issue: "

%f still doesn't work exactly like with CPython. As the example below shows, IronPython drops precision below milliseconds:

```
C:\Users\peke>ipy
IronPython 2.7.5 (2.7.5.0) on .NET 4.0.30319.18444 (32-bit)
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> datetime.strptime("2013-11-29T16:38:12.507666", "%Y-%m-%dT%H:%M:%S.%f")
datetime.datetime(2013, 11, 29, 16, 38, 12, 507000)
>>>

C:\Users\peke>python
Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> datetime.strptime("2013-11-29T16:38:12.507666", "%Y-%m-%dT%H:%M:%S.%f")
datetime.datetime(2013, 11, 29, 16, 38, 12, 507666)
>>>
```

I submitted a new issue to https://github.com/IronLanguages/main/issues/1169

"----------------- 2. [Status update] Unpacking a class that contains __iter__ fails http://ironpython.codeplex.com/workitem/35843 User slide_o_mix has updated the issue: Status has changed from Proposed to Closed with the following comment, "Please file issues on Github. https://github.com/IronLanguages/main/issues"----------------- 3. [Status update] Problem with API in IronPython http://ironpython.codeplex.com/workitem/35858 User slide_o_mix has updated the issue: Status has changed from Proposed to Closed with the following comment, "Please file issues on Github. https://github.com/IronLanguages/main/issues" ---------------------------------------------- ---------------------------------------------- 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 andy at britishideas.com Wed Feb 25 10:02:08 2015 From: andy at britishideas.com (Andrew Ayre) Date: Wed, 25 Feb 2015 09:02:08 +0000 Subject: [Ironpython-users] ShowDialog Hangs In-Reply-To: References: <546D1B4B.5060001@britishideas.com> <037401d00453$1dc8f410$595adc30$@ilnumerics.net> <546DA6C0.6050400@britishideas.com> <727D8E16AE957149B447FE368139F2B53CC559B6@SERVER10> <547ED5A4.9060906@britishideas.com> Message-ID: <54ED8F90.3070505@britishideas.com> I am sure I am making a silly mistake somewhere. I have IronPython embedded in my C# WinForms application. The interpreter is running in a thread that has been created for it. I.e. not the UI thread. Everything works fine until the call to Dialog.ShowDialog, at which point execution of IronPython hangs and no dialog appears. I'm guessing that this is because the interpreter is not running in the UI thread (which I don't want to do because sometimes scripts can take a long time to execute, depending on what they are doing). This is my first attempt using WinForms from scripting in my application. Any hints or suggestions on how I can debug this, synchronize with the UI thread or something else? Thanks! Andy import clr clr.AddReference("System.Windows.Forms") from System.Windows.Forms import OpenFileDialog, DialogResult Dialog = OpenFileDialog() Dialog.ShowDialog() -- Andy PGP Key ID: 0xDC1B5864 From slide.o.mix at gmail.com Wed Feb 25 15:50:31 2015 From: slide.o.mix at gmail.com (Slide) Date: Wed, 25 Feb 2015 14:50:31 +0000 Subject: [Ironpython-users] ShowDialog Hangs References: <546D1B4B.5060001@britishideas.com> <037401d00453$1dc8f410$595adc30$@ilnumerics.net> <546DA6C0.6050400@britishideas.com> <727D8E16AE957149B447FE368139F2B53CC559B6@SERVER10> <547ED5A4.9060906@britishideas.com> <54ED8F90.3070505@britishideas.com> Message-ID: You need to make sure the thread was started as an STAThread I believe, otherwise the common windows controls (OpenFileDialog being one of them) won't work correctly. On Wed Feb 25 2015 at 2:02:32 AM Andrew Ayre wrote: > I am sure I am making a silly mistake somewhere. > > I have IronPython embedded in my C# WinForms application. > > The interpreter is running in a thread that has been created for it. > I.e. not the UI thread. > > Everything works fine until the call to Dialog.ShowDialog, at which > point execution of IronPython hangs and no dialog appears. > > I'm guessing that this is because the interpreter is not running in the > UI thread (which I don't want to do because sometimes scripts can take a > long time to execute, depending on what they are doing). > > This is my first attempt using WinForms from scripting in my application. > > Any hints or suggestions on how I can debug this, synchronize with the > UI thread or something else? > > Thanks! Andy > > import clr > clr.AddReference("System.Windows.Forms") > from System.Windows.Forms import OpenFileDialog, DialogResult > > Dialog = OpenFileDialog() > Dialog.ShowDialog() > > -- > Andy > PGP Key ID: 0xDC1B5864 > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > https://mail.python.org/mailman/listinfo/ironpython-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at britishideas.com Wed Feb 25 17:41:46 2015 From: andy at britishideas.com (Andrew Ayre) Date: Wed, 25 Feb 2015 16:41:46 +0000 Subject: [Ironpython-users] ShowDialog Hangs In-Reply-To: References: <546D1B4B.5060001@britishideas.com> <037401d00453$1dc8f410$595adc30$@ilnumerics.net> <546DA6C0.6050400@britishideas.com> <727D8E16AE957149B447FE368139F2B53CC559B6@SERVER10> <547ED5A4.9060906@britishideas.com> <54ED8F90.3070505@britishideas.com> Message-ID: <54EDFB4A.7090109@britishideas.com> Thanks for the responses. Strangely the following script works: import clr import time clr.AddReference("System.Windows.Forms") from System.Windows.Forms import OpenFileDialog, DialogResult, Form F = Form() F.Show() time.sleep(5) This displays a form and then closes it when the script ends after five seconds. However simply swapping F.Show for OpenFileDialog().ShowDialog() causes the script to hang. I will check the suggestions made, but I wondered if this behavior with the form gives anyone some additional clues. Thanks, Andy On 2/25/2015 2:50 PM, Slide wrote: > You need to make sure the thread was started as an STAThread I believe, > otherwise the common windows controls (OpenFileDialog being one of them) > won't work correctly. > > On Wed Feb 25 2015 at 2:02:32 AM Andrew Ayre > wrote: > > I am sure I am making a silly mistake somewhere. > > I have IronPython embedded in my C# WinForms application. > > The interpreter is running in a thread that has been created for it. > I.e. not the UI thread. > > Everything works fine until the call to Dialog.ShowDialog, at which > point execution of IronPython hangs and no dialog appears. > > I'm guessing that this is because the interpreter is not running in the > UI thread (which I don't want to do because sometimes scripts can take a > long time to execute, depending on what they are doing). > > This is my first attempt using WinForms from scripting in my > application. > > Any hints or suggestions on how I can debug this, synchronize with the > UI thread or something else? > > Thanks! Andy > > import clr > clr.AddReference("System.__Windows.Forms") > from System.Windows.Forms import OpenFileDialog, DialogResult > > Dialog = OpenFileDialog() > Dialog.ShowDialog() > > -- > Andy > PGP Key ID: 0xDC1B5864 > _________________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > https://mail.python.org/__mailman/listinfo/ironpython-__users > > -- Andy PGP Key ID: 0xDC1B5864 From andy at agraham.demon.co.uk Wed Feb 25 21:47:09 2015 From: andy at agraham.demon.co.uk (Andrew Graham) Date: Wed, 25 Feb 2015 20:47:09 -0000 Subject: [Ironpython-users] ShowDialog Hangs In-Reply-To: <54EDFB4A.7090109@britishideas.com> References: <546D1B4B.5060001@britishideas.com> <037401d00453$1dc8f410$595adc30$@ilnumerics.net> <546DA6C0.6050400@britishideas.com> <727D8E16AE957149B447FE368139F2B53CC559B6@SERVER10> <547ED5A4.9060906@britishideas.com> <54ED8F90.3070505@britishideas.com> <54EDFB4A.7090109@britishideas.com> Message-ID: <21C49AA823274CA1BA2E6A5B49CEB8C5@AndyDesktop> Not really strange, expected behaviour in fact. The Form is drawn OK but there is no message loop running on the thread to pump messages to it so it will be unresponsive and sit there until the thread exits. A modal dialog, or Form shown modally, tries to pump the message queue itself, that is how it acheives modality, and as my previous email to you stated, as there is no message loop on your thread for it to pump so that is probably why it hangs. Regards Andy graham -----Original Message----- From: Andrew Ayre Sent: Wednesday, February 25, 2015 4:41 PM To: ironpython-users at python.org Subject: Re: [Ironpython-users] ShowDialog Hangs Thanks for the responses. Strangely the following script works: import clr import time clr.AddReference("System.Windows.Forms") from System.Windows.Forms import OpenFileDialog, DialogResult, Form F = Form() F.Show() time.sleep(5) This displays a form and then closes it when the script ends after five seconds. However simply swapping F.Show for OpenFileDialog().ShowDialog() causes the script to hang. I will check the suggestions made, but I wondered if this behavior with the form gives anyone some additional clues. Thanks, Andy On 2/25/2015 2:50 PM, Slide wrote: > You need to make sure the thread was started as an STAThread I believe, > otherwise the common windows controls (OpenFileDialog being one of them) > won't work correctly. > > On Wed Feb 25 2015 at 2:02:32 AM Andrew Ayre > wrote: > > I am sure I am making a silly mistake somewhere. > > I have IronPython embedded in my C# WinForms application. > > The interpreter is running in a thread that has been created for it. > I.e. not the UI thread. > > Everything works fine until the call to Dialog.ShowDialog, at which > point execution of IronPython hangs and no dialog appears. > > I'm guessing that this is because the interpreter is not running in > the > UI thread (which I don't want to do because sometimes scripts can take > a > long time to execute, depending on what they are doing). > > This is my first attempt using WinForms from scripting in my > application. > > Any hints or suggestions on how I can debug this, synchronize with the > UI thread or something else? > > Thanks! Andy > > import clr > clr.AddReference("System.__Windows.Forms") > from System.Windows.Forms import OpenFileDialog, DialogResult > > Dialog = OpenFileDialog() > Dialog.ShowDialog() > > -- > Andy > PGP Key ID: 0xDC1B5864 > _________________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > https://mail.python.org/__mailman/listinfo/ironpython-__users > > -- Andy PGP Key ID: 0xDC1B5864 _______________________________________________ Ironpython-users mailing list Ironpython-users at python.org https://mail.python.org/mailman/listinfo/ironpython-users From andy at britishideas.com Wed Feb 25 23:33:17 2015 From: andy at britishideas.com (Andrew Ayre) Date: Wed, 25 Feb 2015 22:33:17 +0000 Subject: [Ironpython-users] ShowDialog Hangs In-Reply-To: <21C49AA823274CA1BA2E6A5B49CEB8C5@AndyDesktop> References: <546D1B4B.5060001@britishideas.com> <037401d00453$1dc8f410$595adc30$@ilnumerics.net> <546DA6C0.6050400@britishideas.com> <727D8E16AE957149B447FE368139F2B53CC559B6@SERVER10> <547ED5A4.9060906@britishideas.com> <54ED8F90.3070505@britishideas.com> <54EDFB4A.7090109@britishideas.com> <21C49AA823274CA1BA2E6A5B49CEB8C5@AndyDesktop> Message-ID: <54EE4DAD.6080302@britishideas.com> Thanks. I've added a call to Application.Run() and also this: ExeThread.SetApartmentState(ApartmentState.STA); Seems to be happy now! Andy On 2/25/2015 8:47 PM, Andrew Graham wrote: > Not really strange, expected behaviour in fact. The Form is drawn OK but > there is no message loop running on the thread to pump messages to it so > it will be unresponsive and sit there until the thread exits. A modal > dialog, or Form shown modally, tries to pump the message queue itself, > that is how it acheives modality, and as my previous email to you > stated, as there is no message loop on your thread for it to pump so > that is probably why it hangs. > > Regards > > Andy graham > > -----Original Message----- From: Andrew Ayre > Sent: Wednesday, February 25, 2015 4:41 PM > To: ironpython-users at python.org > Subject: Re: [Ironpython-users] ShowDialog Hangs > > Thanks for the responses. Strangely the following script works: > > import clr > import time > clr.AddReference("System.Windows.Forms") > from System.Windows.Forms import OpenFileDialog, DialogResult, Form > F = Form() > F.Show() > time.sleep(5) > > This displays a form and then closes it when the script ends after five > seconds. > > However simply swapping F.Show for OpenFileDialog().ShowDialog() causes > the script to hang. > > I will check the suggestions made, but I wondered if this behavior with > the form gives anyone some additional clues. > > Thanks, Andy > > On 2/25/2015 2:50 PM, Slide wrote: >> You need to make sure the thread was started as an STAThread I believe, >> otherwise the common windows controls (OpenFileDialog being one of them) >> won't work correctly. >> >> On Wed Feb 25 2015 at 2:02:32 AM Andrew Ayre > > wrote: >> >> I am sure I am making a silly mistake somewhere. >> >> I have IronPython embedded in my C# WinForms application. >> >> The interpreter is running in a thread that has been created for it. >> I.e. not the UI thread. >> >> Everything works fine until the call to Dialog.ShowDialog, at which >> point execution of IronPython hangs and no dialog appears. >> >> I'm guessing that this is because the interpreter is not running >> in the >> UI thread (which I don't want to do because sometimes scripts can >> take a >> long time to execute, depending on what they are doing). >> >> This is my first attempt using WinForms from scripting in my >> application. >> >> Any hints or suggestions on how I can debug this, synchronize with >> the >> UI thread or something else? >> >> Thanks! Andy >> >> import clr >> clr.AddReference("System.__Windows.Forms") >> from System.Windows.Forms import OpenFileDialog, DialogResult >> >> Dialog = OpenFileDialog() >> Dialog.ShowDialog() >> >> -- >> Andy >> PGP Key ID: 0xDC1B5864 >> _________________________________________________ >> Ironpython-users mailing list >> Ironpython-users at python.org >> https://mail.python.org/__mailman/listinfo/ironpython-__users >> >> > -- Andy PGP Key ID: 0xDC1B5864 From pawel.jasinski at gmail.com Thu Feb 26 14:33:45 2015 From: pawel.jasinski at gmail.com (Pawel Jasinski) Date: Thu, 26 Feb 2015 14:33:45 +0100 Subject: [Ironpython-users] product code for ironpython Message-ID: hi, I am trying to find out how to automatically reinstall ironpython. In case of other products I follow the standard route: msiexec /q /x '{product-code}' followed by: msiexec /i product.msi /qn I tried to find out what is the product-code for ironpython and it looks like, it changes* on each release. Is this intentional? * versions and ids 2.7.4, {5E877D64-5A88-46AA-8352-DAFA8CE1FF52} 2.7.5, {08B74EC9-BC55-418A-A5AA-E589DA2B96C0} thanks --pawel From jeffz at live.com Thu Feb 26 10:39:05 2015 From: jeffz at live.com (Jeffrey Zhao) Date: Thu, 26 Feb 2015 17:39:05 +0800 Subject: [Ironpython-users] IronPython (ScriptEngine) is not thread safe? Message-ID: Hi guys, I've met an issue when trying to use multiple ScriptEngine instances in parallel, since there's no information saying that a single ScriptEngine instance could be used concurrently. Please note "thread-safe" is not enough for me. What I need is the real parallelized execution in multiple threads, so I'm trying to use separated ScriptEngine instances in different threads. More details (including code snippt to reproduce) are provided in the stack overflow quesion below: http://stackoverflow.com/q/28734990/81117 Thanks ?? | Jeffrey Zhao Blog: http://blog.zhaojie.me/ Twitter: @jeffz_cn (Chinese) | @jeffz_en (English) Sina Weibo: @?? -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Fri Feb 27 22:15:50 2015 From: jdhardy at gmail.com (Jeff Hardy) Date: Fri, 27 Feb 2015 21:15:50 +0000 Subject: [Ironpython-users] product code for ironpython In-Reply-To: References: Message-ID: On Thu, Feb 26, 2015 at 1:33 PM, Pawel Jasinski wrote: > hi, > > I am trying to find out how to automatically reinstall ironpython. > In case of other products I follow the standard route: > > msiexec /q /x '{product-code}' > > followed by: > > msiexec /i product.msi /qn > > I tried to find out what is the product-code for ironpython and it > looks like, it changes* on each release. > Is this intentional? > > * versions and ids > 2.7.4, {5E877D64-5A88-46AA-8352-DAFA8CE1FF52} > 2.7.5, {08B74EC9-BC55-418A-A5AA-E589DA2B96C0} Yeah, it's intentional. Each release is what MSI calls a Major Release so that old versions can be uninstalled automatically. WiX automatically changes the product code each time it rebuilds. See [1] and [2] for the basic explanation of why major upgrades are preferred. - Jeff [1] http://www.joyofsetup.com/2008/12/30/paying-for-upgrades/ [2] http://www.joyofsetup.com/2008/12/29/neither-more-nor-less/