Re: IDLE not setting current directory in its path
On Jan 31, 6:12 pm, Terry Reedy tjre...@udel.edu wrote: On 1/31/2012 11:27 AM, gujax wrote: Thanks Terry, I see that the issue has been closed by you. However, I do not know how to run the patch on my Windows. Do I reinstall IDLE? Please suggest. I am using Python2.7 Thank you Terry, The patch suggested by you has worked for me, gujax Choices: 1. Wait for the next 2.7 release, which should be within a month. Easiest ;-). Will get you all other patches too. 2. Edit the files by hand, deleting lines marked - in the patch and adding lines marked +. Or change lines so they match the + lines. Harder, but you get the one change now instead of later. 3. Download and install TortoiseHG, turn your python installation (or just the idlelib directory) into a repository, apply the patch (or an edited version thereof), and perhaps delete the repository stuff. I would only do this if you want to learn to use (Tortoise)HG anyway, perhaps so you can apply other patches too, without waiting. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: IDLE not setting current directory in its path
On Jan 31, 6:12 pm, Terry Reedy tjre...@udel.edu wrote: On 1/31/2012 11:27 AM,gujaxwrote: Thanks Terry, I see that the issue has been closed by you. However, I do not know how to run the patch on my Windows. Do I reinstall IDLE? Please suggest. I am using Python2.7 Hi Terry, I changed the two files as suggested in your patch and it worked. Thank you, gujax Choices: 1. Wait for the next 2.7 release, which should be within a month. Easiest ;-). Will get you all other patches too. 2. Edit the files by hand, deleting lines marked - in the patch and adding lines marked +. Or change lines so they match the + lines. Harder, but you get the one change now instead of later. 3. Download and install TortoiseHG, turn your python installation (or just the idlelib directory) into a repository, apply the patch (or an edited version thereof), and perhaps delete the repository stuff. I would only do this if you want to learn to use (Tortoise)HG anyway, perhaps so you can apply other patches too, without waiting. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
importing module versus using function?
Hi, I am confused on this quite bad!! If I have this typed in interactive python: import numpy def dummy(): y=numpy.arange(1,2,0.1) return y and then s = dummy() s array[1. , 1.1, 1.2] it works. But if I have a module called example.py, whose code is def dummy(): y=numpy.arange(1,2,0.1) return y and now if I do the following: import numpy from example import * s=dummy() The above sequence does not work. It gives an error saying global variable numpy not defined. I understand that when I import a module it gets imported after getting compiled and therefore, the module should have a statement import numpy at its start. But what if I just want to use the function 'dummy'? I tried the following: from example import dummy and then try to use the function, it still gives me 'global name numpy not defined'! Why is that happening? Any pointers please. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: IDLE not setting current directory in its path
Thanks Terry, I see that the issue has been closed by you. However, I do not know how to run the patch on my Windows. Do I reinstall IDLE? Please suggest. I am using Python2.7 gujax On Jan 30, 10:55 pm, Terry Reedy tjre...@udel.edu wrote: On 1/30/2012 3:15 PM, Terry Reedy wrote: This issue is under consideration at http://bugs.python.org/issue13506 It should be fixed before the next Python releases. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
IDLE not setting current directory in its path
Hi, When I open python shell and change to any directory, the sys.path always shows ' '. This means it has temporarily added the current directory to its path i.e., sys.path shows [' ', other paths] I can then load any module from the current directory even though the current directory is not listed in the PYTHONPATH.. When I do the same with IDLE, it shows the name of the current directory i.e., ['name1', other paths...] instead of showing [' ', other paths..]. Therefore, when I change the directory to some other directory say 'name2' and type sys.path, I get the same name as the original directory which I started with (i.e., name1, while name2 is not added to the path automatically as done by ' '). Therefore, I am unable to load any modules from this current changed directory. In short how to configure IDLE to automatically add current directory to its path without typing every time sys.path.append.. Any help is appreciated. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Problems reading tif files
On Sep 26, 9:19 pm, Christian Heimes li...@cheimes.de wrote: Am 27.09.2010 02:31, schrieb gujax: Hi, I have read several related e-mails dating back as far as 2006. I am quite confused whether PIL can open tif images. Some posts seem to say there isn't yet any support for PIL while there are few posts where PIL has been able to open tif images. So I guess, I have to ask this probably trivial question again. I am just learning python and PIL. I have tiff images which are 8 bit and 16 bit gray scale images. I cannot open them. Here are the errors that I encounter. PIL only supports a limited subset of TIFF files. Several compression algorithms like G3 and G4 fax compression are not supported yet. PIL may have a problem with partly broken TIFF files, too. I have no idea why this happens. I will appreciate a resolution. The file opens with ImageJ and ImageMagick. It is a 8-bit RGB file. I have associated default viewer to be ImageMagick. I am on Lucid Linux, and other programs such as F- spot and Gimp cannot open those files either. I don't yet know how to attach image files to the post so please bear with me till I figure that out. Can you please post the output of tiffinfo for the specific file? It may give me a hint what's going wrong. There aren't a lot of good alternatives for image processing in Python. I've evaluated most of them and decided to write my own one for my employer. It's a Cython based library around FreeImage [1] and LCMS2 [2] and works very well. So far we have processed several million TIFF files with more than 100 TB of raw data smoothly. I've permission to release the software as open source but haven't found time to do a proper release. Christian Heimes [1]http://freeimage.sourceforge.net/ [2]http://www.littlecms.com/ Thanks Christian, Here is the tiffinfo: TIFF Directory at offset 0x8 (8) Subfile Type: (0 = 0x0) Image Width: 640 Image Length: 480 Bits/Sample: 32 Sample Format: IEEE floating point Compression Scheme: None Photometric Interpretation: min-is-black Samples/Pixel: 1 Rows/Strip: 480 Planar Configuration: single image plane ImageDescription: ImageJ=1.44f min=0.0 max=255.0 How do I use freeimage with python. Is there a backend? Can these files be converted to something else such as bmp and then read out? I should have tried it out before asking you, Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Problems reading tif files
Thanks Christian, Here is the info: TIFF Directory at offset 0x8 (8) Subfile Type: (0 = 0x0) Image Width: 640 Image Length: 480 Bits/Sample: 32 Sample Format: IEEE floating point Compression Scheme: None Photometric Interpretation: min-is-black Samples/Pixel: 1 Rows/Strip: 480 Planar Configuration: single image plane ImageDescription: ImageJ=1.44f min=0.0 max=255.0 How can I use freeimage. Can I incorporate it with python? Any idea what do ImageJ or Matlab use. Don't they have a robust imaging toolbox. Unfortunately, I cannot afford Matlab and I am not good at Java programing to be able to implement ImageJ with numerical analysis software. Thanks much, gujax On Sep 26, 9:19 pm, Christian Heimes li...@cheimes.de wrote: Am 27.09.2010 02:31, schrieb gujax: Hi, I have read several related e-mails dating back as far as 2006. I am quite confused whether PIL can open tif images. Some posts seem to say there isn't yet any support for PIL while there are few posts where PIL has been able to open tif images. So I guess, I have to ask this probably trivial question again. I am just learning python and PIL. I have tiff images which are 8 bit and 16 bit gray scale images. I cannot open them. Here are the errors that I encounter. PIL only supports a limited subset of TIFF files. Several compression algorithms like G3 and G4 fax compression are not supported yet. PIL may have a problem with partly broken TIFF files, too. I have no idea why this happens. I will appreciate a resolution. The file opens with ImageJ and ImageMagick. It is a 8-bit RGB file. I have associated default viewer to be ImageMagick. I am on Lucid Linux, and other programs such as F- spot and Gimp cannot open those files either. I don't yet know how to attach image files to the post so please bear with me till I figure that out. Can you please post the output of tiffinfo for the specific file? It may give me a hint what's going wrong. There aren't a lot of good alternatives for image processing in Python. I've evaluated most of them and decided to write my own one for my employer. It's a Cython based library around FreeImage [1] and LCMS2 [2] and works very well. So far we have processed several million TIFF files with more than 100 TB of raw data smoothly. I've permission to release the software as open source but haven't found time to do a proper release. Christian Heimes [1]http://freeimage.sourceforge.net/ [2]http://www.littlecms.com/ -- http://mail.python.org/mailman/listinfo/python-list
Problems reading tif files
Hi, I have read several related e-mails dating back as far as 2006. I am quite confused whether PIL can open tif images. Some posts seem to say there isn't yet any support for PIL while there are few posts where PIL has been able to open tif images. So I guess, I have to ask this probably trivial question again. I am just learning python and PIL. I have tiff images which are 8 bit and 16 bit gray scale images. I cannot open them. Here are the errors that I encounter. Image.open('filename') im.info (640, 480) {'resolution': (1, 1), 'compression': 'raw'} F;32BF TIFF But when I run the im.show() it gives the following error. im.show() Traceback (most recent call last): File pyshell#0, line 1, in module im.show() File /usr/lib/python2.6/dist-packages/PIL/Image.py, line 1483, in show _show(self, title=title, command=command) File /usr/lib/python2.6/dist-packages/PIL/Image.py, line 2123, in _show apply(_showxv, (image,), options) File /usr/lib/python2.6/dist-packages/PIL/Image.py, line 2127, in _showxv apply(ImageShow.show, (image, title), options) File /usr/lib/python2.6/dist-packages/PIL/ImageShow.py, line 41, in show if viewer.show(image, title=title, **options): File /usr/lib/python2.6/dist-packages/PIL/ImageShow.py, line 62, in show base = Image.getmodebase(image.mode) File /usr/lib/python2.6/dist-packages/PIL/Image.py, line 245, in getmodebase return ImageMode.getmode(mode).basemode File /usr/lib/python2.6/dist-packages/PIL/ImageMode.py, line 50, in getmode return _modes[mode] KeyError: 'F;32BF' I have no idea why this happens. I will appreciate a resolution. The file opens with ImageJ and ImageMagick. It is a 8-bit RGB file. I have associated default viewer to be ImageMagick. I am on Lucid Linux, and other programs such as F- spot and Gimp cannot open those files either. I don't yet know how to attach image files to the post so please bear with me till I figure that out. Thanks, gujax -- http://mail.python.org/mailman/listinfo/python-list
importerror: module Gnuplot missing
Hi, I need help. I am trying to follow examples from a book Python Scripting for Computational Science and the examples are all plotted using Gnuplot. When I run the programs I get error saying importerror Gnuplot module missing. I have installed Gnuplot in C:\My Programs\gnuplot directory (running on WinME). I have installed python 2.5 and Gnuplot 4.2. I have also installed Gnuplot-py-1.8 in Python's site-packages. All paths are correctly set as I can see from sys.path argument i.e., path for gnuplot is set and so also the python path and scripting path which is where book examples reside. Many examples did run well until it came down to plotting... I also ran 'python test.py' from Gnuplot-py-1.8 directory and strangely it runs and then asks me to press return to see result. The screen then freezes and the computer hangs. I have to reboot it again. Some one suggested in the old archives that I should change in the utils the code import Gnuplot,utils to import utils from _Gnuplot import Gnuplot I have tried it but same result. Window freezes and my C:\Windows\ directory gets filled with fff #...tmp files. I have no idea what are those. My other attempts: 1. Is there an issue how one names the directory - gnuplot versus Gnuplot etc... 2. I have done things like from numpy import oldnumeric. And the test runs fine. 3. python setup.py install for installing Gnuplot-py-1.8 also ran fine. 4. I could from \gnuplot\bin directory open wgnuplot and in the Gnuplot window could plot sinx/x. 5. I also have a pgnuplot application 6. Is the gnuplot version incompatible with Python 2.5 and its associated older numpy versions.. I have seen several similar missing Gnuplot reports in the archive but did not find any resolution to those. I will appreciate any help, Thanks gujax -- http://mail.python.org/mailman/listinfo/python-list
Window crash/freeze after python test.py in \Gnuplot
Hi, My computer OS is Win ME, and I am running a Py2.5 version. Gnuplot is v4.2, Gnuplot_py is v1.8. However, whenever I give a command python test.py to test Gnuplot_py, I sometimes get message #Gnuplot.for enjoyment #press return to open a window .. clear terminal #test function### and then computer hangs. I never see any windows appearing. A blue screen appears with request for cntrl-alt-del. I cannot exactly determine the messages because the crash occurs relatively fast therefore some sentences above may not be accurate. I have tried this with many scripts which use Gnuplot for plotting but it results in same crashes e.g. demo.py in gnuplot_py. I really have no clue what should be my next step. Any help will be appreicated. I however, can run Gnuplot by typing pgnuplot or wgnuplot in the command shell and it opens a Gnuplot window. Therefore, it looks like some incompatibility between gnuplot_py, python2.5? Thanks, gujax -- http://mail.python.org/mailman/listinfo/python-list
Re: help with Python installation
On Feb 27, 10:14 pm, Arnaud Delobelle arno...@googlemail.com wrote: On 28 Feb, 01:48, gujax rjngrj2...@gmail.com wrote: Hi, I have been trying to install python on my Win ME system for over two years - gave up for a while and now I am back with a resolve to solve the problem. I tried all versions of python but having installation problems for all. Installation does not proceed and I get a message saying dll required for installation could not be run. I do not even know what to do next. I also tried Activepython. It installs but when I try to open it from Start-Programs-ActivePython 2.6, I get an error window saying - upgrade windows. Is there no solution at all to installing python on WinME. I have checked registry several times online and have sought professional help but so far no success. Thanks, I will appreciate any help gujax The docs (*) say that Python 2.5 is still compatible with Windows 9X and ME, but that support for these platform was dropped at 2.6. So you should be able to install and run Python 2.5. (*)http://docs.python.org/using/windows.html#installing-python -- Arnaud Hi, Yes indeed, Python 2.5 worked and so did numpy and scipy for this version. Thanks to all for your inputs. There are now issues with plotting - graph plotting using pylab does not work nor does the Tck- Tk, but for now I am satisfied. Hopefully I will plod my way through. I should have read the documentation properly to realize that Win ME is not supported for later versions, Thanks again Gujax -- http://mail.python.org/mailman/listinfo/python-list
help with Python installation
Hi, I have been trying to install python on my Win ME system for over two years - gave up for a while and now I am back with a resolve to solve the problem. I tried all versions of python but having installation problems for all. Installation does not proceed and I get a message saying dll required for installation could not be run. I do not even know what to do next. I also tried Activepython. It installs but when I try to open it from Start-Programs-ActivePython 2.6, I get an error window saying - upgrade windows. Is there no solution at all to installing python on WinME. I have checked registry several times online and have sought professional help but so far no success. Thanks, I will appreciate any help gujax -- http://mail.python.org/mailman/listinfo/python-list
Re: help with Python installation
On Feb 27, 9:36 pm, Rick Dooling rpdool...@gmail.com wrote: Hi, I have been trying to install python on my Win ME system Try this: http://tinyurl.com/w7wgp RD I gave it a shot but the site installs the same version of ActivePython which did install on my computer but does not open any command windows. See my earlier posted e-mail. Thanks anyway, -- http://mail.python.org/mailman/listinfo/python-list
Re: help with Python installation
On Feb 27, 9:56 pm, staticd stat...@gmail.com wrote: On Feb 27, 8:48 pm, gujax rjngrj2...@gmail.com wrote: I have been trying to install python on my Win ME system for over two years - gave up for a while and now I am back with a resolve to solve the problem. Dude. Give up. There are a ton of __free__ distroz of linux out there. Your troubles are not worth the effort. Why do I say this? Let's say you do, eventually, figure out what's wrong. Now what? Why are you so attached to this machine with ME on it? nd I agree with you. I have a CD of Xubuntu. I tried booting up with the CD and was impressed. I noticed few problems with screen resolution, window size etc. I am not yet sure which distroz is the best for an instrument with a 512 Mb RAM, 700MHz pentium III chip and about 10Gb mem. Not sure if this is the right forum for this topic though, And no, I am not at all attached to Win, though wouldn't say the same for my computer. Cheers, gujax -- http://mail.python.org/mailman/listinfo/python-list