Fwd: Installation hell

2022-12-18 Thread Jim Lewis
I'm an occasional user of Python and have a degree in computer science. Almost every freaking time I use Python, I go through PSH (Python Setup Hell). Sometimes a wrong version is installed. Sometimes it's a path issue. Or exe naming confusion: python, python3, phthon311, etc. Or library compatibil

Getting focused window of another app

2006-07-14 Thread Jim Lewis
Anyone know how to get the caption of the window currently in focus in whatever app is in use? If I am using Excel, for example, I want my python app to know that Excel is currently being used. -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting focused window of another app

2006-07-15 Thread Jim Lewis
Never mind ... wHnd = win32gui.GetForegroundWindow() Caption = win32gui.GetWindowText (wHnd) -- http://mail.python.org/mailman/listinfo/python-list

Pyrex list/array

2006-06-03 Thread Jim Lewis
I'm trying to move a function into pyrex for speed. The python side needs to pass a list to the pyrex function. Do I need to convert to array or something so pyrex can generate tight code? I'm not clear how to do this. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pyrex list/array

2006-06-04 Thread Jim Lewis
Thanks for your comments. > You probably didn't expect the Inquisition... Correct ;-) > 1. What is your speed requirement and how far short of that are you at the > moment? ~10 times faster. > 2. Are you sure there is no Python or third-party module that does what you > want? Yes. > 3. Is

Re: Pyrex list/array

2006-06-04 Thread Jim Lewis
> Is it substantially faster with psyco than without? If psyco is performing > its magic on the critical section of code already, you are going to lose > that when switching to Pyrex. Yes but from what I read Pyrex can be a lot faster than psyco under the right circumstances. -- http://mail.pyt

Re: Pyrex list/array

2006-06-04 Thread Jim Lewis
> cunningly concealed in the last place one would think of finding it: under > the heading "Mailing List" on the Pyrex home page :-) Hmmm - maybe I should try the scroll bar occassionally ;-) > Do you mean alist[x:x+n] == alist[y:y+n] ? OK, probably you an Skip are right - let's see if I missed

can't pickle instancemethod objects

2006-07-09 Thread Jim Lewis
Pickling an instance of a class, gives "can't pickle instancemethod objects". What does this mean? How do I find the class method creating the problem? -- http://mail.python.org/mailman/listinfo/python-list

Re: can't pickle instancemethod objects

2006-07-09 Thread Jim Lewis
> How about you post the complete stack trace of the exception? Exception in Tkinter callback Traceback (most recent call last): File "C:\program files\python\lib\lib-tk\Tkinter.py", line 1345, in __call__ return self.func(*args) File "C:\Public\world.py", line 1832, in BtnGo DoBtnGo()

Re: can't pickle instancemethod objects

2006-07-09 Thread Jim Lewis
> I'd suggest that "pop" could be your culprit. ...What is pop? A function or > an instance method? Neither. pop is an instance of a class, like: class X: ... pop = X () pop surely is the culprit but it has arrays of objects, etc., and I don't know what to look for. -- http://mail.python.or

Re: can't pickle instancemethod objects

2006-07-09 Thread Jim Lewis
> Here's a thought: comment out every attribute in your class, and then try > pickling it. If it succeeds, uncomment just *one* attribute, and try > pickling again. Repeat until pickling fails. Was trying to avoid that but you motivated me to do so and now I found the probem. In a utility routine

Re: Pyrex installation on windows XP: step-by-step guide

2006-05-21 Thread Jim Lewis
> and change "-lmsvcrt" to "-lmsvcr71". But then I get this error: Python was built with version 7.1 of Visual Studio, and extensions need to be built with the same version of the compiler, but it isn't installed. I want to use mingw. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pyrex installation on windows XP: step-by-step guide

2006-05-21 Thread Jim Lewis
Thanks. I had done that but it seems I had to remove "install". Now it works. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pyrex installation on windows XP: step-by-step guide

2006-05-22 Thread Jim Lewis
Still problems :-( I have a directory c:\data\code\test\pyrex containing: build_and_install.bat: "C:\program files\Python\python.exe" setup.py build_ext --compiler=mingw32 pause setup.py: from distutils.core import setup from distutils.extension import Extension from Pyrex.Distutils import build

Re: Pyrex installation on windows XP: step-by-step guide

2006-05-25 Thread Jim Lewis
Thanks but now another problem :-( Examples in books show importing a global so why does below give: AttributeError: 'module' object has no attribute 'globalvar' primes.pyx: from run import globalvar def prime(int kmax): result = [run.globalvar] ... run.py: from primes import prime globalvar =

Pyrex speed

2006-05-27 Thread Jim Lewis
Has anyone found a good link on exactly how to speed up code using pyrex? I found various info but the focus is usually not on code speedup. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pyrex speed

2006-05-27 Thread Jim Lewis
I'm not planning to write C functions. My understanding is that by using cdefs in the python code one can gain substantial speed. I'm trying to find a description of how to modify python code in more detail so it runs fast under pyrex. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pyrex speed

2006-05-27 Thread Jim Lewis
> main point of Pyrex is ease of wrapping, not of speeding-up. Supposedly the primes example is 50 times faster. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pyrex speed

2006-05-27 Thread Jim Lewis
> I never had an opportunity to do any more sophisticated math than simple > adding, multiplying, subtracting and dividing. Neither is the primes example doing anything more sophisticated than basic arithmetic but it's 50 times faster. -- http://mail.python.org/mailman/listinfo/python-list

String pattern matching

2006-04-01 Thread Jim Lewis
Anyone have experience with string pattern matching? I need a fast way to match variables to strings. Example: string - variables abcaaab - xyz abca - xy eeabcac - vxw x matches abc y matches a z matches aab w maches ac v maches ee -- http://mail.python.org/mailman/listinfo/python-

Tkinter divider

2006-04-01 Thread Jim Lewis
Anyone know how to create a draggable divider between two Tkinter windows? -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter divider

2006-04-01 Thread Jim Lewis
That did the trick - thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: String pattern matching

2006-04-02 Thread Jim Lewis
Thanks for the interesting and detailed analysis. In my case I don't need all possible answers by rather the first "greedy" match. Seems like there might be some recursive approach. -- http://mail.python.org/mailman/listinfo/python-list

Re: String pattern matching

2006-04-16 Thread Jim Lewis
>You can do this with a regular expression... I tried the plain RE approach and found it no faster than my direct-coded version. Anyone have any ideas on how to code this problem elegantly without RE? My code is long and cumbersome - 200 lines! Speed is my primary concern but low LOC would be nice