[Tutor] Uninstalling MatPlotLib? (Win7)
I should have installed NumPy before MPL. How do I uninstall it. I'm pretty sure it was an msi file. My guess is to go to site-packages, and delete individual pieces. Possibly these: C:\Python25\Lib\site-packages\pylab.py C:\Python25\Lib\site-packages\matplotlib C:\Python25\Lib\site-packages\mpl_toolkits C:\Python25\Lib\site-packages\matplotlib*.egg-info C:\Python25\Removematplotlib.exe C:\Python25\matplotlib-wininst.log I'm surprised this isn't described somewhere. I've Googled for it and looked in Python docs and haven't found anything about uninstalling these packages. -- My life in two words. "Interrupted Projects." -- WTW (quote originator) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Uninstalling MatPlotLib? (Win7)
First, the end of the large log showed: 200 File Copy: C:\Python25\Lib\site-packages\dateutil\easter.pyo 200 File Copy: C:\Python25\Lib\site-packages\pylab.pyo 200 File Copy: C:\Python25\Lib\site-packages\configobj.pyo Second, and more importantly, the folder showed: removematplotlab.exe, which I now see below. According to the Add/Remove icon in CP, there is no MPL removal method. What next? Since it seems unlikely the installer was an msi, what sort of installer was this? When I try to execute it, it says this program is normally started by windows. I did another search on uninstall and came up with my posts, and in one case instructions how to do it, but not a word about the removematplotlab.exe program. Another Google gets me to >http://pypi.python.org/pypi/setuptools>, which advertises uninstall, but doesn't look like it delivers. I see I'm once again the the python tutor world of crazy world of replying. Didn't post to the list, just you, so hee goes On 2/7/2010 1:11 AM, Martijn wrote: On Sat, Feb 6, 2010 at 4:36 PM, Wayne Watson <sierra_mtnv...@sbcglobal.net> wrote: I should have installed NumPy before MPL. How do I uninstall it. I'm pretty sure it was an msi file. My guess is to go to site-packages, and delete individual pieces. Possibly these: C:\Python25\Lib\site-packages\pylab.py C:\Python25\Lib\site-packages\matplotlib C:\Python25\Lib\site-packages\mpl_toolkits C:\Python25\Lib\site-packages\matplotlib*.egg-info C:\Python25\Removematplotlib.exe Look again. C:\Python25\matplotlib-wininst.log I'm surprised this isn't described somewhere. I've Googled for it and looked in Python docs and haven't found anything about uninstalling these packages. -- My life in two words. "Interrupted Projects." -- WTW (quote originator) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- My life in two words. "Interrupted Projects." -- WTW (quote originator) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Uninstalling MatPlotLib? (Win7)
On 2/7/2010 2:43 AM, Wayne Watson wrote: First, the end of the large log showed: 200 File Copy: C:\Python25\Lib\site-packages\dateutil\easter.pyo 200 File Copy: C:\Python25\Lib\site-packages\pylab.pyo 200 File Copy: C:\Python25\Lib\site-packages\configobj.pyo Second, and more importantly, the folder showed: removematplotlab.exe, which I now see below. According to the Add/Remove icon in CP, there is no MPL removal method. What next? Since it seems unlikely the installer was an msi, what sort of installer was this? When I try to execute it, it says this program is normally started by windows. I did another search on uninstall and came up with my posts, and in one case instructions how to do it, but not a word about the removematplotlab.exe program. Another Google gets me to >http://pypi.python.org/pypi/setuptools>, which advertises uninstall, but doesn't look like it delivers. I see I'm once again the the python tutor world of crazy world of replying. Didn't post to the list, just you, so hee goes ... Well, I missed this. Install setuptools using the provided .exe installer. If you've previously installed older versions of setuptools, please delete all setuptools*.egg and setuptools.pth files from your system's site-packages directory (and any other sys.path directories) FIRST. This is a far cry from the idea of simplicity! I'm now using IDLE's path browser. I see matplotlib egg under site-packages by not pth. But there are some pylab py,pyc, pyo files there, which are part of MPL. Ah, the egg file gives the e-mail address of MPL. Maybe he'll know. Why not just delete .../lib\site-packages? At this rate, I might as well uninstall PY2.5 and start again. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Uninstalling MatPlotLib? (Win7)--Package Install Order
Solved. One does not need to install numpy before MPL. However, I thought that some modules did have to be installed in a particular order. On 2/7/2010 3:20 AM, Wayne Watson wrote: On 2/7/2010 2:43 AM, Wayne Watson wrote: First, the end of the large log showed: 200 File Copy: C:\Python25\Lib\site-packages\dateutil\easter.pyo 200 File Copy: C:\Python25\Lib\site-packages\pylab.pyo 200 File Copy: C:\Python25\Lib\site-packages\configobj.pyo Second, and more importantly, the folder showed: removematplotlab.exe, which I now see below. According to the Add/Remove icon in CP, there is no MPL removal method. What next? Since it seems unlikely the installer was an msi, what sort of installer was this? When I try to execute it, it says this program is normally started by windows. I did another search on uninstall and came up with my posts, and in one case instructions how to do it, but not a word about the removematplotlab.exe program. Another Google gets me to >http://pypi.python.org/pypi/setuptools>, which advertises uninstall, but doesn't look like it delivers. I see I'm once again the the python tutor world of crazy world of replying. Didn't post to the list, just you, so hee goes ... Well, I missed this. Install setuptools using the provided .exe installer. If you've previously installed older versions of setuptools, please delete all setuptools*.egg and setuptools.pth files from your system's site-packages directory (and any other sys.path directories) FIRST. This is a far cry from the idea of simplicity! I'm now using IDLE's path browser. I see matplotlib egg under site-packages by not pth. But there are some pylab py,pyc, pyo files there, which are part of MPL. Ah, the egg file gives the e-mail address of MPL. Maybe he'll know. Why not just delete .../lib\site-packages? At this rate, I might as well uninstall PY2.5 and start again. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- My life in two words. "Interrupted Projects." -- WTW (quote originator) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Closing a matplotlib window after show()
The code below is a typical example of matplotlib use. I've used it both in xp and win7 in IDLE. It produces the required plos and stop with the plot display. If I close the plot window with the x in the upper right corner, the shell window is left open. I have to do the same to close it. If I run it again, and look at the shell window, it looks hung up with the cursor below the >>> prompt. Ctrl-c doesn't break it, and I have to resort to x again. There must be some mechanism to insert below that allows the program to continue on and thus complete. Supposedly fig.close() will but I've put it in several places and have gotten unknown attribute to figure. Comments? from matplotlib.pyplot import figure, show from numpy import arange, pi, cos, sin, pi from numpy.random import rand # unit area ellipse rx, ry = 3., 1. area = rx * ry * pi theta = arange(0, 2*pi+0.01, 0.1) verts = zip(rx/area*cos(theta), ry/area*sin(theta)) x,y,s,c = rand(4, 30) s*= 10**2. fig = figure() ax = fig.add_subplot(111) ax.scatter(x,y,s,c,marker=None,verts =verts) show() -- My life in two words. "Interrupted Projects." -- WTW (quote originator) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Closing a matplotlib window after show()
When I installed matplotlib2.5 on my W7 machine last were a few error msgs about missing about missing files. Is that usual for matplotlib. BTW, I've posted details of my problem to the MPL list. Here I'm interested in the basic of install and use with IDLE, and not the details of the use of MPL. Supposedly an uninstall is provided by a Python setup tool. I hae not used it yet. The basic problem is the show(). One person checked out the examples I provided and found show() to operate fine. On my XP machine the program I'm modifying has plot code someone put in a year or two ago, and it all works fine. My code produces the desired plot, but gets hung up on show(). On 2/7/2010 8:11 PM, Wayne Watson wrote: The code below is a typical example of matplotlib use. I've used it both in xp and win7 in IDLE. It produces the required plots and stop with the plot display. If I close the plot window with the x in the upper right corner, the shell window is left open. I have to do the same to close it. If I run it again, and look at the shell window, it looks hung up with the cursor below the >>> prompt. Ctrl-c doesn't break it, and I have to resort to x again. There must be some mechanism to insert below that allows the program to continue on and thus complete. Supposedly fig.close() will but I've put it in several places and have gotten unknown attribute to figure. Comments? from matplotlib.pyplot import figure, show from numpy import arange, pi, cos, sin, pi from numpy.random import rand # unit area ellipse rx, ry = 3., 1. area = rx * ry * pi theta = arange(0, 2*pi+0.01, 0.1) verts = zip(rx/area*cos(theta), ry/area*sin(theta)) x,y,s,c = rand(4, 30) s*= 10**2. fig = figure() ax = fig.add_subplot(111) ax.scatter(x,y,s,c,marker=None,verts =verts) show() -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Closing a matplotlib window after show()
Hi, I'm not so sure that's true. I have a large 900 line program where some original plot code just continues beyond plot() and show(), after the user closes the plot window. New code that I put in gets knotted up, as far as I can tell. In both cases, I've put print statements after show(), but nothing appears in the shell or, if run by clicking the program file, in the DOS-like window that appears. Further, I posted this elsewhere, and someone claims to have tried a few simple examples with show() at the ended,and they did not get tied up in knots when the user closed the window. I'm going to assume he used IDLE, or a straight execute of the file. On 2/8/2010 2:23 PM, Eike Welk wrote: Hello Wayne! On Monday February 8 2010 20:54:27 Wayne Watson wrote: The basic problem is the show(). One person checked out the examples I provided and found show() to operate fine. On my XP machine the program I'm modifying has plot code someone put in a year or two ago, and it all works fine. My code produces the desired plot, but gets hung up on show(). The behavior that you describe, is the normal behavior of Matplotlib: When you call show(), the program gets stuck. Therefore the call to show is always the last statement in the example programs. Show returns when the last plot window is closed, and in principle the program could then continue. If you want to look at plots while the program is running, you must use Ipython. This is a modified Python interpreter, that contains special code to change the way how Matplotlib works. http://ipython.scipy.org/moin/ Eike. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Closing a matplotlib window after show()
Well, you are correct. Finally, my latest post to the MPL list caught the eye of John Hunter. I think he wrote MPL. The way out is interactive use. One problem I've had with Python packages they "seem" to based on some other product, which one is supposed to know. I sight Tkinter and now MPL. I last used MatLab five years ago, and wrote some simple programs in it, so at least I have a very modest idea of how it works. I may have to use it to grsp the interactive mode. This problem has been a difficult one get a grip on. I've had socket error problems, difficulty getting Matlab back up on my machine, a possible install problem, and a host of ambiguities about this use. The end is near. On 2/8/2010 9:53 PM, Wayne Watson wrote: Hi, I'm not so sure that's true. I have a large 900 line program where some original plot code just continues beyond plot() and show(), after the user closes the plot window. New code that I put in gets knotted up, as far as I can tell. In both cases, I've put print statements after show(), but nothing appears in the shell or, if run by clicking the program file, in the DOS-like window that appears. Further, I posted this elsewhere, and someone claims to have tried a few simple examples with show() at the ended,and they did not get tied up in knots when the user closed the window. I'm going to assume he used IDLE, or a straight execute of the file. On 2/8/2010 2:23 PM, Eike Welk wrote: Hello Wayne! On Monday February 8 2010 20:54:27 Wayne Watson wrote: The basic problem is the show(). One person checked out the examples I provided and found show() to operate fine. On my XP machine the program I'm modifying has plot code someone put in a year or two ago, and it all works fine. My code produces the desired plot, but gets hung up on show(). The behavior that you describe, is the normal behavior of Matplotlib: When you call show(), the program gets stuck. Therefore the call to show is always the last statement in the example programs. Show returns when the last plot window is closed, and in principle the program could then continue. If you want to look at plots while the program is running, you must use Ipython. This is a modified Python interpreter, that contains special code to change the way how Matplotlib works. http://ipython.scipy.org/moin/ Eike. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Closing a matplotlib window after show()
Form me the solution is getting into interactive mode, which I had never heard of until this morning. On 2/9/2010 9:04 AM, Wayne Watson wrote: Well, you are correct. Finally, my latest post to the MPL list caught the eye of John Hunter. I think he wrote MPL. The way out is interactive use. One problem I've had with Python packages they "seem" to based on some other ... -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Exiting a Tkinter Program-- An Anomaly or two
I'm looking a 1800+ line someone else wrote. It uses one large dialog for menus, and has a large area for images. A few menus open small dialogs, for example, to enter a file name. The File menu has an exit choice. The only other exit is the x in the upper right corner of the large dialog. I'm pretty sure that menu is coded to quit via a shoft def in the program. def Quite(self) self.running = False self.master.quit() I see no other code to quit. If I use Exit, the program does not quite. If I then use the x, it quits and the shell script is left open for a command. Any ideas why Quit doesn't work? It's accessible via a self.mainMenu.add_command(.. command=self.Quit) I had not turned the program loose by using a menu or touching any controls. If I cause the program to print to the shell, and then use x to exit that it hangs the shell. Why? When I x the shell, it tells me the prog is running. Do I want to kill it. Yes,kills the shell window. The above seem abnormal to me. Comments? -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Exiting a Tkinter Program-- An Anomaly or two
Well, I found where I had tucked away my inbox mail folder for tkinter. Somehow it got to be a subfolder of another list. It hadn't been used by me for months. The short of this is that I posted to tkinter, and have a better understanding of this now. In fact, fixed it by using sys.exit() in the def. On 2/9/2010 6:00 PM, Wayne Watson wrote: I'm looking a 1800+ line someone else wrote. It uses one large dialog for menus, and has a large area for images. A few menus open small dialogs, for example, to enter a file name. The File menu has an exit choice. The only other exit is the x in the upper right corner of the large dialog. I'm pretty sure that menu is coded to quit via a shoft def in the program. def Quit(self) self.running = False self.master.quit() I see no other code to quit. If I use Exit, the program does not quite. If I then use the x, it quits and the shell script is left open for a command. Any ideas why Quit doesn't work? It's accessible via a self.mainMenu.add_command(.. command=self.Quit) I had not turned the program loose by using a menu or touching any controls. If I cause the program to print to the shell, and then use x to exit that it hangs the shell. Why? When I x the shell, it tells me the prog is running. Do I want to kill it. Yes,kills the shell window. The above seem abnormal to me. Comments? -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] The Order of Imports and install order of modules and other matters (XP vs W7, ...)
There seems to be something of a general consensus in ordering import statements. Something like standard library imports first. When using tools like matlablib or tkinter (maybe), must one keep an order among the relevant imports? Related to this is the order in which modules are installed. Does it make a difference? Finally, I'm in the process of moving Python code from XP to Win7. I just grabbed all the install files I have from XP, and executed them on W7. Everything seems to be working as expected, but one strange thing happened with scipy. It produced a warning about something like "unable to provide key". I continued anyway. All seems well. Was I supposed to use some W7 version of the "XP" files? This is anomaly 1. OK, this the last one. In both XP and W7, I've found executing a program by use of the py file (not IDLE. Is there a name for this method?) using numpy that see early on in the DOS-like window (is there name for it too?) it's complaining (alerting me) about deprecations and some use of a numpy test. What's that about? This is anomaly 2. -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] The Order of Imports and install order of modules and other matters (XP vs W7, ...)
Thanks, Alan. Some of what I've derived elsewhere almost sounds like hearsay or is anecdotal. I'm thinking here about forums and the like. However, I just grabbed my Core Python book, and noted than Chun mentions a preferred sequence. Std Lib, Third Party, App specific modules. He cites scoping rules. Another question on similar matters. If I write a program and "compile" it for distribution, and a user has 2.6 going to be able to execute it. I would like to the the compiled program is free of such restrictions. That is, it's an independent program. I would like to think that if I've been testing it successfully in IDLE, that the compiled version will produce everything I see in IDLE. For example, when I run it in IDLE, and make a connection to the (camera) h/w, a dos-like window appears that I otherwise never see. The program purposefully either sends warning and error messages there through some built-in facility or creates that window somehow. I'm dealing with tkinter in the app code. I didn't write the (1600 line) program, but certainly am modifying it. On 2/13/2010 1:33 AM, Alan Gauld wrote: "Wayne Watson" wrote There seems to be something of a general consensus in ordering import statements. Something like standard library imports first. I've never seen anything written down but its true I tend to do that. But its not been a conscious thing... ... -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] The Order of Imports and install order of modules and other matters (XP vs W7, ...)
Thanks, Kent. As of a day ago, I've moved my Python work to W7. For about the last 4 weeks, I've been using XP. Four weeks ago, I moved my mail and browser to W7, so trying to copy out from one PC to the other is a tale of juggling. Next time I have the deprecation and test msgs appear, I'll print them out, so that I can read the detail. I'm planning on making the code I'm writing available in a "compiled" form, exe. I hope those messages don't appear when users try to execute the program. On 2/13/2010 7:06 AM, Kent Johnson wrote: On Fri, Feb 12, 2010 at 10:55 PM, Wayne Watson wrote: There seems to be something of a general consensus in ordering import statements. Something like standard library imports first. When using tools like matlablib or tkinter (maybe), must one keep an order among the relevant imports? I don't know if there is a general consensus but what I like to do is standard library imports ... s that about? This is anomaly 2. Deprecation warnings mean the code is using some outdated functionality that is slated to be removed. You should at least look at them and see if it is in your code or in scipy. Kent -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] The Order of Imports and install order of modules and other matters (XP vs W7, ...)
Thanks. Sounds like good advice. BTW, I just did some advertising on the AstroPy NG a moment ago for your books. A query for good Py books. On 2/13/2010 8:19 AM, ALAN GAULD wrote: Another question on similar matters. If I write a program and "compile" it for distribution, and a user has 2.6 going to be able to execute it. I would like to the the compiled program is free of such restrictions. That is, it's an independent program. I would like to think that if I've been testing it successfully in IDLE, that the compiled version will produce everything I see in IDLE. Never ever, ever, test anything for distribution inside an IDE! Always test it as it will be run - from the OS prompt or filemanager. IDEs can introduce subtle differences of behaviour that conceal bugs. Similarly never ever do a final test with debuggng code switched on or the debugger active, again the debugger can cause subtle changes in behaviour. For example, when I run it in IDLE, and make a connection to the (camera) h/w, a dos-like window appears that I otherwise never see. The program purposefully either sends warning and error messages there through some built-in facility or creates that window somehow. I'm dealing with tkinter in the app code. I didn't write the (1600 line) program, but certainly am modifying it. Do you run it with python or pythonw, that might also make a difference. HTH, Alan G. -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] A Stuborn Tab Problem in IDLE
When I use F5 to execute a py program in IDLE, Win7, I get a tab error on an indented else. I've selected all and untabifed with 4 spaces several times, and get the same problem. I've tried re-typing the line with zero results. What next? I had been modifying the program repeatedly over several hours, and executing it without any trouble like this. -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] A Stuborn Tab Problem in IDLE
I'm not sure it's postable or attachable for this mail list. I'll give it a try. Attachments do work with other lists. On 2/14/2010 2:51 PM, Steven D'Aprano wrote: On Mon, 15 Feb 2010 09:19:35 am Wayne Watson wrote: When I use F5 to execute a py program in IDLE, Win7, I get a tab error on an indented else. I've selected all and untabifed with 4 spaces several times, and get the same problem. I've tried re-typing the line with zero results. What next? I had been modifying the program repeatedly over several hours, and executing it without any trouble like this. Can you copy and paste the exact error message displayed? -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] A Stuborn Tab Problem in IDLE
I rebooted, and no change. I saved it under a new name, and no change. I tried to activate it as a file, and it put up a screen and down that I had no chance to read it. Since I have been on W7 for a month, have no clue as how to run it from a command line. I'll check with help, and report back. Maybe stuffing it in a txt file with NotePad might reveal something. On 2/14/2010 5:05 PM, Alan Gauld wrote: "Wayne Watson" wrote When I use F5 to execute a py program in IDLE, Win7, I get a tab error on an indented else. What happens if you execute from a command line? Do you get the same error? If so look at the lines before. If not try closing and restarting IDLE HTH, Alan G ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] A Stuborn Tab Problem in IDLE
Well, command line was easy to get to. It's on the menu for python, but it gives me >>>. How do I get to the folder with the py file? Can I switch to a c:\ type operation? Back to exploring. On 2/14/2010 5:05 PM, Alan Gauld wrote: "Wayne Watson" wrote When I use F5 to execute a py program in IDLE, Win7, I get a tab error on an indented else. What happens if you execute from a command line? Do you get the same error? If so look at the lines before. If not try closing and restarting IDLE HTH, Alan G ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] A Stuborn Tab Problem in IDLE
I got to the dos command line facility and got to the file. I executed the program, and it failed with a syntax error. I can't copy it out of the window to paste here, but here's the code surrounding the problem: (arrow ==> points at the problem. The console code shows [ missing. I SEE the syntax error. It's two lines above the line with the arrow. The code now works. Thanks very much. Console wins again! (I suspect you are not into matplotlib, but the plot requires a list for x and y in plot(x,y). xy[0,0] turns out to be a float64, which the syntax rejects. I put [] around it, and it works. Is there a better way? ax1.plot([xy[0,0]],[xy[0,1]],'gs') if npts == 90: # exactly 90 frames ax1.plot([xy[npts-1,0]], xy[npts-1,1]],'rs') # mark it is a last frame else: ax1.plot([xy[npts-1,0]], ==>[xy[npts-1,1]],'ys') # mark 90th frame in path last_pt = len(xy[:,0]) ax1.plot([xy[npts-1,0]],[xy[npts-1,1]],'rs') On 2/14/2010 6:18 PM, Wayne Watson wrote: Well, command line was easy to get to. It's on the menu for python, but it gives me >>>. How do I get to the folder with the py file? Can I switch to a c:\ type operation? Back to exploring. On 2/14/2010 5:05 PM, Alan Gauld wrote: "Wayne Watson" wrote When I use F5 to execute a py program in IDLE, Win7, I get a tab error on an indented else. What happens if you execute from a command line? Do you get the same error? If so look at the lines before. If not try closing and restarting IDLE HTH, Alan G ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] A Stuborn Tab Problem in IDLE
Thanks for the reminder on that. I haven't need the DOS box for 8 months. Just off on other non-programming efforts for the most part. Things have picked up of late. I was beginning to think for awhile that Win7 might have dropped it. I don't see any changes to it. On 2/14/2010 7:01 PM, Dave Angel wrote: Wayne Watson wrote: I got to the dos command line facility and got to the file. I executed the program, and it failed with a syntax error. I can't copy it out of the window to paste here, "Wayne Watson" wrote When I use F5 to execute a py program in IDLE, Win7, I get a tab error on an indented else. What happens if you execute from a command line? Do you get the same error? If so look at the lines before. If not try closing and restarting IDLE HTH, Alan G Once you've discovered the DOS box, you should also discover QuickEdit mode. In the DOS box, right click on the title bar, and choose "Properties". First tab is Options. Enable Quick-Edit mode, and press OK. Now, you can drag a rectangle on the DOS box, and use right click to paste it to the clipboard. Practice a bit and you'll find it easy. An essential tool. DaveA -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] A Stuborn Tab Problem in IDLE
I've found there's quite a bit of discrepancy in top vs bottom posting. It's hardly worth thinking about. I seem to navigate through top, bottom or mixed. The real problem, IMHO, is very long posts from various people. Marty Ah ha! Sorry for the noise, I should really read the whole message before pressing send. :-D Glad you fixed the problem. -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] A Stuborn Tab Problem in IDLE
On 2/14/2010 7:01 PM, Dave Angel wrote: Wayne Watson wrote: I got to the dos command line facility and got to the file. I executed the program, and it failed with a syntax error. I can't copy it out of the window to paste here, Once you've discovered the DOS box, you should also discover QuickEdit mode. In the DOS box, right click on the title bar, and choose "Properties". First tab is Options. Enable Quick-Edit mode, and press OK. Now, you can drag a rectangle on the DOS box, and use right click to paste it to the clipboard. Practice a bit and you'll find it easy. An essential tool. DaveA I have QuickEdit on, but ... I was going to say I couldn't copy and paste. I just did it. However, I guess one can only select on a rectangle, and it has to sweep all the way from left to right. Time to use help, and print it out. -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] PyCon anyone?
Hi all, I'm going to PyCon this year for the first time (yeah!) and I would love to meet other regular contributors to the tutor list. Is anyone else going to be there? Any interest in a "Meet the tutors" Open Space or dinner? Kent ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor Where is it at? -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] PyCon anyone?
On 2/16/2010 7:42 AM, Kent Johnson wrote: On Tue, Feb 16, 2010 at 10:17 AM, Wayne Watson wrote: Hi all, I'm going to PyCon this year for the first time (yeah!) and I would love to meet other regular contributors to the tutor list. Is anyone else going to be there? Any interest in a "Meet the tutors" Open Space or dinner? Kent Where is it at? Where is PyCon or where is the open space? PyCon is in Atlanta this weekend. http://us.pycon.org/2010/about/ Don't know about the open space. Kent Unlikely I'll be in GA. Me neither. :-) -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Wrestingly with the Py2exe Install, Win7, Py2.5
I've finally decided to see if I could make an executable out of a py file. Win7. Py2.5. I brought down the install file and proceeded with the install. I got two warning messages. Forgot the first. The second said,"Could not set the key value." I again used OK. I think that was the only choice. It then issued a message in a larger dialog. I've attached it here, but have had zero luck recently and in the past. It was about setting a key, and pointed me to a log. It mentions a Removepy2exe -u Although it finished, I have no idea where the program is. It does not show up on the Start menu All Programs List nore my desktop. What's up. I've had these messages (key) occur on other Python installs as I transition to Win7. So far no problem. -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] "Sounding" Off, IDLE (Win7)
In Win7 IDLE, when I type in something with a syntax problem, a bell rings. How do I stop that? I've looked at Control Panel Sounds, but don't see anything of apparent use. -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Wrestling with the Py2exe Install, Win7[XP!], Py2.5
(This is the same msg as above, but I meant XP. I'm transitioning from XP to Win7, and am operating with two monitors and keyboards side by side. I thought I had used W7, but nope. Corrected wrestling it Subject.) I've finally decided to see if I could make an executable out of a py file. XP. Py2.5. I brought down the install file and proceeded with the install. I got two warning messages. Forgot the first. The second said,"Could not set the key value." I again used OK. I think that was the only choice. It then issued a message in a larger dialog. I've attached it here, but have had zero luck recently and in the past. It was about setting a key, and pointed me to a log. It mentions a Removepy2exe -u Although it finished, I have no idea where the program is. It does not show up on the Start menu All Programs List nor my desktop. What's up. I've had these messages (key) occur on other Python installs as I transition to Win7. So far no problem. -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Wrestling with the Py2exe Install, Win7[XP!], Py2.5
I'm following the tutorial and ran into a snag. Here is the console output.( Can I do this from IDLE?) C:\Sandia_Meteors\Sentinel_Development\Learn_Python>c:\python25\python setup.py Traceback (most recent call last): File "setup.py", line 2, in import py2exe ImportError: No module named py2exe Note the need to back pedal to c:\python25\ Perhaps I need some path variable set? -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] "Sounding" Off, IDLE (Win7)
Nothing to do with Ctrl-G. Cmd Prompt not open. So if you have a syntax error, no bell rings? I don't want to disable all sounds. On 2/17/2010 2:48 AM, Michael M Mason wrote: Wayne Watson wrote on 16 February 2010 at 17:58:- In Win7 IDLE, when I type in something with a syntax problem, a bell rings. How do I stop that? I've looked at Control Panel Sounds, but don't see anything of apparent use. I don't get this on my Win7 machine. But anyway, the sound is probably the same sound you get if you type CTRL-G at a command prompt in a DOS box, in which case it isn't one of the sounds you set in Control Panel. You can disable it using Device Manager. It's called 'System Speaker' and it's under 'System devices'. Right-click and choose 'Disable'. -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Wrestling with the Py2exe Install, Win7[XP!], Py2.5
It imported setup fine from the IDLE cmd prompt. Win Cmd prompt is fine to operate it. Just curious about IDLE. I looked in setup.py and don't see what the complaint is. It sure thinks py2exe is not available. I'm now in IDLE's path browser. I see pkgs in ...\lib\site-packages like dateutil, numdisplay, numpy, but no py2exe. Doesn't seem right, since I can import it. I'm pretty sure that during the install that py2exe was headed to site On 2/18/2010 8:25 AM, Robert Berman wrote: -Original Message- From: tutor-bounces+bermanrl=cfl.rr@python.org [mailto:tutor- bounces+bermanrl=cfl.rr@python.org] On Behalf Of Wayne Watson Sent: Wednesday, February 17, 2010 10:07 PM To: tutor@python.org Subject: Re: [Tutor] Wrestling with the Py2exe Install, Win7[XP!], Py2.5 I'm following the tutorial and ran into a snag. Here is the console output.( Can I do this from IDLE?) C:\Sandia_Meteors\Sentinel_Development\Learn_Python>c:\python25\pyth on setup.py Traceback (most recent call last): File "setup.py", line 2, in import py2exe ImportError: No module named py2exe Note the need to back pedal to c:\python25\ Perhaps I need some path variable set? -- Wayne, When you install py2exe it should insure all the required modules are available to your standard python path. For example, I am running python 2.64 and the py2exe module is in the python path. I don't use IDLE. I use Ipython however I cannot see why IDLE would not work. To tell if you are OK do import py2exe. You should have no problem loading it. If you do, reinstall it. Robert -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Wrestling with the Py2exe Install, Win7[XP!], Py2.5
Got it. Fooled myself. I'm converting to Win7 and have my XP keyboard and monitor side by side with the same for XP. I did the world program in XP and py2exe module in W7!! world compiled and ran successfully. Now for a bigger program with matplotlib and tkinter. Maybe I'll just settle for a small matplotlib program for the moment. VBG Thanks very much. On 2/18/2010 4:30 PM, Wayne Watson wrote: It imported setup fine from the IDLE cmd prompt. Win Cmd prompt is fine to operate it. Just curious about IDLE. I looked in setup.py and don't see what the complaint is. It sure thinks py2exe is not available. I'm now in IDLE's path browser. I see pkgs in ...\lib\site-packages like dateutil, numdisplay, numpy, but no py2exe. Doesn't seem right, since I can import it. I'm pretty sure that during the install that py2exe was headed to site On 2/18/2010 8:25 AM, Robert Berman wrote: -Original Message- From: tutor-bounces+bermanrl=cfl.rr@python.org [mailto:tutor- bounces+bermanrl=cfl.rr....@python.org] On Behalf Of Wayne Watson Sent: Wednesday, February 17, 2010 10:07 PM To: tutor@python.org Subject: Re: [Tutor] Wrestling with the Py2exe Install, Win7[XP!], Py2.5 I'm following the tutorial and ran into a snag. Here is the console output.( Can I do this from IDLE?) C:\Sandia_Meteors\Sentinel_Development\Learn_Python>c:\python25\pyth on setup.py Traceback (most recent call last): File "setup.py", line 2, in import py2exe ImportError: No module named py2exe Note the need to back pedal to c:\python25\ Perhaps I need some path variable set? -- Wayne, When you install py2exe it should insure all the required modules are available to your standard python path. For example, I am running python 2.64 and the py2exe module is in the python path. I don't use IDLE. I use Ipython however I cannot see why IDLE would not work. To tell if you are OK do import py2exe. You should have no problem loading it. If you do, reinstall it. Robert -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Wrestling with the Py2exe Install, Win7[XP!], Py2.5
There's a bit of an anomaly. I've compiled 3 small programs now, and in cmd prompt a Dir does not find the file. It finds the py file, but not the completed file. Nevertheless, if I type in the prefix, the desired program executes. On 2/18/2010 4:48 PM, Wayne Watson wrote: Got it. Fooled myself. I'm converting to Win7 and have my XP keyboard and monitor side by side with the same for XP. I did the world program in XP and py2exe module in W7!! world compiled and ran successfully. Now for a bigger program with matplotlib and tkinter. Maybe I'll just settle for a small matplotlib program for the moment. VBG Thanks very much. -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] The Disappearing Program (py2exe)
I've successfully compiled several small python programs on Win XP into executables using py2exe. A program goes from a name like snowball.py to snowball. A dir in the command prompt window finds snowball.py but not snowball. If I type in snowball, it executes. What's up with that? -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Wrestling with the Py2exe Install, Win7[XP!], Py2.5
Sneaky! :-) Yes, I now recall you mentioning it earlier. I'm looking at dist right now. I see a program I built in a folder above dist, pylab_scatter.exe. Interestingly, if I fire it up from the Win folder, a dos-window appears and it dies. A few lines appear too quickly to read. If I execute it from the command prompt, it works fine. Still the mystery to me is why I don't need to add exe in the cmd prompt to execute it. Further, how did it know to look in the dist folder? I checked with IDLE's path browser, and don't see it there. I'm not yet on board with the browser, but it looks like a starting point for finding py files I've run under IDLE. I looked for your post that had details, and I don't see it. I know you did post it. I had some trouble a few days ago trying to reply to one of your posts. It's not in my trash. Strange. The two directories are discussed just above section 4, right at the end of the a long output list. I missed that, since I thought the paragraph described the list, which I wasn't really interested in at the time. I would think that all the extras in dist are useful to other compiles of programs in my py folder? I have a comment about the tutorial. The command line shown a few lines into section 3. does not need python in the line in my case. setup.py py2exe works. I've glanced at section 5 and understand the basics. I'll be back to it later as needed. I didn't notice your reply in the queue this morning, and posted a msg about the disappearing file thinking there was a disconnect on the posts I had trouble with as above. I'll fix that post shortly. On 2/19/2010 5:34 AM, Robert Berman wrote: Wayne, Somewhere in the tutorial should be a comment about py2exe creating two additional directories: build and dist. Forget about the build directory. If you look in the dist directory you will find the exe file and all supporting files. If you look back to an earlier email you will see a more detailed explanation I sent you. Robert Berman -Original Message- From: Wayne Watson [mailto:sierra_mtnv...@sbcglobal.net] Sent: Thursday, February 18, 2010 11:10 PM To: Robert Berman Cc: tutor@python.org Subject: Re: [Tutor] Wrestling with the Py2exe Install, Win7[XP!], Py2.5 There's a bit of an anomaly. I've compiled 3 small programs now, and in cmd prompt a Dir does not find the file. It finds the py file, but not the completed file. Nevertheless, if I type in the prefix, the desired program executes. On 2/18/2010 4:48 PM, Wayne Watson wrote: Got it. Fooled myself. I'm converting to Win7 and have my XP keyboard and monitor side by side with the same for XP. I did the world program in XP and py2exe module in W7!! world compiled and ran successfully. Now for a bigger program with matplotlib and tkinter. Maybe I'll just settle for a small matplotlib program for the moment. VBG Thanks very much. -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] The Disappearing Program (py2exe)
The answer now appears in "Wrestling with ...". It's in a dist folder that py2exe produces. See Robert Berman post today, 2/19 early in morning. 5:34 am here. On 2/19/2010 7:00 AM, Wayne Watson wrote: I've successfully compiled several small python programs on Win XP into executables using py2exe. A program goes from a name like snowball.py to snowball. A dir in the command prompt window finds snowball.py but not snowball. If I type in snowball, it executes. What's up with that? -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Wrestling with the Py2exe Install, Win7[XP!], Py2.5
I suppose I'm in an interesting situation with regard to Win cmd prompt. I did this work on XP. There the facility is a bit more constraining than Win7 on my new PC. On XP, I do not have name completion w/o setting something. I only recently started with cmd prompt again. In Win7, it's automatic. There are other differences. An oddity, to me at least, name completion in W7 does not halt at the first difference. It goes all the way to completion at the first file that it can find, I think. I have to back up and try again. I think today will end my use of Python on XP. I have all files on Win7 now. I'll likely test py3exe there today to see how it behaves. What you say about the path change makes sense, but it's unfortunate the producers of py2exe haven't given some insight into this and the misc files produced in the dist folder. Of course, I have not Googled much at all on any of this. I'm glad I finally worked my way to this facility. It should help a good deal on the distribution of my demos to non-python friends, and fellow project workers at far flung places from here. On 2/19/2010 11:44 AM, Alan Gauld wrote: "Wayne Watson" wrote pylab_scatter.exe. Interestingly, if I fire it up from the Win folder, a dos-window appears and it dies. A few lines appear too quickly to read. If I execute it from the command prompt, it works fine. Still the mystery to me is why I don't need to add exe in the cmd prompt to execute it. DOS(*) automatically looks for executable file extensions (exe,com, bat etc) so you don't need to type them. You don't type cmd.exe to start a DOS shell do you? You only type cmd... I hope! (*)Actually the Windows command processor CMD.EXE Further, how did it know to look in the dist folder? Thats more interesting! It presumably added dist to the PATH environment variable. Not the Python path the DOS one - after all the EXE is not a python program any more its an exe file running under DOS. I have a comment about the tutorial. The command line shown a few lines into section 3. does not need python in the line in my case. setup.py py2exe works. That only works because you have the file asociation set to recognise .py files as associated with the interpreter. Using python explicitly removes that potential trip wire and so for a tutorial writer makes it a much safer option. HTH, -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Wrestling with the Py2exe Install, Win7[XP!], Py2.5
Things were not quite what the seem. I just tried to run a program that was not converted, and left off py. It worked. So maybe the only way to execute the compiled code is to to to dist? -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] The Disappearing Program (py2exe)
XP. Win 7, I hope, by the end of the day. Stuff is working under Win 7 from my transfer of it from a week or so ago. The only thing I left on XP was the py2exe stuff. I'm writing this from my Win 7 machine. There's a big twist in this. I've verified that when I typed the name w/o py, it really executed it anyway. I did that with a py file that was never setup by py2exe. I then went to dist and fired up the compiled exe file and got a complaint matplotlib. It couldn't find its data files. Certainly the step in section 4, test your executable, has been of no use. Maybe I need to go to step 5? Perhaps I need the msvcr71.dll file. Forget that.It's in dist. Time to read more of 5. On 2/19/2010 9:46 AM, Robert Berman wrote: Wayne, I am assuming you are using Win 7 and I'll answer with that unless you tell me you are using XP in which case I will walk over to my wife's desk and test what I am telling you on her XP driven machine. Assuming Windows 7. Looking at your directory you should be using Windows Explorer. Click on Organize then click on folder and search options. Then click on view. Make sure the check box that says 'hide extensions for known file types' is not clicked. Once that is done, all your file extensions (all of them) will be seen and shown. Robert -Original Message- From: Wayne Watson [mailto:sierra_mtnv...@sbcglobal.net] Sent: Friday, February 19, 2010 12:11 PM To: Robert Berman Subject: Re: [Tutor] The Disappearing Program (py2exe) I'm sure you are right. I'm not sure what you mean about view params. Properties? On 2/19/2010 7:08 AM, Robert Berman wrote: I think you will find that snowball is actually snowball.exe. You might check the view parameters on how your extensions are being displayed. -Original Message- From: tutor-bounces+bermanrl=cfl.rr@python.org [mailto:tutor- bounces+bermanrl=cfl.rr@python.org] On Behalf Of Wayne Watson Sent: Friday, February 19, 2010 10:00 AM To: tutor@python.org Subject: [Tutor] The Disappearing Program (py2exe) I've successfully compiled several small python programs on Win XP into executables using py2exe. A program goes from a name like snowball.py to snowball. A dir in the command prompt window finds snowball.py but not snowball. If I type in snowball, it executes. What's up with that? -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] The Disappearing Program (py2exe)
OK, I'm completely on Win7. hello.exe works as expected by the tutorial. That file is in dist. I've now tried this program, pylab_scatter.py: #!/usr/bin/env python from pylab import * N = 30 x = 0.9*rand(N) y = 0.9*rand(N) area = pi*(10 * rand(N))**2 # 0 to 10 point radiuses scatter(x,y,s=area, marker='^', c='r') show() It runs properly in IDLE. == It appears to compile properly. Now from the cmd prompt window: C:\Users\Wayne\Sandia_Meteors\Sentinel_Development\Learn_Python\Py2exe_Test\dist>pylab_scatter.exe Traceback (most recent call last): File "pylab_scatter.py", line 2, in File "pylab.pyc", line 1, in File "matplotlib\__init__.pyc", line 677, in File "matplotlib\__init__.pyc", line 598, in rc_params File "matplotlib\__init__.pyc", line 552, in matplotlib_fname File "matplotlib\__init__.pyc", line 242, in wrapper File "matplotlib\__init__.pyc", line 482, in _get_data_path_cached File "matplotlib\__init__.pyc", line 478, in _get_data_path RuntimeError: Could not find the matplotlib data files <---What is this? C:\Users\Wayne\Sandia_Meteors\Sentinel_Development\Learn_Python\Py2exe_Test\dist> == I Googled this py2exe message RuntimeError: Could not find the matplotlib data files. As of yet, it does not look like a solution ia available for matplotlib. -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] The Disappearing Program (py2exe)
Yes, I sent a message there last night. No responses yet. Strangely I don't see it posted yet. That was six hours ago. Well, I finish off my night's sleep in about 4 hours maybe it will have made it.py2exe seems a little less traveled subject than most. On 2/20/2010 1:36 AM, Alan Gauld wrote: "Wayne Watson" wrote File "matplotlib\__init__.pyc", line 478, in _get_data_path RuntimeError: Could not find the matplotlib data files <---What is this? C:\Users\Wayne\Sandia_Meteors\Sentinel_Development\Learn_Python\Py2exe_Test\dist> == I Googled this py2exe message RuntimeError: Could not find the matplotlib data files. As of yet, it does not look like a solution ia available for matplotlib. Have you tried asking on the matplotlib groups? I notice on gmane that there are four matplotlib groups listed. One of them might be able to help? Alan G. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] The Disappearing Program (py2exe)
This apparently not quite as easy as the py2exe suggests when MPL is involved. See <http://www.py2exe.org/index.cgi/MatPlotLib>. It looks like I have some reading and work to do. On 2/20/2010 3:21 AM, Wayne Watson wrote: Yes, I sent a message there last night. No responses yet. Strangely I don't see it posted yet. That was six hours ago. Well, I finish off my night's sleep in about 4 hours maybe it will have made it.py2exe seems a little less traveled subject than most. On 2/20/2010 1:36 AM, Alan Gauld wrote: "Wayne Watson" wrote File "matplotlib\__init__.pyc", line 478, in _get_data_path RuntimeError: Could not find the matplotlib data files <---What is this? C:\Users\Wayne\Sandia_Meteors\Sentinel_Development\Learn_Python\Py2exe_Test\dist> == I Googled this py2exe message RuntimeError: Could not find the matplotlib data files. As of yet, it does not look like a solution ia available for matplotlib. Have you tried asking on the matplotlib groups? I notice on gmane that there are four matplotlib groups listed. One of them might be able to help? Alan G. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] The Disappearing Program (py2exe)
(This might be slightly readable. Missed two words.) This apparently is not quite as easy as the py2exe tutorial suggests when MPL is involved. See <http://www.py2exe.org/index.cgi/MatPlotLib>. It looks like I have some reading and work to do. The link came from my post to the MPL list. I hadn't noticed it last night, since it got stuck in my server as spam. On 2/20/2010 3:21 AM, Wayne Watson wrote: Yes, I sent a message there last night. No responses yet. Strangely I don't see it posted yet. That was six hours ago. Well, I finish off my night's sleep in about 4 hours maybe it will have made it.py2exe seems a little less traveled subject than most. On 2/20/2010 1:36 AM, Alan Gauld wrote: "Wayne Watson" wrote File "matplotlib\__init__.pyc", line 478, in _get_data_path RuntimeError: Could not find the matplotlib data files <---What is this? C:\Users\Wayne\Sandia_Meteors\Sentinel_Development\Learn_Python\Py2exe_Test\dist> == I Googled this py2exe message RuntimeError: Could not find the matplotlib data files. As of yet, it does not look like a solution ia available for matplotlib. Have you tried asking on the matplotlib groups? I notice on gmane that there are four matplotlib groups listed. One of them might be able to help? Alan G. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] "Two" Card Monty with File Operations--Reading from Wrong Folder (W7?)
I have a program called TrackStudy.py and another called ReportTool.py Track runs above an Events folder that contains txt files that it examines.Report runs in an Events folder on the same txt files. Neither is operated when the other is operating. Both only read the same files. I've been operating Report in another Events folder at another folder level. Both work fine that way. I decided to copy Report into the Event folder below Track. If I run Track, it sees every txt file in Events. However, if I run Track, it refers back to the other Events folder, and works fine even though on the wrong set of files. I've pretty much assumed by observation, that these programs read the txt files in alphabetical order. It still seems the case. There is one difference in Track on this. It uses: paths = glob.glob(final_string) to locate files. They always occur in the proper low to high sequence. Report produces the wrong files in alpha order. The question is why does Report see the folder in the wrong folder? Although I think I've verified matters, I could be off. Is there a way to ensure I'm really getting to the right folder? There may be a Win7 problem here. See below. Here's a diagram that might help. Cap names means folder. BINGO EVENTS a1.txt a2.txt report.py CARDS track.py EVENTS b1.txt b2.txt b3.txt Now copy report.py to CARDS BINGO EVENTS a1.txt a2.txt report.py CARDS track.py EVENTS b1.txt b2.txt b3.txt report.py While working on this problem, I came up with a Win7 puzzler. It amounts to this. If I search for files in EVENTS of CARDS for "b", it only finds one of the b-files. I had a long 1 hour talk with HP tech support. They had no answer, but will take it up with MS. It may be related to the first problem. Probably not, but curious. I suspect that Win7's new folder search has somehow used a filter. I had no idea of any filter use until I accidentally found it in W7 Help. Perhaps the filter was some how set. Not by me. Here's a stab in the dark. Maybe the copied report.py really is a pointer to the other one? -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] "Two" Card Monty with File Operations--Reading from Wrong Folder (W7?) !!!
Well, it looks very much like my stab in the dark is very much correct ( see end of msg below). I changed the name of the file in the folder from which I copied the file to place elsewhere. When I tried to open the file, it started searching for the file.Properties clearly shows it pointing to the wrong file. Good grief. What has Win7 brought? On 2/21/2010 7:29 PM, Wayne Watson wrote: ... The question is why does Report see the folder in the wrong folder? Although I think I've verified matters, I could be off. Is there a way to ensure I'm really getting to the right folder? There may be a Win7 problem here. See below. Here's a diagram that might help. Cap names means folder. BINGO EVENTS a1.txt a2.txt report.py CARDS track.py EVENTS b1.txt b2.txt b3.txt Now copy report.py to CARDS BINGO EVENTS a1.txt a2.txt report.py CARDS track.py EVENTS b1.txt b2.txt b3.txt report.py While working on this problem, I came up with a Win7 puzzler. It amounts to this. If I search for files in EVENTS of CARDS for "b", it only finds one of the b-files. I had a long 1 hour talk with HP tech support. They had no answer, but will take it up with MS. It may be related to the first problem. Probably not, but curious. I suspect that Win7's new folder search has somehow used a filter. I had no idea of any filter use until I accidentally found it in W7 Help. Perhaps the filter was some how set. Not by me. Here's a stab in the dark. Maybe the copied report.py really is a pointer to the other one? -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Verifying My Troublesome Linkage Claim between Python and Win7
A few days ago I posted a message titled ""Two" Card Monty. The problem I mentioned looks legitimate, and remains puzzling. I've probed this in a newsgroup, and no one has an explanation that fits. My claim is that if one creates a program in a folder that reads a file in the folder it and then copies it to another folder, it will read the data file in the first folder, and not a changed file in the new folder. I'd appreciate it if some w7 users could try the program below, and let me know what they find. I'm using IDLE in Win7 with Py 2.5. My experience is that if one checks the properties of the copied file, it will point to the original py file and execute it and not the copy. If win7 is the culprit, I would think this is a somewhat serious problem. It may be the sample program is not representative of the larger program that has me stuck. If necessary I can provide it. It uses common modules. (Could this be something like the namespace usage of variables that share a common value?) # Test program. Examine strange link in Python under Win7 # when copying py file to another folder. # Call the program vefifywin7.py # To verify my situation use IDLE, save and run this program there. # Put this program into a folder along with a data file # called verify.txt. Create a single text line with a few characters in it # Run this program and note the output # Copy the program and txt file to another folder # Change the contents of the txt file # Run it again, and see if the output is the same as in the other folder track_file = open("verify.txt") aline = track_file.readline(); print aline track_file.close() -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Verifying My Troublesome Linkage Claim between Python and Win7
Ok, I'm back after a three day trip. You are correct about the use of pronouns and a few misplaced words. I should have reread what I wrote. I had described this in better detail elsewhere, and followed that description with the request here probably thinking back to it. I think I was getting a bit weary of trying to find an answer. Try t;his. Folder1 track1.py data1.txt data2.txt data3.txt Folder2 track1.py dset1.txt dset2.txt ... dset8.txt data and dset files have the same record formats. track1.py was copied into Folder2 with ctrl-c + ctrl-v. When I run track1.py from folder1, it clearly has examined the data.txt files. If I run the copy of track1.py in folder2, it clearly operates on folder1 (one) data.txt files. This should not be. If I look at the properties of track1.py in folder2 (two), it is pointing back to the program in folder1 (one). I do not believe I've experienced this sort of linkage in any WinOS before. I believed I confirmed that the same behavior occurs using cmd prompt. I'll now head for Alan's reply. On 2/23/2010 5:35 PM, Dave Angel wrote: Wayne Watson wrote: A few days ago I posted a message titled ""Two" Card Monty. The problem I mentioned looks legitimate, and remains puzzling. I've probed this in a newsgroup, and no one has an explanation that fits. My claim is that if one creates a program in a folder that reads a file in the folder it ... then copies it to another folder, it will read the data file in the first folder, and not a changed file in the new folder. I'd appreciate it if some w7 users could try the program below, and let me know what they find. I'm using IDLE in Win7 with Py 2.5. My experience is that if one checks the properties of the copied file, it will point to the original py file and execute it and not the copy. If win7 is the culprit, I would think this is a somewhat serious problem. It may be the sample program is not representative of the larger program that has me stuck. If necessary I can provide it. It uses common modules. (Could this be something like the namespace usage of variables that share a common value?) # Test program. Examine strange link in Python under Win7 # when copying py file to another folder. # Call the program vefifywin7.py # To verify my situation use IDLE, save and run this program there. # Put this program into a folder along with a data file # called verify.txt. Create a single text line with a few characters in it # Run this program and note the output # Copy the program and txt file to another folder # Change the contents of the txt file # Run it again, and see if the output is the same as in the other folder track_file = open("verify.txt") aline = track_file.readline(); print aline track_file.close() I find your English is very confusing. Instead of using so many pronouns with confusing antecedents, try being explicit. >My claim is that if one creates a program in a folder that reads a file in the folder Why not say that you created a program and a data file in the same folder, and had the program read the data file? >...in the folder it and then copies it to another folder That first 'it' makes no sense, and the second 'it' probably is meant to be "them". And who is it that does this copying? And using what method? > ... it will read the data file in the first folder Who will read the data file? The first program, the second, or maybe the operator? About now, I have to give up. I'm guessing that the last four lines of your message were intended to be the entire program, and that that same program is stored in two different folders, along with data files having the same name but different first lines. When you run one of these programs it prints the wrong version of the line. You have lots of variables here, Python version, program contents, Idle, Windows version. Windows 7 doesn't do any mysterious "linking," so I'd stop making that your working hypothesis. Your problem is most likely the value of current directory ( os.getcwd() ). And that's set according to at least three different rules, depending on what program launches Python. If you insist on using Idle to launch it, then you'll have to convince someone who uses Idle to tell you its quirks. Most likely it has a separate menu for the starting directory than for the script name & location. But if you're willing to use the command line, then I could probably help, once you get a clear statement of the problem. By default, CMD.EXE uses the current directory as part of its prompt, and that's the current directory Python will start in. But the first things to do are probably to print out the value of os.getcwd(), and to add a slightly different print in each version of the program so you k
Re: [Tutor] Verifying My Troublesome Linkage Claim between Python and Win7
I just referenced Alan to my response to you, and included this statement. Once you've both read the first reply to you and this, then you should both be in synch with where I'm at. To Alan=== Oh, I also changed the name of folder1 in the reply to Dave to see what would happen with the "copied" py file in folder2 upon execution. It couldn't find the py file in folder1. -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Verifying My Troublesome Linkage Claim between Python and Win7
See below. On 2/27/2010 10:58 AM, Steven D'Aprano wrote: On Sun, 28 Feb 2010 05:30:49 am Wayne Watson wrote: Ok, I'm back after a three day trip. You are correct about the use of pronouns and a few misplaced words. I should have reread what I wrote. I had described this in better detail elsewhere, and followed that description with the request here probably thinking back to it. I think I was getting a bit weary of trying to find an answer. Try this. Folder1 track1.py data1.txt data2.txt data3.txt Folder2 track1.py dset1.txt dset2.txt ... dset8.txt data and dset files have the same record formats. track1.py was copied into Folder2 with ctrl-c + ctrl-v. When I run track1.py from folder1, it clearly has examined the data.txt files. If I run the copy of track1.py in folder2, it clearly operates on folder1 (one) data.txt files. This should not be. Without seeing the code in track1.py, we cannot judge whether it should be or not. I can think of lots of reasons why it should be. For example: I'll attach the code to this. However, I haven't had the best of luck getting attachments posted. Frankly, I think it's better to try the sample program I provided at the top of the thread. If you are not using Win7, I don't think this is going to work well, but maybe you'll see something that's a no-no in any OS. I have several data files, if anyone wants to go that far. I can supply a data file if necessary. Note this program is still in development. In fact, I was going to pull the debug "wtw" statements and wrap it all up when this problem occurred. if you have hard-coded the path to Folder1 if you call os.chdir(Folder1) Not to my knowledge. I just "assume" that the program will read the txt files in alpha order in the same folder as the program. if you have changed the PATH so that Folder1 gets searched before the current directory then the behaviour you describe theoretically could happen. How are you calling track1.py? Do you do this? cd Folder2 python track1.py Yes, I believe I've tried that. What if you change the second line to: python ./track1.py Are you perhaps using this? python -m track1 Don't even know what it means. If you change the name of the copy from track1.py to copy_of_track1.py, and then call this: python copy_of_track1.py how does the behaviour change? I'll try it later. I probably have tried it already. See my "point" comments below. If Properties doesn't change, changing the name isn't going to work. If I look at the properties of track1.py in folder2 (two), it is pointing back to the program in folder1 (one). What? "Pointing back", as in a Shortcut? Or a symlink? Aren't symlinks Linux world? I know nothing about them. Windows7 Properties of track1.py in folder 2 (two) show the py file is really in folder1. If you've created a shortcut instead of a copy, I'm not surprised you are executing it in the "wrong" folder. That's what shortcuts do. If I've created a shortcut, it wasn't by design. Ctrl-c to ctrl-v most likely. -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain # Generates summary reports on description txt files in present folder # There are three output files, A, B and C. # A produces a report with titles and column descriptions along with event data # B only produces event data, no titles; otherwise, same as A # C produces a report with titles and amplitude stats; otherwise same as A # Things to do # Re-examine magnitude philosophy on segments and for first 30 seconds. # print DST year via dictionary entry # sentuser txt (track data) contents on each line # 1. Frame count relative to the trigger time. Negative values are before trigger. Positive values are after trigger. # 2. Number of pixels that are above threshold. # 3. Amplitude. Basically, the sum of all pixels above threshold. # 4. X coordinate of the event centroid, in pixels. # 5. Y coordinate of the event centroid, in pixels. # # There is a header line, which is followed by an empty line # Note that some of the functions here are not used here They are # part of a class, and as such are perfectly acceptable Python's reuseability # philosophy. They produce statistics that may be needed in the future, # particularly the segment calcs. See the CollectTrkData class. import sys, os, glob import string from numpy import * from datetime import datetime, timedelta import time from scipy import stats as stats # scoreatpercentile # DST for several years from # Naval Obs. <http://aa.usno.navy.mil/faq/docs/daylight_time.php> DST_dict = { # West coast, 8 hours from Greenwich for PST (Pacific States) 200
Re: [Tutor] Verifying My Troublesome Linkage Claim between Python and Win7
On 2/27/2010 12:38 PM, Dave Angel wrote: Wayne Watson wrote: Ok, I'm back after a three day trip. You are correct about the use of pronouns and a few misplaced words. I should have reread what I wrote. I had described this in better detail elsewhere, and followed that description with the request here probably thinking back to it. I think I was getting a bit weary of trying to find an answer. Try t;his. Folder1 track1.py data1.txt data2.txt data3.txt Folder2 track1.py dset1.txt dset2.txt ... dset8.txt So how do you know this is the structure? If there really are shortcuts or symbol links, why aren't you showing them? Did you do a DIR from the command line, to see what's there? Or are you looking in Explorer, which doesn't even show file extensions by default, and just guessing what's where ? I can see it looking at the folder. I suppose one might call it Win Explorer. It doesn't show any links. If I pick a file and right click on it, then a number of menu items are shown. If I pick Properties, it shows the link. The only link I need to provide you for the above, I described below. Look at the properties of the py file in folder2. data and dset files have the same record formats. track1.py was copied into Folder2 with ctrl-c + ctrl-v. Those keys don't work from a command prompt. From there, you'd use COPY or something similar. So I have to guess you were in an Explorer window, pointing to Folder 1, and you selected the python file, and pressed Ctrl-C. Then you navigated to Folder 2, and pressed Ctrl-V. If you did, Windows 7 wouldn't have created any kind of special file, any more than earlier ones did. Chances are you actually did something else. For example, you might have used a right-click drag, and answered "create shortcut" when it asked what you wanted to do. Or perhaps you did drag/drop with some ctrl-or alt-key modifier. You're right. I either dragged and dropped, or right clicked on the file and used the copy item. Similarly pasted, It's almost second nature to me. I'll do one right now using Explorer. I'm in a folder that I called folder1 here. It has lots of txt files. I selected one, and mouse clicked copy. I then created a sub folder called junk, and selected it's empty, as expected. Now a mouse click to paste. The txt file is there. I mouse click on properties and the "link" says it's right where I punt it. In junk. Anyway, you need to be more explicit about what you did. If you had used a command prompt, you could at least have pasted the things you tried directly to your message, so we wouldn't have so much guessing to do. Well, I guess I could get out my video camera and make a video, which I say tongue-in-cheek, but I really can do that. When I run track1.py from folder1, it clearly has examined the data.txt files. And how are you running track1.py ? And how do you really know that's what ran? The code you posted would display a string, then the window would immediately go away, so you couldn't read it anyway. Awhile ago I ran it from IDLE. I know it rain because it puts output on the shell window, and writes three files. If I run the copy of track1.py in folder2, it clearly operates on folder1 (one) data.txt files. This should not be. If I look at the properties of track1.py in folder2 (two), it is pointing back to the program in folder1 (one). Exactly what do you mean by "pointing back" ? If you're getting icons in your Explorer view, is there a little arrow in the corner? When you did the properties, did you see a tab labeled "shortcut" ? I do not use shortcut. I really don't know about Explorer. I use what is probably Explorer. It works like this. Go to drive C:. It displays 15 folders. I click on the a folder until I get to my py programs. Once there, I see them and others all listed. I do not believe I've experienced this sort of linkage in any WinOS before. I believed I confirmed that the same behavior occurs using cmd prompt. Shortcuts have been in Windows for at least 20 years. But you still haven't given enough clues about what you're doing. Video anyone? How about a live session? I have a tool made by Cisco that would allow us to look at either's screen Actually, I really don't plan to build a career out of finding out the cause of this, so let's forget that. I'm read to punt. I sent a copy of the program to Steven. I do not see it oisted. Possibly two reasons. It's stuck on my server, or the attachment is being held by the moderator. If someone cannot find the problem there, I think it's MS's problem, and I can probably finagle the code into folder in a way to test it in the "problem" folder. I'm the only user of these programs that
Re: [Tutor] Verifying My Troublesome Linkage Claim between Python andWin7
(Apparently, I did not send this about 6 hours ago. Anyway, here it is.) Let's start from the response I just made to Dave Angel minutes ago, or, at least very recently. I think I wrote a bit more accurately about matters. We'll continue as appropriate from that point. Let me answer some of your questions about the environment from below. I've dropped out of IDLE at times to see that made a difference. Windows 7. IDLE. Command Prompt window for verification. I'm pretty sure I did that once, but will verify it again. Got the same results. Oh, I also changed the name of folder1 in the reply to Dave to see what would happen with the "copied" py file in folder2 upon execution. It couldn't find the py file in folder1. Other questions about the environment? ... -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Verifying My Troublesome Linkage Claim between Python and Win7
On 2/27/2010 5:24 PM, Steven D'Aprano wrote: Hello Wayne, I sympathise with your problem, but please understand you are not making it easy for us when you give us incoherent information. I hope the coherency has improved recently. :-) I think if you saw the cramped quarters I'm in that you might understand my supposed incoherency. For what it's worth, and that's about zero, I'm working with my old XP and W7 machine's keyboards, mice and monitors side-by-side. I have several times found my self using the wrong device. I'm steadily moving from programs and data from one to another. This weekend when I get a printer cable, the XP machine will be relegated to a distant table. You tell us to "try this" and give a folder structure: Folder1 track1.py data1.txt data2.txt data3.txt Folder2 track1.py dset1.txt dset2.txt ... dset8.txt but then when you send a copy of the actual code you are running, it is called "ReportingToolAwww.py" and it is 417 lines long. What happened to track1.py? What is in that? Does track1.py reproduce the fault? Yes, it's a lot easier to type track than the above. I invented fictitious names for the above to simplify it all. The program does indeed work on track data for meteor trails. There are five possible faults: 1 A problem in your Python code. 2 A serious bug in Python itself. 3 A serious bug in Windows file system. 4 Disk corruption making Windows confused. 5 A PEBCAK problem. I'd vote for a W7 problem. I think I mentioned that W7 will not even allow me to find all files in a folder with track in them. It's possible the new filter concept for files is at work. I can confirm that ReportingToolAwww.py doesn't seem to contain any "funny" path manipulations that would cause the problem: it simply calls open on relative path names, which will open files in the current directory. The problem does NOT appear to be in your Python code. Good. A serious bug in either Python or Windows is very unlikely. Not impossible, but unless somebody else reports that they too have seen the fault, we can dismiss them. See above about W7. Disk corruption is possible. If all else fails, you can run the Windows disk utility to see if it finds anything. Beats me. But the most likely cause of the fault is that you aren't running what you think you are running. When you say: "If I've created a shortcut, it wasn't by design. Ctrl-c to ctrl-v most likely." "Most likely"? Meaning you're not sure? Meaning I agree with you that it was not a use of ctrl-c/v. I offered the other only possibilities I know of. That's for programs likeWord. Given that you are talking about the Properties window talking about "pointing to" things, I think it is very likely that in fact you have created a shortcut, or a symlink, and when you think you are running a copy in Folder2 you are actually running a shortcut to Folder1. That would *exactly* explain the problem you are experiencing. Please take a screenshot of the Properties window showing the "pointing to" stuff. I think you will find that track1.py in Folder2 is a shortcut back to track1.py in Folder1. OK, I'll do that with SnagIt, and attach it. If it's too big, it will not make it on the list, but will make it to you.Geeze, I can't even do that. I had contacted HP tech support (1 year of free support), and went through this with a tech guy week ago. I gave him control of the machine, and he started messing with the py file.I stopped him before he changed anything, but copied the file somewhere, and renamed it, so he could do what he thought needed to be done. The "link" points to itself. I'm afraid after a week of dealing with this the trail is dead. Chalk it up to a mistake on my part if you will. I'm done. If somehow this magically revives itself in the next few days, I'll respond. It's time to move this program ahead to completion. (For the record, Windows does in fact have symlinks, as well as hard links and a third type of link called junction points. They are undersupported by Explorer, and so people hardly every use them. Most people don't even know they exist, even though some of them go back all the way to Windows NT. But as far as I can tell, there is no way for you to have created a symlink from Explorer.) So noted. The last time I had anything to do with the more esoteric links is a decade ago when I worked with Linux. -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Verifying My Troublesome Linkage Claim between Python and Win7
Hang in there. My story about HP tech support took me a bit off course. I think I can provide a meaningful description from the stand point of the properties of each py file. I want to look at this carefully. -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Verifying My Troublesome Linkage Claim between Python and Win7
I just posted the details a moment ago to Steven. On 2/28/2010 3:46 AM, Dave Angel wrote: Wayne Watson wrote: You tell us to "try this" and give a folder structure: Folder1 track1.py data1.txt data2.txt data3.txt Folder2 track1.py dset1.txt dset2.txt ... dset8.txt Maybe one simple test at a time will get better responses. Since you wouldn't tell me what tabs you saw in Explorer when you did properties, maybe you'll tell me what you see in CMD. Go to a cmd prompt (DOS prompt), change to the Folder2 directory, and type dir. paste that result, all of it, into a message. I suspect you'll see that you don't have track1.py there at all, but track1.py.lnk If so, that's a shortcut. The only relevant change in Win7 that I know of is that Explorer shows shortcuts as "link" rather than "shortcut." -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet Stop the illegal killing of dolphins and porpoises. <http://www.takepart.com/thecove> Wrest the control of the world's fisheries from Japan. Web Page: ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Why is the max size so low in this mail list?
See Subject. 40K here, but other Python lists allow for larger (total) sizes. -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet Stop the illegal killing of dolphins and porpoises. <http://www.takepart.com/thecove> Wrest the control of the world's fisheries from Japan. Web Page: ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Verifying My Troublesome ...+My Final Word
For me, I'm done. I plumbed this issue elsewhere and the final message there stated this. "I've no time to verify your specific claim and have no readily available proof for mine [his claim], but I've seen similar issues on Win7." Let MS deal with it. Anyway, thanks for your effort. -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet Stop the illegal killing of dolphins and porpoises. <http://www.takepart.com/thecove> Wrest the control of the world's fisheries from Japan. Web Page: ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Understanding (Complex) Modules
First a little preamble before my questions. Most of my work in Python has required modifying a program that uses modules that were imported by the original program. I've made some use of modules on a command line like math, and have used the idea of a qualifier. On occasion, I've used examples from matplotlib that required from matplotlib.image import AxesImage. Further, I've created some simple classes, and produced objects with them. No use of inheritance though. So far so good. In a few places, it is said modules are objects. I'm slightly puzzled by that, but in some way it seems reasonable from the standpoint of period notation. So far I have not created a module. In Lutz's and Ascher's Learning Python, ed. 2, chap. 16, they describe the following example, among others: module2.py as print "starting to load ..." import sys def func(): pass class klass: pass print "done loading." Their description of its use is quite readable. It shows that there is some more to a module than a list of defs, for example. Here comes the questions. Recently I began to use matplotlib, scipy, and pylab, mostly matplotlib. I've ground out a few useful pieces of code, but I'm fairly baffled by the imports required to get at various elements, of say, matplotlib (MPL). Some of the MPL examples use of imports make sense, but how the writer pulled in the necessary elements is not. How does one go about understanding the capabilities of such modules? MPL seems to have a lot of lower level components. Some of them are laid out over numerous pages as in the form of a, say, English language, description. How does one decipher this stuff. For example, open the module in an editor and start looking at the organization? I thinkthe so called MPL guide ins 900 pages long. Even the numpy guide (reference?), I believe borders on 1000 pages. There must be some way to untangle these complex modules, I would think. Some of the tutorials seem nothing more than a template to follow for a particular problem. So far, looking at the plentiful number of examples of MPL, and probably some of the other modules mentioned above have not provided a lot of insight. Is there some relationship between modules and objects that I'm not seeing that could be of value? -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet Stop the illegal killing of dolphins and porpoises. <http://www.takepart.com/thecove> Wrest the control of the world's fisheries from Japan. Web Page: ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Understanding (Complex) Modules
(I meant to post this to both the list and Steven back a week or so ago. I missed the list, so am posting it here now. Unfortunately, I'm again in a position where I cannot respond for several days, but I will be back early next week to examine some posts that followed this.) === Thanks. I'm on the road for a few days and will be able to read this more carefully when I get back. I had a feeling from my first attempts of looking at MPL and other heavy-duty libs that it was going to require work to dig out what I needed from the module itself. In my personal view, the usage and learning documents are fairly limiting. Perhaps on in MPL, which is less traditional than numpy and the others, which are founded on common and historic implementations of math and science from older languages. From: Steven D'Aprano To: tutor@python.org Sent: Thu, March 4, 2010 6:24:15 PM Subject: Re: [Tutor] Understanding (Complex) Modules On Thu, 4 Mar 2010 12:24:35 pm Wayne Watson wrote: > First a little preamble before my questions. > > Most of my work in Python has required modifying a program that uses > modules that were imported by the original program. I've made some > use of modules on a command line like math, and have used the idea of > a qualifier. On occasion, I've used examples from matplotlib that > required from matplotlib.image import AxesImage. Further, I've > created some simple classes, and produced objects with them. No use > of inheritance though. So far so good. In a few places, it is said > modules are objects. I'm slightly puzzled by that, but in some way it > seems reasonable from the standpoint of period notation. So far I > have not created a module. Yes you have, you just don't know it. In simple language, a file with Python-usable code in it is a module. There are some technicalities and complexities, but in basic terms, that's all it is. Technically, "module" refers only to the object which exists inside the Python environment after you call "import thing". The import statement does a whole lot of tricks, but in a nutshell it: * finds a file containing code called 'thing' * loads it into memory, executing code as needed * creates a 'module' object to store the code and data in the file * and makes it available to your code Python can create module objects from: compiled Windows DLLs .dll compiled Linux object files .so Python source code .py Python byte code .pyc and .pyo (and .pyw on Windows) Zip files containing any of the above and probably other things as well, but they're the main ones. So any Python file you create (any .py file) is a module, or at least it would be a module if you import it. Ignoring all the various compiled files (.dll, .so, etc) what happens when you run a .py file from the command line (or from IDLE or another IDE). E.g. you type something like: python.exe myscript.py [enter] Python reads the file myscript.py and executes it, but no module object is created. It is possible that a module object *is* created, for internal use, then thrown away when the script is finished. But your script doesn't see the module object. However, if you enter the Python interactive environment, and do this: >>> import myscript # no .py Python loads the file myscript.py into a module object, executing any code in it, and makes it available as a module. > Here comes the questions. Recently I began to use matplotlib, scipy, > and pylab, mostly matplotlib. I've ground out a few useful pieces of > code, but I'm fairly baffled by the imports required to get at > various elements, of say, matplotlib (MPL). Some of the MPL examples > use of imports make sense, but how the writer pulled in the necessary > elements is not. How does one go about understanding the > capabilities of such modules? Time, experience, and a lot of hard work. Welcome to programming! If the documentation is good, then read the documentation. If the documentation is lacking, or bad, or even wrong, then read the source code, or search the Internet for a tutorial, or buy a book about it (the numpy people, for example, sell books about numpy). Python makes experimentation easy: there are a lot of powerful introspection facilities in Python. The interactive interpreter is your best friend. You will live with it, eat with it, sleep with it, take it on double-dates, and throw yourself on live grenades to protect it. Whenever I'm programming, I almost always have three or five interactive sessions open for experimentation. The dir() and help() functions are also good friends. In an interactive session: import math dir(math) # prints a list of names in the math module help(math.sin) help(math) Don't feel that you have to understand the entire module before you use
[Tutor] Press Enter to quit. Silently maybe.
I use this code to quit a completed program. If no is selected for the yes/no prompt, warning messages appear in the shell window. I'm executing from IDLE. Is there a way to just return to the >>> prompt there? def finish(): print; print "Bye" print raw_input('Press Enter to quit') sys.exit() -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet Stop the illegal killing of dolphins and porpoises. <http://www.takepart.com/thecove> Wrest the control of the world's fisheries from Japan. Web Page: ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Press Enter to quit. Silently maybe.
Win 7. Some time ago, I believe under Tutor, it was suggested when quitting to move the method I described. Ah, I see what happened! I had used this in something of an earlier incarnation of the program when some tkinter code was in use. There was a loop in the code, and the quit code used there crept into the finish here. Yes, no need to fiddle with the finish. Just let it reach the end. On 3/23/2010 3:08 PM, Steven D'Aprano wrote: On Wed, 24 Mar 2010 07:47:40 am Wayne Watson wrote: I use this code to quit a completed program. What on earth for? If the program is complete, just quit. In my opinion, there is very little worse than setting up a chain of long-running programs to run overnight, then coming back in the morning expecting that they will all be finished only to discover that one of those programs is stupidly sitting them with a "Press any key to quit" message, stopping all the rest from running. In my opinion, such behaviour should be a shooting offense. *wink* If no is selected for the yes/no prompt, warning messages appear in the shell window. I'm executing from IDLE. Is there a way to just return to the>>> prompt there? def finish(): print; print "Bye" print raw_input('Press Enter to quit') sys.exit() What yes/no prompt? How do you select No? -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet Stop the illegal killing of dolphins and porpoises. <http://www.takepart.com/thecove> Wrest the control of the world's fisheries from Japan. Web Page: ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Why this Difference in Importing NumPy 1.2 vs 1.4?
I wrote a program in Python 2.5 under Win7 and it runs fine using Numpy 1.2 , but not on a colleague's machine who has a slightly newer 2.5. We both use IDLE to execute the program. During import he gets this: >>> Traceback (most recent call last): File "C:\Documents and Settings\HP_Administrator.DavesDesktop\My Documents\Astro\Meteors\NC-FireballReport.py", line 38, in from scipy import stats as stats # scoreatpercentile File "C:\Python25\lib\site-packages\scipy\stats\__init__.py", line 7, in from stats import * File "C:\Python25\lib\site-packages\scipy\stats\stats.py", line 191, in import scipy.special as special File "C:\Python25\lib\site-packages\scipy\special\__init__.py", line 22, in from numpy.testing import NumpyTest ImportError: cannot import name NumpyTest >>> Comments? -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet Poisoned Shipments. Serious illegal waste dumping may be occuring in the Meditrainean. Radioactive material, mercury, biohazards. -- Sci Am Mag, Feb., 2010, p14f. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Finding the version # of a module, and py module problem
It's been awhile since I've used python, and I recall there is a way to find the version number from the IDLE command line prompt. dir, help, __version.__? I made the most minimal change to a program, and it works for me, but not my partner. He gets Traceback (most recent call last): File "C:\Documents and Settings\HP_Administrator.DavesDesktop\Desktop\NC-FireballReport20100729.py", line 40, in from scipy import stats as stats # scoreatpercentile File "C:\Python25\lib\site-packages\scipy\stats\__init__.py", line 7, in from stats import * File "C:\Python25\lib\site-packages\scipy\stats\stats.py", line 191, in import scipy.special as special File "C:\Python25\lib\site-packages\scipy\special\__init__.py", line 22, in from numpy.testing import NumpyTest ImportError: cannot import name NumpyTest Here are the first few lines of code. import sys, os, glob import string from numpy import * from datetime import datetime, timedelta import time from scipy import stats as stats # scoreatpercentile I'm pretty sure he has the same version of Python, 2.5, but perhaps not the numpy or scipy modules. I need to find out his version numbers. -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet "Republicans are always complaining that government is out of control. If they get into power, they will prove it." -- R. J. Rourke Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Finding the version # of a module, and py module problem
I should have mentioned I use windows. import numpy numpy.__version__ It's now written in my Py book! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Distributing Python Code for Commercial Porpoises?
Yes, porpoises was a (old) pun. Back in Feb. I raised a question related to Subject. I just wanted to know if Python code could be compiled in some sense. Robert Berman pitched in with some help. Although I was making progress, I put it off for a future date. I really don't want to get into py2exe here, but am wondering if there are Python vendors who in some way sell their product in compiled form? My intent though is really not to produce a commercial product. My question relates to difficulty my partner and I have to exchanging py programs w/o him stumbling. I send him a py program written using Windows Python 2.5. He has the same. I've executed it IDLE and it works fine. He executes, and it squawks per my post here on finding a version #, showing his output. We need to make sure we are on the same playing ground with numpy and scipy. I don't think we are. He barely knows Python, but did, supposedly, a install of it, numpy and scipy from the same written direction I use. I think he mistakenly installed a different version of numpy. So how can we make sure we or anyone are on the same playing field? Perhaps we should resort to command like execution. I am not confident that using py2exe will solve this problem. Is there a Python tool that provides some thorough description of a Python installation? -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet "An experiment is a question which science poses to Nature, and a measurement is the recording of Nature’s answer." -- Max Planck Web Page: ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Distributing Python Code for Commercial Porpoises?
Thanks, but my partner has enough difficulty with a simple Python install, let alone VM or anything beyond Windows. On 8/6/2010 11:42 AM, Chris Fuller wrote: It sounds like maybe you could use Enthought Python, which is a bundle of most of the popular numerical libraries by the scipy sponsors. Not free, however, there's a trial version. http://enthought.com/products/epd.php The problem of bundling stuff is a real thorny one and has been beaten to death many times in this list and elsewhere. It really doesn't solve the problem, anyway, if you want your friend to be able to play with and rerun the code. Another idea is to make a virtual machine that you can duplicate or even mail back and forth with just the stuff required. Then you'd need an OS license for it (or use a minimal Linux, like Arch or DSL, but you probably want to stick to the Windows platform, I'd guess.) Cheers On Friday 06 August 2010, Wayne Watson wrote: Yes, porpoises was a (old) pun. Back in Feb. I raised a question related to Subject. I just wanted to know if Python code could be compiled in some sense. Robert Berman pitched in with some help. Although I was making progress, I put it off for a future date. I really don't want to get into py2exe here, but am wondering if there are Python vendors who in some way sell their product in compiled form? My intent though is really not to produce a commercial product. My question relates to difficulty my partner and I have to exchanging py programs w/o him stumbling. I send him a py program written using Windows Python 2.5. He has the same. I've executed it IDLE and it works fine. He executes, and it squawks per my post here on finding a version #, showing his output. We need to make sure we are on the same playing ground with numpy and scipy. I don't think we are. He barely knows Python, but did, supposedly, a install of it, numpy and scipy from the same written direction I use. I think he mistakenly installed a different version of numpy. So how can we make sure we or anyone are on the same playing field? Perhaps we should resort to command like execution. I am not confident that using py2exe will solve this problem. Is there a Python tool that provides some thorough description of a Python installation? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet "An experiment is a question which science poses to Nature, and a measurement is the recording of Nature’s answer." -- Max Planck Web Page: ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Distributing Python Code for Commercial Porpoises?
Yes, that might work, but it gets into other issues that I would rather avoid. I hope I mentioned in my original msg that this is a Windows envirnoment. I don't know much about dsutils, but it might work for these situations. Just enough to mention it seems like it package an environment. An easy way out might be to ask him to uninstall Python and any modules like numpy. I'm not even sure how to do that. I don't think there's an uninstaller for all the Python stuff, so it's probably a matter of simply uninstalling Py 2.5 via MS control panel, and then directly deleting the modules like numpy and scipy. After that, he should be able to follow the instructions written by the sponsor. On 8/6/2010 2:18 PM, Emile van Sebille wrote: On 8/6/2010 10:51 AM Wayne Watson said... Yes, porpoises was a (old) pun. Back in Feb. I raised a question related to Subject. I just wanted to know if Python code could be compiled in some sense. Robert Berman pitched in with some help. Although I was making progress, I put it off for a future date. I really don't want to get into py2exe here, but am wondering if there are Python vendors who in some way sell their product in compiled form? I think you're making it harder. Go to your partners site, build an appropriate base environment, document and leave instructions on where to put new *.py modules you send him, run through it, and you're done. A little education will likely go a lot further than delving deeper into heavier technologies in an attempt to 'simplfy'. HTH, Emile ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet "An experiment is a question which science poses to Nature, and a measurement is the recording of Nature’s answer." -- Max Planck Web Page: ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Distributing Python Code for Commercial Porpoises?
Solved the version question with the other thread two days ago. On 8/6/2010 8:38 PM, Che M wrote: > #, showing his output. We need to make sure we are on the same playing > ground with numpy and scipy. I don't think we are. He barely knows > Python, but did, supposedly, a install of it, numpy and scipy from the > same written direction I use. I think he mistakenly installed a > different version of numpy. So how can we make sure we or anyone are on > the same playing field? Both of you do this from IDLE: import numpy help(numpy) Read the version # at the end. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet "An experiment is a question which science poses to Nature, and a measurement is the recording of Nature’s answer." -- Max Planck Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Distributing Python Code for Commercial Porpoises?
Actually, I arranged to have them on my Yahoo Group. He seemed to ignore that, so I gave him very specific instructions, including a snaphot with an arrow pointing to one of the files, to download. It's the one that seems to be troublesome Numpy. So instead he downloads another one. There's only so much I can do. I don't plan to dwell on this problem very long. I may not offer any other help on this subject. Although, if the 40 or 50 years of the sponsor's app we all use want to use my programs, I dread the thought of this non-Python savvy sites dealing with issues like this. All have at least gotten the sponsors app working except one. I finally called him and guided him through the process. He barely understood Window, let alone how to install the app. He's now working with it. On 8/6/2010 8:14 PM, j ram wrote: My intent though is really not to produce a commercial product. My question relates to difficulty my partner and I have to exchanging py programs w/o him stumbling. I send him a py program written using Windows Python 2.5. He has the same. I've executed it IDLE and it works fine. He executes, and it squawks per my post here on finding a version #, showing his output. We need to make sure we are on the same playing ground with numpy and scipy. Why not try bundling your .py modules in a zip file and then importing the run modules from this zip file? In that way, the package integrity is ensured. You'd just have to ship your collaborator the zip archive and also make sure that both of you are running the same versions of numpy, scipy, python and other packages. http://docs.python.org/library/zipimport.html http://www.doughellmann.com/PyMOTW/zipimport/ Regards, Iyer ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet "An experiment is a question which science poses to Nature, and a measurement is the recording of Nature’s answer." -- Max Planck Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Distributing Python Code for Commercial Porpoises?
(I cancelled the post, since the file was 120K, and unacceptable. It's now 27K, so everyone should see it, but the print might be a bit tiny.) Sounds like a plan. I'll give it a go. For what it's worth, our sponsor has suggested it was the way to go, i.e., use IDLE to execute it, his large app. Over the last 24 months though I've discovered our sponsor, while able to produce good python code, is not real deep in understanding the Python world, environment. Worse they decided to improve the app Actually, I stumbled across the code you mention below to reveal version and dependencies. I may have it operational soon. OK, I just ran it with the double click method, and am attaching a snapshot of what I got. I was unable to copy it from the command window. I think I can fix that, but it would just take too much time now. In the event the attachment doesn't get to you or not posted, the program generated warning messages about NumpyTest().test, but opened cleanly with a prompt. The code I posted in the other thread results in a similar result, but the program dies immediately. The output also shows NumpyTest will be removed in the next release (of Numpy?), and that may be where my partner went wrong. I'm pretty sure he jumped ahead of my versions despite my cautions. On 8/6/2010 5:18 PM, Alan Gauld wrote: "Wayne Watson" wrote programs w/o him stumbling. I send him a py program written using Windows Python 2.5. He has the same. I've executed it IDLE and it works fine. He executes, and it squawks IDLE is a development environment. Never, ever test final code in a development environment, test it as it should be run. Double click the file in explorer. Better still install a separate copy wherever the file will go on the target system - usually somewhere different to where you develop it - and run it there. same written direction I use. I think he mistakenly installed a different version of numpy. So how can we make sure we or anyone are on the same playing field? Perhaps we should resort to command like execution. You should definitely not run it from IDLE, that's inefficient and likely to hide errors. Run it from a command prompt or by double clicking in explorer, or create a shortcut on the desktop. To check the versions of your packages you could write a short test program that simply imports all needed modules and prints out the version info (if available) and file details xxx.__file__ You could even use the __file__ info to check the size of the files by using the os module functions. Is there a Python tool that provides some thorough description of a Python installation? I'm not aware of such but it should not be hard to check the basics. One of the best thins about Python is the high level of portability of programs across versions and OS. Its most likely a location or PATH setting HTH, -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet "An experiment is a question which science poses to Nature, and a measurement is the recording of Nature’s answer." -- Max Planck Web Page: <>___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Distributing Python Code for Commercial Porpoises?
Thanks. Looks interesting. On 8/7/2010 1:25 PM, Wayne Werner wrote: I just noticed this thread - if you want a great version of python that has numpy/scipy so you can be sure to have the same version, use Python XY: http://www.pythonxy.com/ It's got a host of scientific packages such as matplotlib, numpy, and scipy. Then it has all sorts of other bells and whistles, as well. HTH, Wayne -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet "An experiment is a question which science poses to Nature, and a measurement is the recording of Nature’s answer." -- Max Planck Web Page: ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Distributing Python Code for Commercial Porpoises?
I think I'll print this and paste into the inside cover of my Python book. :-) I find it interesting that any Python book I've seen doesn't deal with distributing programs in some form or another. On 8/7/2010 3:33 PM, Alan Gauld wrote: "Emile van Sebille" wrote As others have mentioned, don't use idle as you're doing. Give pythonwin (included with the activestate distribution) a try. Or try one of the free versions of Komodo or Wing. In fact I'd strongly recommend not to use ANY development tool to run your programs. These tools are designed to make life easy while writing code, they are not intended to be used to execute final code. They trap errors, they redirect output, they ignore signals and all manner of things intended to prevent you from having to restart your development tool while developing. But those traps are hiding errors that will crop up in the real world. Always test deployable code in a real, native execution environment - outside the development tool and outside the development folder structure too. Include the installation process (whether automated or manual) in your test. -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet "An experiment is a question which science poses to Nature, and a measurement is the recording of Nature’s answer." -- Max Planck Web Page: ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Moving from Python 2.5.4 to 2.5.2?
My partner got ahead of the game last year, and installed 2.5.4, which confounds matters when the other four participants when sharing some python programs under Win XP. My guess is that if he uses control panel add/remove for py 2.5.4, he can then successfully install 2.5.2 w/o messing up any programs I've sent him. I'm presuming he did not put them under c:\Python. -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet "An experiment is a question which science poses to Nature, and a measurement is the recording of Nature’s answer." -- Max Planck Web Page: ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Moving from Python 2.5.4 to 2.5.2?
The question is would going back likely cause problems? I'm dealing with neophytes. He's messed up before. On 8/16/2010 8:58 AM, Luke Paireepinart wrote: On Mon, Aug 16, 2010 at 10:39 AM, Wayne Watson wrote: My partner got ahead of the game last year, and installed 2.5.4, which confounds matters when the other four participants when sharing some python programs under Win XP. My guess is that if he uses control panel add/remove for py 2.5.4, he can then successfully install 2.5.2 w/o messing up any programs I've sent him. I'm presuming he did not put them under c:\Python. Is this a question or a statement? Not really sure what you're looking to get out of this. Why would 2.5.4 cause issues with 2.5.2? Why don't you all just upgrade to 2.5.4? -Luke -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet "An experiment is a question which science poses to Nature, and a measurement is the recording of Nature’s answer." -- Max Planck Web Page: ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Moving from Python 2.5.4 to 2.5.2?
I guess it's a matter of bookkeeping. I don't need the extra hassle dealing with one of them. I'll just let it go at 2.5.x On 8/16/2010 2:41 PM, Luke Paireepinart wrote: The core issue here is: are there actually issues exacerbated by the difference in Python versions? If so, which issues? There shouldn't be hardly any reason to force you all to maintain the exact same python version, especially if you're in the same sub-version (2.5) On Mon, Aug 16, 2010 at 3:57 PM, Wayne Watson wrote: The question is would going back likely cause problems? I'm dealing with neophytes. He's messed up before. On 8/16/2010 8:58 AM, Luke Paireepinart wrote: On Mon, Aug 16, 2010 at 10:39 AM, Wayne Watson wrote: My partner got ahead of the game last year, and installed 2.5.4, which confounds matters when the other four participants when sharing some python programs under Win XP. My guess is that if he uses control panel add/remove for py 2.5.4, he can then successfully install 2.5.2 w/o messing up any programs I've sent him. I'm presuming he did not put them under c:\Python. Is this a question or a statement? Not really sure what you're looking to get out of this. Why would 2.5.4 cause issues with 2.5.2? Why don't you all just upgrade to 2.5.4? -Luke -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet "An experiment is a question which science poses to Nature, and a measurement is the recording of Nature’s answer." -- Max Planck Web Page: -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet "An experiment is a question which science poses to Nature, and a measurement is the recording of Nature’s answer." -- Max Planck Web Page: ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Moving from Python 2.5.4 to 2.5.2?
No question about that. For the record, I'm not going to ask him to change based on the answers here. On 8/16/2010 5:14 PM, Steven D'Aprano wrote: On Tue, 17 Aug 2010 06:57:37 am Wayne Watson wrote: The question is would going back likely cause problems? I'm dealing with neophytes. He's messed up before. There shouldn't be any differences you're likely to care about between 2.5.2 and 2.5.4, but if there is, your best approach is for you to upgrade to 2.5.4 rather than trying to get the neophyte to downgrade to 2.5.2. -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet "An experiment is a question which science poses to Nature, and a measurement is the recording of Nature’s answer." -- Max Planck Web Page: ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] IDLE vs PythonWin
Title: Signature.html You must be up 24/7! When I open a py file with pythonwin, it brings up the dialog and in its window, there are two windows. One is called interactive window (IW), and the other (script window--SW) contains the program py code. To execute it, I press the little running icon or F5 and two printed lines appear, as they should, in the IW. If I remove the SW, how do I run it in another "editor", vi, vim, emacs, notebook, ... whatever, and see the output in the IW? ALAN GAULD wrote: > Yes, but how do you debug the code interactively when you have > the editor outside pythonwin? Do you copy it into the pythonwin editor? Do you mean using the Python debugger? If I need to do that I will either use the command line debugger (pdb) inside the shell window or close the vim session and start pythonwin (or Eclipse which has a really good debugger!) But in 10 years of using Python I've only resorted to the debugger maybe a dozen times in total. Usually a few print statements and a session with the >>> prompt is adequate to find any bugs. The best debugging tools are your eyes! Remember too that you can always import the module into the shell window if you need to test specific functions in isolation. Alan G. ALAN GAULD wrote: The point wasn't about vim per se - that just happens to be my favourite editor - but really about the way of working with 3 separate windows. Really it was just to show that you don't necessarily need to use an all-in-one IDE like Pythonwin or IDLE, -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) The Richard Feynman Problem-Solving Algorithm: (1) write down the problem; (2) think very hard; (3) write down the answer. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] apply() after class?
Title: Signature.html Ah, ha. Good old polymorphism (from my long gone C++ days). Back to the book, old Lutz. I'll try the print. Thanks. I'll check out tkSimpleDialog's description in one of the several pdfs I have on Tk. Alan Gauld wrote: "Wayne Watson" wrote Ah, another function without a link to a use. body, as in : class SetDecoderDialog(tkSimpleDialog.Dialog): def body(self,master): self.title("Set Video Decoder Register") Label(master, text='Register:').grid(row=0, sticky=W) Label(master, text='New Value:').grid(row=1, sticky=W) self.reg = Entry(master, width=10) self.val = Entry(master, width=10) self.reg.grid(row=0, column=1, sticky=W) self.val.grid(row=1, column=1, sticky=W) return self.reg def apply(self): reg = eval(self.reg.get()) val = eval(self.val.get()) self.gui.SetDecoder( reg, val ) That's the end of the class. Is there something going on here between body-apply and tkSimpleDialog? Making them available to it? Yes. This is part of the power of OOP. If we create an instance of this class it inherits all of the methods of simpleDialog. But if one of those methods internally calls self.body or self.apply it will for this instance execute SetDecoderDialog.body or SetDecoderDialog.apply This is a form of polymorphism which is commonly used in object frameworks. Now I don't know whether SimpleDialog does do that but it is entirely possible. Thus it would not seem like anything is calling those two functions but in fact they are being called indirectly. (A couple of print statements would show whether they were or not!) HTH, -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) The Richard Feynman Problem-Solving Algorithm: (1) write down the problem; (2) think very hard; (3) write down the answer. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Tkinter program start with focus?`
Title: Signature.html I have no idea, but I'm going to take a guess based on what you said that helped me understand code someone else wrote. See Chapter 9 of Lundh's An Intro to TkInter. TkSimpleDialog. WW W W wrote: Hi, I'm running into a problem that's bugging me because I know a program used it, I just can't find which one it was... I want my Tkinter program to start with the focus, but I can't remember the command. TIA, Wayne -- To be considered stupid and to be told so is more painful than being called gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness, every vice, has found its defenders, its rhetoric, its ennoblement and exaltation, but stupidity hasn't. - Primo Levi ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) The Richard Feynman Problem-Solving Algorithm: (1) write down the problem; (2) think very hard; (3) write down the answer. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] IDLE vs PythonWin
Thanks, but I think I'll keep my IDLE training wheels on for awhile yet. ALAN GAULD wrote: I have 3 windows open. An editor A Python shell An OS console The editor is used to edit the code The python shell for interactive experiments and tests The console for running the program Thus I save the file in the editor, alt-tab to the console and type python myscript.py to run it. (In practice, apart from the first time, I hit up-arrow; return, to run it.) In fact I could run the script from within vim or Scite since they both have the ability to run external commands from within the editor, but I prefer to have a eparate window where I can refer to the output of previous runs by scrolling back. Alan Gauld Author of the Learn To Program website http://www.alan-g.me.uk/ From: Wayne Watson To: ALAN GAULD Sent: Tuesday, 10 February, 2009 1:09:13 AM Subject: Re: [Tutor] IDLE vs PythonWin You must be up 24/7! When I open a py file with pythonwin, it brings up the dialog and in its window, there are two windows. One is called interactive window (IW), and the other (script window--SW) contains the program py code. To execute it, I press the little running icon or F5 and two printed lines appear, as they should, in the IW. If I remove the SW, how do I run it in another "editor", vi, vim, emacs, notebook, ... whatever, and see the output in the IW? ALAN GAULD wrote: > Yes, but how do you debug the code interactively when you have > the editor outside pythonwin? Do you copy it into the pythonwin editor? Do you mean using the Python debugger? If I need to do that I will either use the command line debugger (pdb) inside the shell window or close the vim session and start pythonwin (or Eclipse which has a really good debugger!) But in 10 years of using Python I've only resorted to the debugger maybe a dozen times in total. Usually a few print statements and a session with the >>> prompt is adequate to find any bugs. The best debugging tools are your eyes! Remember too that you can always import the module into the shell window if you need to test specific functions in isolation. Alan G. ALAN GAULD wrote: The point wasn't about vim per se - that just happens to be my favourite editor - but really about the way of working with 3 separate windows. Really it was just to show that you don't necessarily need to use an all-in-one IDE like Pythonwin or IDLE, -- Signature.html Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) The Richard Feynman Problem-Solving Algorithm: (1) write down the problem; (2) think very hard; (3) write down the answer. Web Page: <www.speckledwithstars.net/> -- Signature.html Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) The Richard Feynman Problem-Solving Algorithm: (1) write down the problem; (2) think very hard; (3) write down the answer. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Reply All Dilemma of This List
Title: Signature.html I belong to many, many forums, Yahoo Groups, (Usenet) newsgroups, and mail lists. Probably 100 or more. I think it's fair to say that none of them but this one has an implicit "Reply All". For newsgroups and mail lists, I just press my Mozilla Seamonkey mailer Reply button and the resulting message is ready to be seen by everyone, a single address. Here a Reply goes only to the poster, none to Tutor. Elsewhere, for e-mail-like posts, if I really want to make a special effort to single out the poster too, "Reply All" works to additionally get it directly to them (actually they'd get two messages directly) and the entire list. For YGs and forums, the "Reply All" is implicit in a response. Since this group, in my world, is unique in these matters, I'll just offer the following header for a mail list I belong to, the ASTC, for someone's consideration. I suppose that someone might be whoever created this mail list. It' definitely different than used here, and no one uses "Reply All" to my knowledge. Maybe they can figure out if it has applicability here. -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) The Richard Feynman Problem-Solving Algorithm: (1) write down the problem; (2) think very hard; (3) write down the answer. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Reply All Dilemma of This List
Title: Signature.html Oh, I realize that chances are slim to do anything about it. So how did this list get started? How old is it? Fortunately, there are other choices, which I can make, if re-posting to Tutor becomes too often or long delayed by my cranky mouse use. ;-) Two lists anyone? :-) Martin Walsh wrote: Wayne Watson wrote: I belong to many, many forums, Yahoo Groups, (Usenet) newsgroups, and mail lists. Probably 100 or more. I think it's fair to say that none of them but this one has an implicit "Reply All". For newsgroups and mail lists, I just press my Mozilla Seamonkey mailer Reply button and the resulting message is ready to be seen by everyone, a single address. Here a Reply goes only to the poster, none to Tutor. Elsewhere, for e-mail-like posts, if I really want to make a special effort to single out the poster too, "Reply All" works to additionally get it directly to them (actually they'd get two messages directly) and the entire list. For YGs and forums, the "Reply All" is implicit in a response. Since this group, in my world, is unique in these matters, I'll just offer the following header for a mail list I belong to, the ASTC, for someone's consideration. I suppose that someone might be whoever created this mail list. It' definitely different than used here, and no one uses "Reply All" to my knowledge. Maybe they can figure out if it has applicability here. This is a contentious topic which comes up at least once a year on this list. A search of the archives will turn up some interesting debate, most likely. FWIW, I like the behavior of this list as opposed to others. You may find these additional references illuminating ... you may not. http://effbot.org/pyfaq/tutor-why-do-my-replies-go-to-the-person-who-sent-the-message-and-not-to-the-list.htm http://woozle.org/~neale/papers/reply-to-still-harmful.html HTH, Marty ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) The Richard Feynman Problem-Solving Algorithm: (1) write down the problem; (2) think very hard; (3) write down the answer. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] IDLE/phythonWin -- Who's On First? (Abbott and Costello)
Title: Signature.html My program in IDLE bombed with: == Exception in Tkinter callback Traceback (most recent call last): File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in __call__ return self.func(*args) File "C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py", line 552, in OperationalSettings dialog = OperationalSettingsDialog( self.master, set_loc_dict ) File "C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py", line 81, in __init__ tkSimpleDialog.Dialog.__init__(self, parent) File "C:\Python25\lib\lib-tk\tkSimpleDialog.py", line 69, in __init__ self.wait_visibility() # window needs to be visible for the grab File "C:\Python25\lib\lib-tk\Tkinter.py", line 415, in wait_visibility self.tk.call('tkwait', 'visibility', window._w) TclError: window ".34672232" was deleted before its visibility changed === But runs fine in pythonWin performing the same entry operation. Open a menu, select an item to open a dialog, select the same button in the dialog, press OK to leave the dialog. Boom, as above. (This does not mean pythonWin doesn't have problems of its own. ) If I just execute the code, the console shows no problems. IDLE is unhappy. -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) The Richard Feynman Problem-Solving Algorithm: (1) write down the problem; (2) think very hard; (3) write down the answer. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] IDLE/phythonWin -- Who's On First? (Abbott and Costello)
Title: Signature.html I ran it w/o using either IDLE/pyWin, and it worked without any messages, as shown by the console window. Isn't this the same as using the console? Outside of the two, my guess is that some subtle was made to the code, accidentally, and one tolerates it and the other doesn't. I'm going to do a WinMerge compare between the current py and a slightly older one. Alan Gauld wrote: "Wayne Watson" wrote Signature.htmlMy program in IDLE bombed with: == Exception in Tkinter callback Traceback (most recent call last): dialog = OperationalSettingsDialog( self.master, set_loc_dict ) tkSimpleDialog.Dialog.__init__(self, parent) self.wait_visibility() # window needs to be visible for the grab But runs fine in pythonWin performing the same entry operation. Lets eliminate some variables by avoiding any IDEs. Does it work OK when run from a DOS console? Or if you just double click the file in Windows explorer? If it does that means its some kind of interaction between the program and IDLE. This is not unusual since IDLE is itself a Tkinter program and although recent versions are much better behaved with Tkinter it can still cause some strangeness. If you still get an error running outside the IDE then we can analyze it more closely. For that we will need the code, at least the function that calls the dialog. And if its a subclass the dialog class too. -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) The Richard Feynman Problem-Solving Algorithm: (1) write down the problem; (2) think very hard; (3) write down the answer. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] IDLE/phythonWin -- Who's On First? (Abbott and Costello)
Title: Signature.html Using WinMerge, I found a difference between the two that shouldn't have been, but it didn't solve the problem. dialog.rateVar.get() versus dialog.rateVar.get There was another like it with get(), but it wouldn't have been executed in my test run. I suspect something else like that lurks in the code. Wayne Watson wrote: I ran it w/o using either IDLE/pyWin, and it worked without any messages, as shown by the console window. Isn't this the same as using the console? Outside of the two, my guess is that some subtle was made to the code, accidentally, and one tolerates it and the other doesn't. I'm going to do a WinMerge compare between the current py and a slightly older one. Alan Gauld wrote: "Wayne Watson" wrote Signature.htmlMy program in IDLE bombed with: == Exception in Tkinter callback Traceback (most recent call last): dialog = OperationalSettingsDialog( self.master, set_loc_dict ) tkSimpleDialog.Dialog.__init__(self, parent) self.wait_visibility() # window needs to be visible for the grab But runs fine in pythonWin performing the same entry operation. Lets eliminate some variables by avoiding any IDEs. Does it work OK when run from a DOS console? Or if you just double click the file in Windows explorer? If it does that means its some kind of interaction between the program and IDLE. This is not unusual since IDLE is itself a Tkinter program and although recent versions are much better behaved with Tkinter it can still cause some strangeness. If you still get an error running outside the IDE then we can analyze it more closely. For that we will need the code, at least the function that calls the dialog. And if its a subclass the dialog class too. -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) The Richard Feynman Problem-Solving Algorithm: (1) write down the problem; (2) think very hard; (3) write down the answer. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Signature.html Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) The Richard Feynman Problem-Solving Algorithm: (1) write down the problem; (2) think very hard; (3) write down the answer. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Keeping Dictonary Entries Ordered
Title: Signature.html I have a dictionary that looks like: config_names = {"start_time : '18:00:00', 'gray_scale' : True, "long": 120.00} If I iterate over it, the entries will appear in any order, as opposed to what I see above. However, in the config file, I'd like to keep them in the order above. That I want to write the config file in order. Perhaps, I need a list like c_names = ["start_time", "gray_scale", "long"] to get the keys out in the order I need? Maybe there's another way? -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) The Richard Feynman Problem-Solving Algorithm: (1) write down the problem; (2) think very hard; (3) write down the answer. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Keeping Dictonary Entries Ordered
Looks good. Thanks. Eric Dorsey wrote: >>> config_names = {'start_time': '18:00:00', 'gray_scale': True, 'long': 120.0} >>> config_names {'start_time': '18:00:00', 'gray_scale': True, 'long': 120.0} >>> for i, x in config_names.items(): ... print i, x ... start_time 18:00:00 gray_scale True long 120.0 >>> On Wed, Feb 11, 2009 at 7:48 PM, Wayne Watson <sierra_mtnv...@sbcglobal.net> wrote: I have a dictionary that looks like: config_names = {"start_time : '18:00:00', 'gray_scale' : True, "long": 120.00} If I iterate over it, the entries will appear in any order, as opposed to what I see above. However, in the config file, I'd like to keep them in the order above. That I want to write the config file in order. Perhaps, I need a list like c_names = ["start_time", "gray_scale", "long"] to get the keys out in the order I need? Maybe there's another way? -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) The Richard Feynman Problem-Solving Algorithm: (1) write down the problem; (2) think very hard; (3) write down the answer. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Signature.html Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) The Richard Feynman Problem-Solving Algorithm: (1) write down the problem; (2) think very hard; (3) write down the answer. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] IDLE/phythonWin -- Who's On First? (Abbott and Costello)
This appears to be an old problem. . However, the question remains. What to do about it? reboot? I killed about a dozen pythonwin.exe task, but to no avail. Wayne Watson wrote: Using WinMerge, I found a difference between the two that shouldn't have been, but it didn't solve the problem. dialog.rateVar.get() versus dialog.rateVar.get There was another like it with get(), but it wouldn't have been executed in my test run. I suspect something else like that lurks in the code. Wayne Watson wrote: I ran it w/o using either IDLE/pyWin, and it worked without any messages, as shown by the console window. Isn't this the same as using the console? Outside of the two, my guess is that some subtle was made to the code, accidentally, and one tolerates it and the other doesn't. I'm going to do a WinMerge compare between the current py and a slightly older one. Alan Gauld wrote: "Wayne Watson" wrote Signature.htmlMy program in IDLE bombed with: == Exception in Tkinter callback Traceback (most recent call last): dialog = OperationalSettingsDialog( self.master, set_loc_dict ) tkSimpleDialog.Dialog.__init__(self, parent) self.wait_visibility() # window needs to be visible for the grab But runs fine in pythonWin performing the same entry operation. Lets eliminate some variables by avoiding any IDEs. Does it work OK when run from a DOS console? Or if you just double click the file in Windows explorer? If it does that means its some kind of interaction between the program and IDLE. This is not unusual since IDLE is itself a Tkinter program and although recent versions are much better behaved with Tkinter it can still cause some strangeness. If you still get an error running outside the IDE then we can analyze it more closely. For that we will need the code, at least the function that calls the dialog. And if its a subclass the dialog class too. -- Signature.html Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) The Richard Feynman Problem-Solving Algorithm: (1) write down the problem; (2) think very hard; (3) write down the answer. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Signature.html Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) The Richard Feynman Problem-Solving Algorithm: (1) write down the problem; (2) think very hard; (3) write down the answer. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Signature.html Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) The Richard Feynman Problem-Solving Algorithm: (1) write down the problem; (2) think very hard; (3) write down the answer. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] IDLE/phythonWin -- Who's On First? (Abbott and Costello)
That's a good reason. I'm off to a XP Pro group to see how to break out of this, and restore order to IDLE. ALAN GAULD wrote: There used to be a lot of problems running Tkinter programs inside IDLE but most of these have been solved since about v2.3. However it does still through up issues, so the simple solution it to always test GUI programs outside of the IDE. Another reason why for serious programming I tend to favour the 3 window setup... Alan Gauld Author of the Learn To Program website http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Variable to String?
Title: Signature.html That's pretty much the question in Subject. I've got a date time variable with, for example, 15:00:00 in hh:mm:ss format, and I'd like to make it a string. -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) S, quiet. I'm thinking about filling this space. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Variable to String?
Title: Signature.html Well, let me try this again. I'm only interested in time. The user sees a widget dialog that asks him to put the time in it in the format HH:MM:YY, so he enters 15:30:10, or, as before 15:00:00. The value gets back to the code I'm working in as 15:30:10 as the type in Subject. I need to write the value to a file as a string, "15:30:10". In fact, I want to write it as start_time=15:30:10 in a txt file. Ah, this was as simple as using str(time_value), where time_value was of the aforementioned type. That's Kent's [4], and looked tempting for its simplicity. Too simple, I guess for me to try. str() had a little more umph that I thought. I had played around with the datetime module some many months for many combos of date+time, and anticipated having to beat against it again. Thankfully not here. :-) Good. Thanks. wesley chun wrote: On Fri, Feb 13, 2009 at 3:50 PM, Wayne Watson wrote: That's pretty much the question in Subject. I've got a date time variable with, for example, 15:00:00 in hh:mm:ss format, and I'd like to make it a string. import datetime d = datetime.time(15,0) datetime.time(15, 0) d datetime.time(15, 0) str(d) '15:00:00' is this what you're looking for, or was there something else? -- wesley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "Core Python Programming", Prentice Hall, (c)2007,2001 "Python Fundamentals", Prentice Hall, (c)2009 http://corepython.com wesley.j.chun :: wescpy-at-gmail.com python training and technical consulting cyberweb.consulting : silicon valley, ca http://cyberwebconsulting.com -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) S, quiet. I'm thinking about filling this space. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Keeping Dictonary Entries Ordered
Title: Signature.html It looks like a secondary list should do the trick. I'm not adverse to keeping one. My list is maybe 30-40 items at most. When I posted originally, I was just trying to find if I had overlooked something. It appears that without a secondary list, it gets pretty tricky. Alan Gauld wrote: "Eric Dorsey" wrote config_names {'start_time': '18:00:00', 'gray_scale': True, 'long': 120.0} for i, x in config_names.items(): print i, x start_time 18:00:00 gray_scale True long 120.0 Thats pretty much a happy coincidence, there is no guarantee that it will work like that for all dictionaries: d = {1:2,3:4,8:9,5:7} for i,x in d.items(): print i,x 8 9 1 2 3 4 5 7 Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) S, quiet. I'm thinking about filling this space. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Reading a Text File with tkFileDialog, askopenfilename+enumerate
Title: Signature.html A three questions about askopenfilename and enumerate. For askopenfilename: 1. Do I have to close the file before exiting from it? 2. How do I read each line of text in the file and quit when an eof is reached? This certainly doesn't do it. def OpenConfigFile(self): config_file = askopenfilename( title="Open Configuration File", filetypes=CEN_FILE_TYPES ) print "cfile---: ",config_file, type(config_file) for it in config_file: config_file.readline(aline) print aline pass print "finished the file" I get a "'str' object has no attribute 'readline'" msg trying to read a text file, Initial.sen, which is a text file and of type 'str'. 3. Where can I find out more about enumerate, as used here: input_file=open('Initial.sen','r') for (line_cnt, each_line) in enumerate(input_file): print each_line input_file.close() I used this small program for other purposes in the distant past, but what's going here with enumerate? Documentation for enumerate seems scarce. BTW, is there a thorough document on the use of files in Python out there somewhere? -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) S, quiet. I'm thinking about filling this space. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Reading a Text File with tkFileDialog, askopenfilename+enumerate
Title: Signature.html Thanks. A file name! That's funny. Bitten by my early acquaintance a few weeks ago with TkFileDialog, when I innocently stuck the method in the function to come back to. Wrong method! I don't think I'll forget next time. :-) Yes, I agree with wanting to open and close the file oneself. The fact that there's a ton of such documentation on file is the problem. Using Google to find the "right" one is like playing a slot machine. Similarly enumerate. The link you gave to enumerate doesn't quite do it for my example. for (line_cnt, each_line) ... I no longer have any idea what that means. Ah, by Googling with "for (line_cnt, each_line)", I've found some direct help, and the source of help on it--Python Tutor, Feb 13-14,2008. Someone responded to a question I posted on it, but there was no explanation. I just used it, and it worked. I may be the only one in the history of computing to ask about it. :-) Thanks to your use of the word pillow it's not likely I will be able to find the link to the Library Reference more easily, strange as that may seem. It is now bookmarked, as it has been, but with the word pillow in the title. My browser's bookmark capabilities have put me in the corner of disorganization, Mozilla Seamonkey. I easily have 1000 bookmarks and probably 40 or more on python. It an its predecessors have what I consider poor mgmt tools for bmrks. To make sure I even have a chance at finding my python bkmrks, I've put python in the title to make sure I have a fighting chance with their search to find them. One cannot even do a search on "python" and then do a "Move To" to put them in a single folder. I might as well roll dice. This may change. I'm about to install Firefox. Alan Gauld wrote: "Wayne Watson" wrote Three questions about askopenfilename and enumerate. For askopenfilename: 1. Do I have to close the file before exiting from it? 2. How do I read each line of text in the file and quit when an eof is reached? This has nothing to do with askopenfilename! 3. Where can I find out more about enumerate, as used here: input_file=open('Initial.sen','r') for (line_cnt, each_line) in enumerate(input_file): In the python documentation - try the search box on the python site or just google for python enumerate. The latter took me on the third link to: http://python.active-venture.com/whatsnew/section-enumerate.html Which is probably the simplest and shortest explanayin you will get! Documentation for enumerate seems scarce. BTW, is there a thorough document on the use of files in Python out there somewhere? There is a ton of it and every tutorial (including mine) will have a section on handling files. The official tutorial has a fair bit on it and the reference manual has a whole section. A good place to start might be the Library Reference (the one they suggest keeping under your pillow!) http://docs.python.org/library/stdtypes.html#file-objects HTH, -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) S, quiet. I'm thinking about filling this space. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Reading a Text File with tkFileDialog, askopenfilename+enumerate
Title: Signature.html Yes, true enough about simplicity, but see my response to Alan. Kent Johnson wrote: On Sun, Feb 15, 2009 at 9:16 AM, Wayne Watson wrote: 3. Where can I find out more about enumerate, as used here: input_file=open('Initial.sen','r') for (line_cnt, each_line) in enumerate(input_file): print each_line input_file.close() I used this small program for other purposes in the distant past, but what's going here with enumerate? Documentation for enumerate seems scarce. The official docs are here: http://docs.python.org/library/functions.html#enumerate It's pretty simple, perhaps that is why not a lot is written about it. When you iterate a sequence with a for loop, you get just the elements in the sequence: In [18]: seasons = ['Spring', 'Summer', 'Fall', 'Winter'] In [19]: for season in seasons: : print season Spring Summer Fall Winter Sometimes it is useful to also get the index of the element, not just the element. That is when you use enumerate: In [20]: for i, season in enumerate(seasons): : print i, season 0 Spring 1 Summer 2 Fall 3 Winter Technically, the result of calling enumerate() is a sequence whose elements are pairs (tuples) of (index, item). Using tuple assignment you can easily assign these to two variables, as above. This is the most common use. You can also use enumerate() without unpacking the tuples, maybe this makes it a little clearer what is happening: In [22]: for item in enumerate(seasons): print item (0, 'Spring') (1, 'Summer') (2, 'Fall') (3, 'Winter') Kent -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) S, quiet. I'm thinking about filling this space. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Reading a Text File with tkFileDialog, askopenfilename+enumerate
Title: Signature.html I'm still looking for an explanation of "for (line_cnt, each_line) in enumerate(input_file)". Why the tuple? Apparently, line_count gets a line number, and each_line gets the string of text. Chrome. I've heard of it. Does it require an install, or is it one of those odd ball things like arXchiv that I believe opens to an archive of technical papers (entered in Google search field?)? It sounds intriguing. I've never used it, but may soon. If Chrome imports my Moz bmkrs that would be a good sign. Regarding Moz-seamonkey, here's the problem with mgr. Create a folder called MyPython in bmrks. Fire up mgr, and enter python in the search. That should display every bmrk with python in it. Highlight them. From Edit, note the Move bookmark entry. Don't use it now. If you try to move them to MyPython it will do it, but you will now have duplicates. Ones in their original place and the ones that were "moved". It's a copy and not a move. Try it sometime by creating some test bkmrks and a folder. I've had repeated problems with Alan Gauld wrote: "Wayne Watson" wrote Thanks to your use of the word pillow it's not likely I will be able to find the link to the Library Reference more easily, strange as that may seem. You are right it seems very strange!? My browser's bookmark capabilities have put me in the corner of disorganization, Mozilla Seamonkey. I used Mozilla briefly before moving to Firefox, but I don't recall it having anything odd about its bookmarking capabilities! In fact I still use the directory structure I created for my bookmarks on Mozilla in Firefox to this day. (And on IE via importing), I easily have 1000 bookmarks and probably 40 or more on python. Me too, but I just have a programming folder with a Python one inside that. I then name the bookmark clearly - like Library Reference say... and it's been no problem. chance at finding my python bkmrks, I've put python in the title to make sure I have a fighting chance with their search to find them I just file them in the python folder when I bookmark them! This may change. I'm about to install Firefox. It might help because the new version of Firefox has tagged bookmarks, but personally I find my folder structure faster and more useful and saves me adding tags. Have you tried GoogleChrome yet? It might suit your style better. It looks at addresses you type and searches both your history and bookmarks for previous sites visited that might match. It sweems to work pretty well. I tend to primarily use Firefox and Chrome for all my browsing now except for a couple of sites that I know are IE only (including my bank sadly!) Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) S, quiet. I'm thinking about filling this space. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Reading a Text File with tkFileDialog, askopenfilename+enumerate
Title: Signature.html I don't think so. Not as a Python concept, but it looks sensible in your example. However, why would enumerate produce a line number? How would one know that it does? Ah, I see. enumerate produces a tuple which has the index and a list. It appears the only place this can be used is in a for? And, of course (devoid of an example): >>> help(enumerate) class enumerate(object) | enumerate(iterable) -> iterator for index, value of iterable | | Return an enumerate object. iterable must be an other object that supports | iteration. The enumerate object yields pairs containing a count (from | zero) and a value yielded by the iterable argument. enumerate is useful | for obtaining an indexed list: (0, seq[0]), (1, seq[1]), (2, seq[2]), ... ... Kent Johnson wrote: On Sun, Feb 15, 2009 at 2:47 PM, Wayne Watson wrote: I'm still looking for an explanation of "for (line_cnt, each_line) in enumerate(input_file)". Why the tuple? Apparently, line_count gets a line number, and each_line gets the string of text. Do you know about sequence unpacking? In an assignment statement, when the right side is a sequence, the left side can be a list of variables of the same length as the sequence. Then each sequence element is assigned to one variable. For example, In [24]: item = (0, 'Spring') In [25]: i, season = item In [26]: i Out[26]: 0 In [28]: season Out[28]: 'Spring' This can be used in a for loop, too, if the items are sequences. That is what is commonly done with enumerate(). Kent -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) S, quiet. I'm thinking about filling this space. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Reading a Text File with tkFileDialog, askopenfilename+enumerate
Title: Signature.html Thanks. Got it. It finally dawned on me in the midst of responding to Kent. If you ever get a chance to try the Moz experiment above, I'd be interested in your reaction. I see it as my 11:47 post. Alan Gauld wrote: "John Fouhy" wrote for index, item in [9,8,7,6]: print index, item 0 9 1 8 2 7 3 6 You mean: for index, item in enumerate([9,8,7,6]): print index, item Oops, yes, thanks for catching that. It was fairly fundamental to the discussion! Alan G ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) S, quiet. I'm thinking about filling this space. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Control Variables and a Dictionary with a GUI Interface
tvariable=self.enableVar).grid(row=6, column=1) self.enableVar.set( "%s" % self.sdict["enable_time"] ) return entry def apply(self): self.sdict["ok"] = True <<-- ok end OS=== === Skeletal List of Classes and def's= class DisplaySettingsDialog(tkSimpleDialog.Dialog): <<- def __init__(self, parent, sdict): def body(self,master): def apply(self): class BoxSettingsDialog(tkSimpleDialog.Dialog): def __init__(self, parent, sdict): def body(self,master): def apply(self): class SetDecoderDialog(tkSimpleDialog.Dialog): def __init__(self, parent, gui): def body(self,master): def apply(self): class Sentuser_GUI: <<- def Frame1( self, master,**argv): def __init__(self, master): def Focus( self ): def LogMessage( self, msg ): def DestroyLogWindow(self,event=None): def ShowHistogram(self): def DisplaySettings(self): <<- ... def SaveConfigFile(self): def PrintConfigData(): def OpenConfigFile(self): ... (~50 more def's at this level) ==end of skeletal== main loop=== def Process(): <<- (with mainloop code) root = Tk() app = Sentuser_GUI(root) root.mainloop() ===end main loop= Screen image -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) The Richard Feynman Problem-Solving Algorithm: (1) write down the problem; (2) think very hard; (3) write down the answer. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] exec "self.abc=22" ?
Title: Signature.html Python doesn't like the code in the Subject (unqualified exec not allowed in function). but easily likes self.abc="22". However, I'd like to assemble the assignment as a string, as shown in Subject, and execute it. Is there a way to do this? -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) S, quiet. I'm thinking about filling this space. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] exec "self.abc=22" ?
Title: Signature.html My limited repertoire. Actually, there wasn't much of a traceback. It came up in a small OK dialog. I copied what I could. I see my image I used above did make it to the list, so here's the skinny. I see Marc covered it with setattr. How does one do it with a dictionary? What else lurks out there that might be useful along these lines? Alan Gauld wrote: "Wayne Watson" wrote Python doesn't like the code in the Subject (unqualified exec not allowed in function). but easily likes self.abc="22". We'd need to see the code and traceback to guess why... However, I'd like to assemble the assignment as a string, as shown in Subject, and execute it. Is there a way to do this? exec is the usual way but it's also usually a bad idea. Any reason why you want to do that rather than any of the safer alternatives? (dict, setattr etc) -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) S, quiet. I'm thinking about filling this space. Web Page: <www.speckledwithstars.net/> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor