Fwd: Installation hell
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 compatibility issues - took an hour to find out that pygame does not work with the current version of python. Then the kludgy PIP app and using a DOS box under Windows with command prompts which is ridiculous. God only knows how many novice users of the language (or even intermediate users) were lost in the setup process. Why not clean the infrastructure up and make a modern environment or IDE or something better than it is now. Or at least good error messages that explain exactly what to do. Even getting this email to the list took numerous steps. -- A frustrated user -- https://mail.python.org/mailman/listinfo/python-list
Re: Getting focused window of another app
Never mind ... wHnd = win32gui.GetForegroundWindow() Caption = win32gui.GetWindowText (wHnd) -- http://mail.python.org/mailman/listinfo/python-list
Getting focused window of another app
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
can't pickle instancemethod objects
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
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() File C:\Public\world.py, line 1812, in DoBtnGo if DoPickle: SavePickle () File C:\Public\world.py, line 1817, in SavePickle pickle.dump (pop,f) File C:\program files\python\lib\pickle.py, line 1382, in dump Pickler(file, protocol, bin).dump(obj) File C:\program files\python\lib\pickle.py, line 231, in dump self.save(obj) File C:\program files\python\lib\pickle.py, line 293, in save f(self, obj) # Call unbound method with explicit self File C:\program files\python\lib\pickle.py, line 739, in save_inst save(stuff) File C:\program files\python\lib\pickle.py, line 293, in save f(self, obj) # Call unbound method with explicit self File C:\program files\python\lib\pickle.py, line 663, in save_dict self._batch_setitems(obj.iteritems()) File C:\program files\python\lib\pickle.py, line 677, in _batch_setitems save(v) File C:\program files\python\lib\pickle.py, line 293, in save f(self, obj) # Call unbound method with explicit self File C:\program files\python\lib\pickle.py, line 614, in save_list self._batch_appends(iter(obj)) File C:\program files\python\lib\pickle.py, line 629, in _batch_appends save(x) File C:\program files\python\lib\pickle.py, line 293, in save f(self, obj) # Call unbound method with explicit self File C:\program files\python\lib\pickle.py, line 739, in save_inst save(stuff) File C:\program files\python\lib\pickle.py, line 293, in save f(self, obj) # Call unbound method with explicit self File C:\program files\python\lib\pickle.py, line 663, in save_dict self._batch_setitems(obj.iteritems()) File C:\program files\python\lib\pickle.py, line 677, in _batch_setitems save(v) File C:\program files\python\lib\pickle.py, line 313, in save rv = reduce(self.proto) File C:\program files\python\lib\copy_reg.py, line 69, in _reduce_ex raise TypeError, can't pickle %s objects % base.__name__ TypeError: can't pickle instancemethod objects -- http://mail.python.org/mailman/listinfo/python-list
Re: can't pickle instancemethod objects
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 I had: obj.act = act ActionSucceded = obj.act() Had to add: obj.act = None Thanks :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: Pyrex list/array
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 your algorithm the best possible? I think so although of course one can never be certain. 4. Is your Python implementation of that algorithm the best possible? Have you exposed it to the critical gaze of the speed-freaks in this newsgroup? Thanks for the good suggestion but I want to try pyrex first. 5. Does your architecture support psyco? If so, have you tried that and what were the results? Already using psyco. The question might be better asked on the Pyrex mailing list. I did not find it - where is it? Almost any Python code is also valid Pyrex code. For a start, just compile your function with Pyrex and compare the speed. It's slower. What you do next is going to depend very much on what operations you are performing on the list and the objects it contains. Simple list of ints. Comparing sections of lists between each other. -- http://mail.python.org/mailman/listinfo/python-list
Re: Pyrex list/array
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.python.org/mailman/listinfo/python-list
Re: Pyrex list/array
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 something at the Python level. There are essentially two differences from your snip above. I am trying to compute n and there are multiple (under 10) lists. Size of lists are typically under 100 ints. ...See what psyco makes of that. I'm doing a similar straightforward loop approach but it's too slow. Jim -- http://mail.python.org/mailman/listinfo/python-list
Pyrex list/array
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
Pyrex speed
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
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
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
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
Re: Pyrex installation on windows XP: step-by-step guide
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 = 999 while True: print prime (10) -- http://mail.python.org/mailman/listinfo/python-list
Re: Pyrex installation on windows XP: step-by-step guide
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_ext setup( name = PyrexGuide, ext_modules=[ Extension(worldimport, [world.pyx]) ], cmdclass = {'build_ext': build_ext} ) world.pyx - pyrex code run.py: import worldimport ... The batch file creates a build folder with subfolders containing: world.pyd, world.def, world.o, worldimport.def But running run.py gives: ImportError: No module named worldimport Should worldimport.def be going to C:\program files\python\Lib\site-packages? Why isn't it? -- http://mail.python.org/mailman/listinfo/python-list
Re: Pyrex installation on windows XP: step-by-step guide
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
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: String pattern matching
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 of course. The sezman approach above seems a bit complex. -- http://mail.python.org/mailman/listinfo/python-list
Re: String pattern matching
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
String pattern matching
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-list
Tkinter divider
Anyone know how to create a draggable divider between two Tkinter windows? -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter divider
That did the trick - thanks. -- http://mail.python.org/mailman/listinfo/python-list