From zaheer.agadi at gmail.com Sun Mar 1 00:16:53 2009 From: zaheer.agadi at gmail.com (zaheer.agadi at gmail.com) Date: Sat, 28 Feb 2009 21:16:53 -0800 (PST) Subject: Creating Zip file like java jar file References: <10a307fa-c6bb-404a-813c-bd5f0e5fa625@v18g2000pro.googlegroups.com> Message-ID: <86b99462-e1f6-4eca-9f83-a14fcdcb8617@q30g2000prq.googlegroups.com> On Mar 1, 1:32 am, "Gabriel Genellina" wrote: > En Sat, 28 Feb 2009 16:51:04 -0200, escribi?: > > > > > On Feb 28, 11:33 pm, Lie Ryan wrote: > >> zaheer.ag... at gmail.com wrote: > >> > On Feb 28, 11:15 pm, "Gabriel Genellina" > >> > wrote: > >> >> En Sat, 28 Feb 2009 14:34:15 -0200, > >> escribi?: > > >> >>> I want to create zip file equivalent to java jar file,I created a > >> zip > >> >>> file of my sources and added some __main__.py > >> >>> it says __Main__.py not found in Copyproject.zip..? > >> >> __main__.py must exist in the root directory. > > >> > What do you mean by root directory..?What is this directory in > >> > Windows..?You mean the top level folder of the project?in my case > >> > copyproject folder..? > > >> root directory is the topmost directory (imagine a tree, the root is > >> where all the branches branched from), in this case the root directory > >> is your copyproject main folder. > > > I wonder, I do have the __main__.py in the root directory,but still > > getting > > python.exe cannot find __main__.py in CopyProject.zip > > The top of the tree inside the zip file. Depth zero. Not inside any > directory. Above anything else. Just a bare name. > > Open your zip using the zipfile module: > > import zipfile > z = zipfile.ZipFile("xxx.zip") > z.printdir() > > You should see a line starting with __main__.py *without* any / in it. > > > I used the following command > > python Copyproject.zip -m __main__.py --uploadFile and also tried with > > python Copyproject.zip --uploadFile > > Use the second one. > > > both give me the same error , I can see the sys.path contains the > > project folder. > > -- > Gabriel Genellina > Uh? Which project folder? Isn't it in the .zip? > Yeah I meant zip file. I can get to work but is it is not able to locate the packages,says import error cant find the package and module here is my code import sys import os.path as op sys.path.insert(0, op.join(op.dirname(op.abspath(__file__)), "somezip.zip")) import zipfile z = zipfile.ZipFile("somezip.zip") z.printdir() import some.storagepackage.somemodule print "upload" print "syspath",sys.path #do something should it not find the modules when the zip files is in sys.path..? From perfreem at gmail.com Sun Mar 1 00:18:26 2009 From: perfreem at gmail.com (per) Date: Sat, 28 Feb 2009 21:18:26 -0800 (PST) Subject: setting PYTHONPATH to override system wide site-packages References: <1ac9874e-67ef-4f90-8075-5e94a70b536b@x38g2000yqj.googlegroups.com> <5c5b74e8-c459-4019-9140-e92fb3e06da4@k29g2000prf.googlegroups.com> <11876bd1-b671-4218-b4bb-d15fb1822cb6@h5g2000yqh.googlegroups.com> Message-ID: <93f8188e-690a-442c-bdde-4a27cdb7ed14@w9g2000yqa.googlegroups.com> On Feb 28, 11:53?pm, per wrote: > On Feb 28, 11:24?pm, Carl Banks wrote: > > > > > On Feb 28, 7:30?pm, per wrote: > > > > hi all, > > > > i recently installed a new version of a package using python setup.py > > > install --prefix=/my/homedir on a system where i don't have root > > > access. the old package still resides in /usr/lib/python2.5/site- > > > packages/ and i cannot erase it. > > > > i set my python path as follows in ~/.cshrc > > > > setenv PYTHONPATH /path/to/newpackage > > > > but whenever i go to python and import the module, the version in site- > > > packages is loaded. how can i override this setting and make it so > > > python loads the version of the package that's in my home dir? > > > What happens when you run the command "print sys.path" from the Python > > prompt? ?/path/to/newpackage should be the second item, and shoud be > > listed in front of the site-packages dir. > > > What happens when you run "print os.eviron['PYTHONPATH']" at the > > Python interpreter? ?It's possible that the sysadmin installed a > > script that removes PYTHONPATH environment variable before invoking > > Python. ?What happens when you type "which python" at the csh prompt? > > > What happens when you type "ls /path/to/newpackage" at your csh > > prompt? ?Is the module you're trying to import there? > > > You approach should work. ?These are just suggestions on how to > > diagnose the problem; we can't really help you figure out what's wrong > > without more information. > > > Carl Banks > > hi, > > i am setting it programmatically now, using: > > import sys > sys.path = [....] > > sys.path now looks exactly like what it looked like before, except the > second element is my directory. yet when i do > > import mymodule > print mymodule.__version__ > > i still get the old version... > > any other ideas? in case it helps, it gives me this warning when i try to import the module /usr/lib64/python2.5/site-packages/pytz/__init__.py:29: UserWarning: Module dateutil was already imported from /usr/lib64/python2.5/site- packages/dateutil/__init__.pyc, but /usr/lib/python2.5/site-packages is being added to sys.path from pkg_resources import resource_stream From timr at probo.com Sun Mar 1 00:24:29 2009 From: timr at probo.com (Tim Roberts) Date: Sat, 28 Feb 2009 21:24:29 -0800 Subject: i have problem with glob.glob() in remotely directory References: <967cd34f0902260105q7d8b33adk579956b275b2d68b@mail.gmail.com> <50697b2c0902260116t7ee6f65ei878cdea6086fad6a@mail.gmail.com> Message-ID: lameck kassana wrote: > >i did try but still not working.But also i try os.walk() for remote >computer like os.walk('\\192.168.0.45') it also failed> Of course it did, for two different reasons. First, you can't just walk an IP address. You have to specify one of the shares that the machine exposes. Second, you STILL have a backslash problem. If that machine has a network share called "files", you could say os.walk( '\\\\192.168.0.45\\files' ) or os.walk( r'\\192.168.0.45\files' ) >Thats it is my main problem do i need any new imports besides import os No. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From bedouglas at earthlink.net Sun Mar 1 00:46:10 2009 From: bedouglas at earthlink.net (bruce) Date: Sat, 28 Feb 2009 21:46:10 -0800 Subject: file locking... Message-ID: <1edc01c99a31$075c8a30$0301a8c0@tmesa.com> Hi. Got a bit of a question/issue that I'm trying to resolve. I'm asking this of a few groups so bear with me. I'm considering a situation where I have multiple processes running, and each process is going to access a number of files in a dir. Each process accesses a unique group of files, and then writes the group of files to another dir. I can easily handle this by using a form of locking, where I have the processes lock/read a file and only access the group of files in the dir based on the open/free status of the lockfile. However, the issue with the approach is that it's somewhat synchronous. I'm looking for something that might be more asynchronous/parallel, in that I'd like to have multiple processes each access a unique group of files from the given dir as fast as possible. So.. Any thoughts/pointers/comments would be greatly appreciated. Any pointers to academic research, etc.. would be useful. thanks From michele.simionato at gmail.com Sun Mar 1 01:34:47 2009 From: michele.simionato at gmail.com (Michele Simionato) Date: Sat, 28 Feb 2009 22:34:47 -0800 (PST) Subject: What's so wrong about execfile? References: Message-ID: <44e6a804-0690-4a19-8c57-e0efce1de793@x13g2000yqf.googlegroups.com> On Feb 28, 4:21?am, Sammo wrote: > Given that execfile has been removed in py3k execfile has not been really removed, it is just spelled differently: >>> exec(open(myfile.py).read()) BTW, from the help message >>> help(exec) Help on built-in function exec in module builtins: exec(...) exec(object[, globals[, locals]]) Read and execute code from a object, which can be a string, a code object or a file object. The globals and locals are dictionaries, defaulting to the current globals and locals. If only globals is given, locals defaults to it. I would have expected >>> exec(open('myfile.py')) to work too. Any idea why it does not? Michele Simionato From pavlovevidence at gmail.com Sun Mar 1 01:52:56 2009 From: pavlovevidence at gmail.com (Carl Banks) Date: Sat, 28 Feb 2009 22:52:56 -0800 (PST) Subject: setting PYTHONPATH to override system wide site-packages References: <1ac9874e-67ef-4f90-8075-5e94a70b536b@x38g2000yqj.googlegroups.com> <5c5b74e8-c459-4019-9140-e92fb3e06da4@k29g2000prf.googlegroups.com> <11876bd1-b671-4218-b4bb-d15fb1822cb6@h5g2000yqh.googlegroups.com> <93f8188e-690a-442c-bdde-4a27cdb7ed14@w9g2000yqa.googlegroups.com> Message-ID: <51f81bf2-f646-4393-89ae-b1a1929f4abb@p6g2000pre.googlegroups.com> On Feb 28, 9:18?pm, per wrote: > On Feb 28, 11:53?pm, per wrote: > > > > > On Feb 28, 11:24?pm, Carl Banks wrote: > > > > On Feb 28, 7:30?pm, per wrote: > > > > > hi all, > > > > > i recently installed a new version of a package using python setup.py > > > > install --prefix=/my/homedir on a system where i don't have root > > > > access. the old package still resides in /usr/lib/python2.5/site- > > > > packages/ and i cannot erase it. > > > > > i set my python path as follows in ~/.cshrc > > > > > setenv PYTHONPATH /path/to/newpackage > > > > > but whenever i go to python and import the module, the version in site- > > > > packages is loaded. how can i override this setting and make it so > > > > python loads the version of the package that's in my home dir? > > > > What happens when you run the command "print sys.path" from the Python > > > prompt? ?/path/to/newpackage should be the second item, and shoud be > > > listed in front of the site-packages dir. > > > > What happens when you run "print os.eviron['PYTHONPATH']" at the > > > Python interpreter? ?It's possible that the sysadmin installed a > > > script that removes PYTHONPATH environment variable before invoking > > > Python. ?What happens when you type "which python" at the csh prompt? > > > > What happens when you type "ls /path/to/newpackage" at your csh > > > prompt? ?Is the module you're trying to import there? > > > > You approach should work. ?These are just suggestions on how to > > > diagnose the problem; we can't really help you figure out what's wrong > > > without more information. > > > > Carl Banks > > > hi, > > > i am setting it programmatically now, using: > > > import sys > > sys.path = [....] > > > sys.path now looks exactly like what it looked like before, except the > > second element is my directory. yet when i do > > > import mymodule > > print mymodule.__version__ > > > i still get the old version... > > > any other ideas? > > in case it helps, it gives me this warning when i try to import the > module > > /usr/lib64/python2.5/site-packages/pytz/__init__.py:29: UserWarning: > Module dateutil was already imported from /usr/lib64/python2.5/site- > packages/dateutil/__init__.pyc, but /usr/lib/python2.5/site-packages > is being added to sys.path > ? from pkg_resources import resource_stream Ok then. When pkg_resources is involved, who knows what behavior to expect. pkg_resources.py is a third-party module from PEAK (which unfortunately a number of other third-party packages depend on, so it can be hard to keep your installation free of it, but I digress). Among other things no one knows about, it's a sort of run-time package version management system. It's possible, maybe, that some module that runs on startup specifically requested and imported the version of dateutils that's on the system path. Which means, if you don't properly appease pkg_resources, it could actually ignore your version of the package even if it's earlier in the system path. This is only speculation, because who actually knows what's in the mind of pkg_resources?, but if that is the reason, I won't be the one to tell you how to fix it. Here's something to try, however. Set up your PYTHONPATH as you did before, but also create an empty pkg_resources.py file in the directory you specified. Warning: this might make some packages unusable. Not-a-fan-of-pkg_resources-ly y'rs, Carl Banks From fsims at verizon.net Sun Mar 1 02:33:55 2009 From: fsims at verizon.net (Ms FRANCES SIMS) Date: Sun, 1 Mar 2009 02:33:55 -0500 Subject: mulit-dimensional lists Message-ID: <08B30CCC1C9A407DB5312D706931D2B9@Frances> Hi, I;m not sure how I got your address but I could use a friend . Please reply and we can talk. I would like that. Good day, Joe Pyne -------------- next part -------------- An HTML attachment was scrubbed... URL: From charly.founes at gmail.com Sun Mar 1 03:04:15 2009 From: charly.founes at gmail.com (cf29) Date: Sun, 1 Mar 2009 00:04:15 -0800 (PST) Subject: cannot execute binary file (Python 3.0.1) Message-ID: Greetings, On Mac OS 10.5.6, I updated Python to version 3.0.1. When I want to run a py file, I get an error: xxx:~ xxx$ cd '/Users/xxx/Documents/programmingPractice/' && '/usr/ local/bin/python' '/Users/xxx/Documents/programmingPractice/ python_file.py' && echo Exit status: $? && exit 1 -bash: /usr/local/bin/python: cannot execute binary file This wasn't an issue with Python 2.6, please let me know how to solve this problem. Best regards Charly From clp2 at rebertia.com Sun Mar 1 03:14:40 2009 From: clp2 at rebertia.com (Chris Rebert) Date: Sun, 1 Mar 2009 00:14:40 -0800 Subject: cannot execute binary file (Python 3.0.1) In-Reply-To: References: Message-ID: <50697b2c0903010014g53dee054x5e06203e6de4d27@mail.gmail.com> On Sun, Mar 1, 2009 at 12:04 AM, cf29 wrote: > Greetings, > On Mac OS 10.5.6, I updated Python to version 3.0.1. > When I want to run a py file, I get an error: > xxx:~ xxx$ cd '/Users/xxx/Documents/programmingPractice/' && '/usr/ > local/bin/python' ?'/Users/xxx/Documents/programmingPractice/ > python_file.py' ?&& echo Exit status: $? && exit 1 > -bash: /usr/local/bin/python: cannot execute binary file > > This wasn't an issue with Python 2.6, please let me know how to solve > this problem. Detailing exactly how you upgraded Python would help immensely. Cheers, Chris -- Follow the path of the Iguana... http://rebertia.com From banibrata.dutta at gmail.com Sun Mar 1 04:12:55 2009 From: banibrata.dutta at gmail.com (Banibrata Dutta) Date: Sun, 1 Mar 2009 14:42:55 +0530 Subject: ANN: updates to Python-by-example In-Reply-To: <379a7319-376d-4486-954a-fc7035b0deb9@j38g2000yqa.googlegroups.com> References: <379a7319-376d-4486-954a-fc7035b0deb9@j38g2000yqa.googlegroups.com> Message-ID: <3de8e1f70903010112w143d013du99532082f4673c26@mail.gmail.com> very useful for an off-and-on, foo-bar programmer! i'm sure it'd have something of value to more experienced programmers as well. On Fri, Feb 27, 2009 at 7:27 PM, Rainy wrote: > Python-by-example http:// > pbe.lightbird.net has some new modules added: pickle, shelve, > sqlite3, gzip, csv, configparser, optparse, logging. I also changed > over to using excellent sphinx package to generate documentation, this > will allow me to add pdf and windows help formats soon (I ran into > some issues with that, actually). More modules coming soon, too! -AK > -- > http://mail.python.org/mailman/listinfo/python-list > -- regards, Banibrata http://www.linkedin.com/in/bdutta -------------- next part -------------- An HTML attachment was scrubbed... URL: From charly.founes at gmail.com Sun Mar 1 04:16:36 2009 From: charly.founes at gmail.com (cf29) Date: Sun, 1 Mar 2009 01:16:36 -0800 (PST) Subject: cannot execute binary file (Python 3.0.1) References: Message-ID: <63b6a098-abfe-4c30-9d9b-f0e98e9dd930@b16g2000yqb.googlegroups.com> On Mar 1, 11:14?am, Chris Rebert wrote: > Detailing exactly how you upgraded Python would help immensely. > > Cheers, > Chris Thanks for your answer. I installed the package in python-3.0.1-macosx2009-02-14.dmg (downloaded from http://www.python.org/download/releases/3.0.1/) and runed the Update Shell Profile.command situated in the Python 3.0 folder. If I type python in the Terminal, it says: Python 3.0.1 (r301:69597, Feb 14 2009, 19:03:52). So it seems that it is working properly. If I use the Terminal and type: python myfile.py, it works as expected. The issue is when I want to run py file either with Python Launcher.app or directly from BBEdit (the text editor i use). I get the "cannot execute binary file" error. In /usr/local/bin/ the python symbolic link is connected to Python v3 Charly http://cf29.com/ From wiggly at wiggly.org Sun Mar 1 04:28:11 2009 From: wiggly at wiggly.org (Nigel Rantor) Date: Sun, 01 Mar 2009 09:28:11 +0000 Subject: file locking... In-Reply-To: <1edc01c99a31$075c8a30$0301a8c0@tmesa.com> References: <1edc01c99a31$075c8a30$0301a8c0@tmesa.com> Message-ID: <49AA552B.2060901@wiggly.org> bruce wrote: > Hi. > > Got a bit of a question/issue that I'm trying to resolve. I'm asking > this of a few groups so bear with me. > > I'm considering a situation where I have multiple processes running, > and each process is going to access a number of files in a dir. Each > process accesses a unique group of files, and then writes the group > of files to another dir. I can easily handle this by using a form of > locking, where I have the processes lock/read a file and only access > the group of files in the dir based on the open/free status of the > lockfile. > > However, the issue with the approach is that it's somewhat > synchronous. I'm looking for something that might be more > asynchronous/parallel, in that I'd like to have multiple processes > each access a unique group of files from the given dir as fast as > possible. I don't see how this is synchronous if you have a lock per file. Perhaps you've missed something out of your description of your problem. > So.. Any thoughts/pointers/comments would be greatly appreciated. Any > pointers to academic research, etc.. would be useful. I'm not sure you need academic papers here. One trivial solution to this problem is to have a single process determine the complete set of files that require processing then fork off children, each with a different set of files to process. The parent then just waits for them to finish and does any post-processing required. A more concrete problem statement may of course change the solution... n From koranthala at gmail.com Sun Mar 1 04:45:54 2009 From: koranthala at gmail.com (koranthala) Date: Sun, 1 Mar 2009 01:45:54 -0800 (PST) Subject: file locking... References: <1edc01c99a31$075c8a30$0301a8c0@tmesa.com> Message-ID: <726941bc-bcd5-4997-a6c2-62ee4a71efdc@p36g2000prp.googlegroups.com> On Mar 1, 2:28?pm, Nigel Rantor wrote: > bruce wrote: > > Hi. > > > Got a bit of a question/issue that I'm trying to resolve. I'm asking > > this of a few groups so bear with me. > > > I'm considering a situation where I have multiple processes running, > > and each process is going to access a number of files in a dir. Each > > process accesses a unique group of files, and then writes the group > > of files to another dir. I can easily handle this by using a form of > > locking, where I have the processes lock/read a file and only access > > the group of files in the dir based on the ?open/free status of the > > lockfile. > > > However, the issue with the approach is that it's somewhat > > synchronous. I'm looking for something that might be more > > asynchronous/parallel, in that I'd like to have multiple processes > > each access a unique group of files from the given dir as fast as > > possible. > > I don't see how this is synchronous if you have a lock per file. Perhaps > you've missed something out of your description of your problem. > > > So.. Any thoughts/pointers/comments would be greatly appreciated. Any > > ?pointers to academic research, etc.. would be useful. > > I'm not sure you need academic papers here. > > One trivial solution to this problem is to have a single process > determine the complete set of files that require processing then fork > off children, each with a different set of files to process. > > The parent then just waits for them to finish and does any > post-processing required. > > A more concrete problem statement may of course change the solution... > > ? ?n Using twisted might also be helpful. Then you can avoid the problems associated with threading too. From nad at acm.org Sun Mar 1 04:52:40 2009 From: nad at acm.org (Ned Deily) Date: Sun, 01 Mar 2009 01:52:40 -0800 Subject: cannot execute binary file (Python 3.0.1) References: Message-ID: In article , cf29 wrote: > On Mac OS 10.5.6, I updated Python to version 3.0.1. > When I want to run a py file, I get an error: > xxx:~ xxx$ cd '/Users/xxx/Documents/programmingPractice/' && '/usr/ > local/bin/python' '/Users/xxx/Documents/programmingPractice/ > python_file.py' && echo Exit status: $? && exit 1 > -bash: /usr/local/bin/python: cannot execute binary file > > This wasn't an issue with Python 2.6, please let me know how to solve > this problem. It appears you are trying to run a python script by double-clicking on it and that Python Launcher.app is the default application associated with .py files. The default setting in Python Launcher is to use the python linked to /use/local/bin/pythonw. By default, the OS X 3.0.1 installer does not install or modify the links in /usr/local/bin/, unlike 2.x installers. That is a problem for Python Launcher. Here are a few options, assuming you used the 3.0.1 python.org installer: 1. You can start up the installer again, choose Customize, and then select and install the "UNIX command-line tools" package. /usr/local/bin/pythonw will now point out at python 3.0.1 rather than python 2.6. 2. Launch Python Launcher and change its Preferences. Python Launcher should be in the /Applications/Python 3.0 folder. Select Preferences and in the Interpreter field enter the full path to python3.0, which is: /Library/Frameworks/Python.framework/Versions/3.0/bin/python3.0 3. Use IDLE instead of Python Launcher to run scripts. Just launch IDLE (it's also in /Applications/Python 3.0) and open the script file from IDLE's menu bar. Or drag-drop the script onto the IDLE icon in the Dock. If you want to be able to double-click on the file in the Finder, you'll need to change the default application associated with .py files. In a Finder window or the desktop select your python script file but don't double-click it. Instead, choose the FInder's "Get Info" command and in the resulting Info window choose IDLE 3.0.1 in the "Open with" list. To open all .py files with IDLE, if necessary click on the padlock in the lower right-hand corner of the Info window to authenticate, then click on the Change All.. button. 4. Run your scripts in a terminal window using python3.0 from the shell command line. You can use the above path to execute python; it might help to create a shell alias for it. Or double-click on the Update Shell Profile command in /Applications/Python 3.0 to cause python3.0 to be added to your shell PATH and then just type python3.0. I would recommend either (or both) of the last two approaches. You'll be better off avoiding Python Launcher. -- Ned Deily, nad at acm.org From wiggly at wiggly.org Sun Mar 1 04:59:32 2009 From: wiggly at wiggly.org (Nigel Rantor) Date: Sun, 01 Mar 2009 09:59:32 +0000 Subject: file locking... In-Reply-To: <726941bc-bcd5-4997-a6c2-62ee4a71efdc@p36g2000prp.googlegroups.com> References: <1edc01c99a31$075c8a30$0301a8c0@tmesa.com> <726941bc-bcd5-4997-a6c2-62ee4a71efdc@p36g2000prp.googlegroups.com> Message-ID: <49AA5C84.9050305@wiggly.org> koranthala wrote: > On Mar 1, 2:28 pm, Nigel Rantor wrote: >> bruce wrote: >>> Hi. >>> Got a bit of a question/issue that I'm trying to resolve. I'm asking >>> this of a few groups so bear with me. >>> I'm considering a situation where I have multiple processes running, >>> and each process is going to access a number of files in a dir. Each >>> process accesses a unique group of files, and then writes the group >>> of files to another dir. I can easily handle this by using a form of >>> locking, where I have the processes lock/read a file and only access >>> the group of files in the dir based on the open/free status of the >>> lockfile. >>> However, the issue with the approach is that it's somewhat >>> synchronous. I'm looking for something that might be more >>> asynchronous/parallel, in that I'd like to have multiple processes >>> each access a unique group of files from the given dir as fast as >>> possible. >> I don't see how this is synchronous if you have a lock per file. Perhaps >> you've missed something out of your description of your problem. >> >>> So.. Any thoughts/pointers/comments would be greatly appreciated. Any >>> pointers to academic research, etc.. would be useful. >> I'm not sure you need academic papers here. >> >> One trivial solution to this problem is to have a single process >> determine the complete set of files that require processing then fork >> off children, each with a different set of files to process. >> >> The parent then just waits for them to finish and does any >> post-processing required. >> >> A more concrete problem statement may of course change the solution... >> >> n > > Using twisted might also be helpful. > Then you can avoid the problems associated with threading too. No one mentioned threads. I can't see how Twisted in this instance isn't like using a sledgehammer to crack a nut. n From miratcanbayrak at gmail.com Sun Mar 1 05:15:48 2009 From: miratcanbayrak at gmail.com (Mirat Can Bayrak) Date: Sun, 1 Mar 2009 12:15:48 +0200 Subject: PIL's thumbnail function returns NoneType Message-ID: <20090301121548.9a9c055f.miratcanbayrak@gmail.com> Can you try it? it is about me or it is a bug? In [1]: import Image In [2]: im = Image.open("r.png") In [3]: type(im) Out[3]: In [4]: thm = im.thumbnail((200,200)) In [5]: type(thm) Out[5]: -- Mirat Can Bayrak From charly.founes at gmail.com Sun Mar 1 05:34:08 2009 From: charly.founes at gmail.com (cf29) Date: Sun, 1 Mar 2009 02:34:08 -0800 (PST) Subject: cannot execute binary file (Python 3.0.1) References: Message-ID: <0ed82184-1b58-48f1-98b5-8a1431f42409@t7g2000yqa.googlegroups.com> On Mar 1, 12:52?pm, Ned Deily wrote: > It appears you are trying to run a python script by double-clicking on > it and that Python Launcher.app is the default application associated > with .py files. ?The default setting in Python Launcher is to use the > python linked to /use/local/bin/pythonw. ?By default, the OS X 3.0.1 > installer does not install or modify the links in /usr/local/bin/, > unlike 2.x installers. ?That is a problem for Python Launcher. ?Here are > a few options, assuming you used the 3.0.1 python.org installer: > > 1. You can start up the installer again, choose Customize, and then > select and install the "UNIX command-line tools" package. ? > /usr/local/bin/pythonw will now point out at python 3.0.1 rather than > python 2.6. > > -- > ?Ned Deily, > ?n... at acm.org Thank you Ned! The 1. did the trick. Actually I was using the open menu of Python Launcher to open my files. And now it works fine. Usually I use to run python scripts from BBEdit itself and this is now working as expected. What a great place to find answers! Thanks again. Charly http://cf29.com/ From hniksic at xemacs.org Sun Mar 1 05:35:04 2009 From: hniksic at xemacs.org (Hrvoje Niksic) Date: Sun, 01 Mar 2009 11:35:04 +0100 Subject: PIL's thumbnail function returns NoneType References: Message-ID: <87bpslv8dj.fsf@mulj.homelinux.net> Mirat Can Bayrak writes: > Can you try it? it is about me or it is a bug? Neither. im.thumbnail() modifies the existing image object by converting it to a thumbnail. In Python such methods by convention return None. The documentation explicitly mentions that: Also note that this function modifies the Image object in place. If you need to use the full resolution image as well, apply this method to a copy of the original image. This method returns None. > In [4]: thm = im.thumbnail((200,200)) > > In [5]: type(thm) > Out[5]: Instead of thm, simply keep using ihm. From jonas.esp at googlemail.com Sun Mar 1 08:04:56 2009 From: jonas.esp at googlemail.com (Kless) Date: Sun, 1 Mar 2009 05:04:56 -0800 (PST) Subject: Performance of Python 3 Message-ID: Does anybody has seen the performance of Python 3? Respect to speed it's the last language together to Ruby 1.8, but Ruby 1.9 has a lot of better performance. :( http://shootout.alioth.debian.org/u32q/benchmark.php?test=all&lang=all From akitada at gmail.com Sun Mar 1 08:12:09 2009 From: akitada at gmail.com (Akira Kitada) Date: Sun, 1 Mar 2009 22:12:09 +0900 Subject: Performance of Python 3 In-Reply-To: References: Message-ID: <90bb445a0903010512u669b36fav9ec7448a8477d601@mail.gmail.com> Is this what you are looking for? http://shootout.alioth.debian.org/u32q/benchmark.php?test=all&lang=python3&lang2=yarv&box=1 On Sun, Mar 1, 2009 at 10:04 PM, Kless wrote: > Does anybody has seen the performance of Python 3? > Respect to speed it's the last language together to Ruby 1.8, but Ruby > 1.9 has a lot of better performance. :( > > > http://shootout.alioth.debian.org/u32q/benchmark.php?test=all&lang=all > -- > http://mail.python.org/mailman/listinfo/python-list > From lists at cheimes.de Sun Mar 1 08:28:32 2009 From: lists at cheimes.de (Christian Heimes) Date: Sun, 01 Mar 2009 14:28:32 +0100 Subject: Performance of Python 3 In-Reply-To: References: Message-ID: Kless schrieb: > Does anybody has seen the performance of Python 3? > Respect to speed it's the last language together to Ruby 1.8, but Ruby > 1.9 has a lot of better performance. :( Python 3.0 is slower than Python 2.5 and 2.6. Lot's of code was added or modified -- code that hasn't been optimized yet. Python 3's new io library is much slower than the old file type but there will be an optimized version in Python 3.1. The switch over to unicode is a minor speed drain, too. You can look forward for lots of interesting optimizations in Python 3.1 like threaded code (not to be confused with multi-threading) for the VM on GCC platforms, 30bit digists for ints on 64bit platforms, C optimization of the IO stack and more. Christian From hubaghdadi at gmail.com Sun Mar 1 08:31:11 2009 From: hubaghdadi at gmail.com (Hussein B) Date: Sun, 1 Mar 2009 05:31:11 -0800 (PST) Subject: Characters aren't displayed correctly Message-ID: <5a1ed2f0-8e9e-488c-a86b-c7e4646e346e@q11g2000yqh.googlegroups.com> Hey, I'm retrieving records from MySQL database that contains non english characters. Then I create a String that contains HTML markup and column values from the previous result set. +++++ markup = u'''.....''' for row in rows: markup = markup + '
' + row['id'] markup = markup + '
+++++ Then I'm sending the email according to this tip: http://code.activestate.com/recipes/473810/ Well, the email contains ????? characters for each non english ones. Any ideas? Ubuntu 8.04 Python 2.5.2 Evolution Mail Client Thanks. From steve at holdenweb.com Sun Mar 1 08:31:45 2009 From: steve at holdenweb.com (Steve Holden) Date: Sun, 01 Mar 2009 08:31:45 -0500 Subject: Creating Zip file like java jar file In-Reply-To: <86b99462-e1f6-4eca-9f83-a14fcdcb8617@q30g2000prq.googlegroups.com> References: <10a307fa-c6bb-404a-813c-bd5f0e5fa625@v18g2000pro.googlegroups.com> <86b99462-e1f6-4eca-9f83-a14fcdcb8617@q30g2000prq.googlegroups.com> Message-ID: zaheer.agadi at gmail.com wrote: > On Mar 1, 1:32 am, "Gabriel Genellina" wrote: >> En Sat, 28 Feb 2009 16:51:04 -0200, escribi?: >> >> >> >>> On Feb 28, 11:33 pm, Lie Ryan wrote: >>>> zaheer.ag... at gmail.com wrote: >>>>> On Feb 28, 11:15 pm, "Gabriel Genellina" >>>>> wrote: >>>>>> En Sat, 28 Feb 2009 14:34:15 -0200, >>>> escribi?: >>>>>>> I want to create zip file equivalent to java jar file,I created a >>>> zip >>>>>>> file of my sources and added some __main__.py >>>>>>> it says __Main__.py not found in Copyproject.zip..? >>>>>> __main__.py must exist in the root directory. >>>>> What do you mean by root directory..?What is this directory in >>>>> Windows..?You mean the top level folder of the project?in my case >>>>> copyproject folder..? >>>> root directory is the topmost directory (imagine a tree, the root is >>>> where all the branches branched from), in this case the root directory >>>> is your copyproject main folder. >>> I wonder, I do have the __main__.py in the root directory,but still >>> getting >>> python.exe cannot find __main__.py in CopyProject.zip >> The top of the tree inside the zip file. Depth zero. Not inside any >> directory. Above anything else. Just a bare name. >> >> Open your zip using the zipfile module: >> >> import zipfile >> z = zipfile.ZipFile("xxx.zip") >> z.printdir() >> >> You should see a line starting with __main__.py *without* any / in it. >> >>> I used the following command >>> python Copyproject.zip -m __main__.py --uploadFile and also tried with >>> python Copyproject.zip --uploadFile >> Use the second one. >> >>> both give me the same error , I can see the sys.path contains the >>> project folder. > >> -- >> Gabriel Genellina > >> Uh? Which project folder? Isn't it in the .zip? >> > Yeah I meant zip file. > I can get to work but is it is not able to locate the packages,says > import error cant find the package and module > > here is my code > > import sys > import os.path as op > sys.path.insert(0, op.join(op.dirname(op.abspath(__file__)), > "somezip.zip")) > > import zipfile > z = zipfile.ZipFile("somezip.zip") > z.printdir() > > import some.storagepackage.somemodule > print "upload" > print "syspath",sys.path > > #do something > > should it not find the modules when the zip files is in sys.path..? For this to work not only should your zipfile contain some/storagepackage/somemodule.py, but some and some/storagepackage must both contain __init__.py files to be recognized as packages. Have you tried getting your imports working from the file store and then zipping up what works afterwards? regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ From steve at holdenweb.com Sun Mar 1 08:33:19 2009 From: steve at holdenweb.com (Steve Holden) Date: Sun, 01 Mar 2009 08:33:19 -0500 Subject: Bug report: ClientForm In-Reply-To: <49A9CBD2.9020301@mrabarnett.plus.com> References: <49A9CBD2.9020301@mrabarnett.plus.com> Message-ID: MRAB wrote: > Muddy Coder wrote: >> Hi Folks, >> >> As directed, I got ClientForm and played with it. It is cool! However, >> I also found a bug: >> >> When it parses a form, if the VALUE of a field has not space, it works >> very well. For example, if a dropdown list, there many options, such >> as: >> >>