On Mon, Feb 9, 2009 at 10:44 AM, Michael Foord <[email protected]> wrote: > Dino Viehland wrote: >> >> Or if your program has no UI components you can start with the -X:MTA >> option and the warning won't get issued. >> >> Unfortunately the 2nd you hit a different warning it's likely you'll have >> the same problem. So the underlying problem looks like we're somehow >> picking up a different linecache.py or that linecache's getlines method is >> being patched. If you're sure neither of those are happening then my only >> guess would be that we could have a call site caching bug but against a >> function that seems fairly unlikely. >> > > I have a sneaking suspicion that this error happens if you use the Python > 2.4 version of linecache. Is the Python 2.4 standard library (or bits of > it!?!?) somehow on your IRONPYTHONPATH or included in your application? > > Michael
Michael, Dino, You are both right (and heroes, of course). I had neglected to update my CPython modules in my project to 2.5. I put the new 2.5 linecache.py in the project. The first call doesn't execute, but it doesn't raise an error, just a warning: >>> from System.Threading import Thread >>> Thread.Sleep(4000) sys:1: RuntimeWarning: Calling Thread.Sleep on and STA thread doesn't pump messages. Use Thread.CurrentThread.Join instead. >>> # second try >>> Thread.Sleep(4000) >>> # paused for 4 seconds with no warning. Carl T. >> >> -----Original Message----- >> From: [email protected] >> [mailto:[email protected]] On Behalf Of Carl Trachte >> Sent: Monday, February 09, 2009 8:26 AM >> To: Discussion of IronPython >> Subject: Re: [IronPython] Problem with Thread.Sleep >> >> Michael, >> You are a hero. Thanks. >> Carl T. >> >> On Mon, Feb 9, 2009 at 9:21 AM, Michael Foord <[email protected]> >> wrote: >> >>> >>> Carl Trachte wrote: >>> >>>> >>>> Hello. >>>> >>>> I'm a bit late to the 2.0 party, but I'm trying to upgrade my >>>> environment. >>>> >>>> This code fails: >>>> >>>> >>>> >>>>>>> >>>>>>> from System.Threading import Thread >>>>>>> Thread.Sleep(3000) >>>>>>> >>>>>>> >>>> >>>> Traceback (most recent call last): >>>> File "<stdin>", line 1, in <module> >>>> File "C:\Program Files\IronPython 2.0\Lib\warnings.py", line 61, in >>>> warn >>>> File "C:\Program Files\IronPython 2.0\Lib\warnings.py", line 99, in >>>> warn_explicit >>>> TypeError: getlines() takes exactly 1 argument (2 given) >>>> >>>> I'm not a threading expert. Basically I want the program to pause for >>>> a few seconds. Am I doing something wrong, or do I have something set >>>> up wrong? >>>> >>>> Thanks in advance. >>>> >>>> >>>> >>> >>> Thread.CurrentThread.Join(3000) will have the same effect, but that is a >>> very odd error. >>> >>> Michael >>> >>> >>>> >>>> Carl T. >>>> _______________________________________________ >>>> Users mailing list >>>> [email protected] >>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>>> >>>> >>> >>> -- >>> http://www.ironpythoninaction.com/ >>> http://www.voidspace.org.uk/blog >>> >>> >>> _______________________________________________ >>> Users mailing list >>> [email protected] >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >> >> _______________________________________________ >> Users mailing list >> [email protected] >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> _______________________________________________ >> Users mailing list >> [email protected] >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > Users mailing list > [email protected] > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ Users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
