Re: PIL : How to write array to image ???

2009-10-05 Thread Mart.
On Oct 5, 5:14 pm, Martin mar...@hvidberg.net wrote: On Oct 4, 10:16 pm, Mart. mdeka...@gmail.com wrote: On Oct 4, 9:47 am, Martin mar...@hvidberg.net wrote: On Oct 3, 11:56 pm, Peter Otten __pete...@web.de wrote: Martin wrote: Dear group I'm trying to use PIL to write

Re: PIL : How to write array to image ???

2009-10-04 Thread Mart.
On Oct 4, 9:47 am, Martin mar...@hvidberg.net wrote: On Oct 3, 11:56 pm, Peter Otten __pete...@web.de wrote: Martin wrote: Dear group I'm trying to use PIL to write an array (a NumPy array to be exact) to an image. Peace of cake, but it comes out looking strange. I use the

Re: Extracting patterns after matching a regex

2009-09-11 Thread Mart.
On Sep 9, 4:58 pm, Al Fansome al_fans...@hotmail.com wrote: Mart. wrote: On Sep 8, 4:33 pm, MRAB pyt...@mrabarnett.plus.com wrote: Mart. wrote: On Sep 8, 3:53 pm, MRAB pyt...@mrabarnett.plus.com wrote: Mart. wrote: On Sep 8, 3:14 pm, Andreas Tawn andreas.t...@ubisoft.com wrote: Hi, I

Re: Extracting patterns after matching a regex

2009-09-09 Thread Mart.
On Sep 8, 4:33 pm, MRAB pyt...@mrabarnett.plus.com wrote: Mart. wrote: On Sep 8, 3:53 pm, MRAB pyt...@mrabarnett.plus.com wrote: Mart. wrote: On Sep 8, 3:14 pm, Andreas Tawn andreas.t...@ubisoft.com wrote: Hi, I need to extract a string after a matching a regular expression

Re: Extracting patterns after matching a regex

2009-09-08 Thread Mart.
On Sep 8, 2:15 pm, MRAB pyt...@mrabarnett.plus.com wrote: Martin wrote: Hi, I need to extract a string after a matching a regular expression. For example I have the string... s = FTPHOST: e4ftl01u.ecs.nasa.gov and once I match FTPHOST I would like to extract e4ftl01u.ecs.nasa.gov.

Re: Extracting patterns after matching a regex

2009-09-08 Thread Mart.
On Sep 8, 2:21 pm, Mark Tolonen metolone+gm...@gmail.com wrote: Martin mdeka...@gmail.com wrote in message news:5941d8f1-27c0-47d9-8221-d21f07200...@j39g2000yqh.googlegroups.com... Hi, I need to extract a string after a matching a regular expression. For example I have the string...

Re: Extracting patterns after matching a regex

2009-09-08 Thread Mart.
On Sep 8, 2:16 pm, Andreas Tawn andreas.t...@ubisoft.com wrote: Hi, I need to extract a string after a matching a regular expression. For example I have the string... s = FTPHOST: e4ftl01u.ecs.nasa.gov and once I match FTPHOST I would like to extract e4ftl01u.ecs.nasa.gov. I am not

Re: Extracting patterns after matching a regex

2009-09-08 Thread Mart.
On Sep 8, 3:53 pm, MRAB pyt...@mrabarnett.plus.com wrote: Mart. wrote: On Sep 8, 3:14 pm, Andreas Tawn andreas.t...@ubisoft.com wrote: Hi, I need to extract a string after a matching a regular expression. For example I have the string... s = FTPHOST: e4ftl01u.ecs.nasa.gov and once I

Re: Extracting patterns after matching a regex

2009-09-08 Thread Mart.
On Sep 8, 3:14 pm, Andreas Tawn andreas.t...@ubisoft.com wrote: Hi, I need to extract a string after a matching a regular expression. For example I have the string... s = FTPHOST: e4ftl01u.ecs.nasa.gov and once I match FTPHOST I would like to extract

Re: Extracting patterns after matching a regex

2009-09-08 Thread Mart.
On Sep 8, 4:33 pm, MRAB pyt...@mrabarnett.plus.com wrote: Mart. wrote: On Sep 8, 3:53 pm, MRAB pyt...@mrabarnett.plus.com wrote: Mart. wrote: On Sep 8, 3:14 pm, Andreas Tawn andreas.t...@ubisoft.com wrote: Hi, I need to extract a string after a matching a regular expression

Re: Extracting patterns after matching a regex

2009-09-08 Thread Mart.
On Sep 8, 3:21 pm, nn prueba...@latinmail.com wrote: On Sep 8, 9:55 am, Mart. mdeka...@gmail.com wrote: On Sep 8, 2:16 pm, Andreas Tawn andreas.t...@ubisoft.com wrote: Hi, I need to extract a string after a matching a regular expression. For example I have the string... s

Re: regexp help

2009-08-27 Thread Mart.
On Aug 27, 7:15 pm, Bakes ba...@ymail.com wrote: If I were using the code: (?Pdata[0-9]+) to get an integer between 0 and 9, how would I allow it to register negative integers as well? -? -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with arrays

2009-08-26 Thread Mart.
On Aug 26, 3:02 am, Dave Angel da...@ieee.org wrote: Stephen Fairchild wrote: Philip Semanchuk wrote: On Aug 25, 2009, at 6:14 PM, Gleb Belov wrote: Hello! I'm working on an exercise wherein I have to write a Guess The Number game, but it's the computer who's guessing MY number. I can

Re: Help with arrays

2009-08-25 Thread Mart.
On Aug 25, 11:50 pm, Stephen Fairchild someb...@somewhere.com wrote: Philip Semanchuk wrote: On Aug 25, 2009, at 6:14 PM, Gleb Belov wrote: Hello! I'm working on an exercise wherein I have to write a Guess The Number game, but it's the computer who's guessing MY number. I can get it to

[issue5877] Add a function for updating URL query parameters

2009-04-29 Thread Mart Sõmermaa
New submission from Mart Sõmermaa m...@mrts.pri.ee: Proposal Add update_query_params() for updating or adding URL query parameters to urllib.parse and urlparse. Discussion -- Python-dev: http://mail.python.org/pipermail/python-dev/2009-April/088675.html Previously in Python

[issue5479] Add an easy way to provide total ordering now that __cmp__ is deprecated/gone

2009-03-14 Thread Mart Sõmermaa
Mart Sõmermaa m...@mrts.pri.ee added the comment: This is the 2.6 version. What about the 3.0 version in http://docs.python.org/3.0/reference/datamodel.html#object.__lt__ needs to be updated? When functools.total_ordering (whether it lands in functools is open) lands that section should

[issue5479] Add an easy way to provide total ordering now that __cmp__ is deprecated/gone

2009-03-13 Thread Mart Sõmermaa
Mart Sõmermaa m...@mrts.pri.ee added the comment: Then why was this classified as a documentation issue? As the documentation section of http://docs.python.org/reference/datamodel.html#object.__lt__ needs to be updated as well to mark the eventual solution as the recommended easy way

[issue5479] Add an easy way to provide total ordering now that __cmp__ is deprecated/gone

2009-03-12 Thread Mart Sõmermaa
New submission from Mart Sõmermaa m...@mrts.pri.ee: See http://mail.python.org/pipermail/python-dev/2009-March/087000.html and http://code.activestate.com/recipes/576685/ . -- assignee: georg.brandl components: Documentation, Library (Lib) messages: 83490 nosy: georg.brandl, mrts

[issue2090] __import__ with fromlist=[''] causes double initialization of modules

2009-02-02 Thread Mart Sõmermaa
Mart Sõmermaa m...@mrts.pri.ee added the comment: A pointer for people who keep referring to this bug -- after discussions, the following idiom was selected as the official way to import modules by name in 2.x (as seen in latest 2.x docs http://docs.python.org/dev/library/functions.html

[issue4489] shutil.rmtree is vulnerable to a symlink attack

2008-12-29 Thread Mart Sõmermaa
Mart Sõmermaa m...@mrts.pri.ee added the comment: Ah, right you are. Attaching an initial alpha-quality patched shutil.py and a script to test the attack. Run the script by sourcing it with . test_issue4489.sh, not by executing (job control won't work in this case). Added file: http

[issue4489] shutil.rmtree is vulnerable to a symlink attack

2008-12-29 Thread Mart Sõmermaa
Changes by Mart Sõmermaa m...@mrts.pri.ee: Added file: http://bugs.python.org/file12483/test_issue4489.sh ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4489

[issue4489] shutil.rmtree is vulnerable to a symlink attack

2008-12-29 Thread Mart Sõmermaa
Mart Sõmermaa m...@mrts.pri.ee added the comment: And here's the diff so you can review what I was up to. Note that this does not yet fix the problem (although the logic looks about right), I have to examine the problem more thoroughly. -- keywords: +patch Added file: http

[issue4489] shutil.rmtree is vulnerable to a symlink attack

2008-12-29 Thread Mart Sõmermaa
Mart Sõmermaa m...@mrts.pri.ee added the comment: Aha, got it -- while removing /a/b/c/d, there's no easy way to detect that b or c has become a symlink. I.e. given directory tree a `-- b |-- c `-- d 1. os.rmdir('/a/b/c') succeeds 2. execution is suspended 3. '/a/b' is made a symlink

[issue4489] shutil.rmtree is vulnerable to a symlink attack

2008-12-29 Thread Mart Sõmermaa
Mart Sõmermaa m...@mrts.pri.ee added the comment: A blunt, ineffective solution would be to walk the tree before removing it and recording path : inode pairs in a dict on first pass and then checking that the inodes have not changed during removal on second pass. If no clever bulletproof fix

[issue4489] shutil.rmtree is vulnerable to a symlink attack

2008-12-29 Thread Mart Sõmermaa
Changes by Mart Sõmermaa m...@mrts.pri.ee: Removed file: http://bugs.python.org/file12483/test_issue4489.sh ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4489

[issue4489] shutil.rmtree is vulnerable to a symlink attack

2008-12-29 Thread Mart Sõmermaa
Mart Sõmermaa m...@mrts.pri.ee added the comment: Fixed a minor bug in test script and added Perl test as well. Perl with File-Path-2.07 passes the test. Added file: http://bugs.python.org/file12485/test_issue4489.sh ___ Python tracker rep

[issue4489] shutil.rmtree is vulnerable to a symlink attack

2008-12-29 Thread Mart Sõmermaa
Mart Sõmermaa m...@mrts.pri.ee added the comment: Antoine, what if we add another function, rmtree_safe() that uses chdir() and document that it is protected from the race condition but may have the side effect of changing the current dir in threaded environment

[issue4489] shutil.rmtree is vulnerable to a symlink attack

2008-12-29 Thread Mart Sõmermaa
Mart Sõmermaa m...@mrts.pri.ee added the comment: Replying to previous comment: There's no way to do the check inode then remove sequence atomically. Right, although the attack window would be tiny, this is not a real solution. ___ Python tracker rep

[issue4489] shutil.rmtree is vulnerable to a symlink attack

2008-12-28 Thread Mart Sõmermaa
Mart Sõmermaa m...@mrts.pri.ee added the comment: A shameless copy of the Perl fix for the bug http://bugs.debian.org/286922 looks like the evident solution. Somebody has to examine the fix though, I'm afraid I'm not currently able to do it. ___ Python

[issue4489] shutil.rmtree is vulnerable to a symlink attack

2008-12-28 Thread Mart Sõmermaa
Mart Sõmermaa m...@mrts.pri.ee added the comment: Mmmh, the problem with Perl's approach is that it changes the current working directory (calls to chdir()), which is process-specific and not thread-specific. Currently, no function in shutil changes the current working directory, which

[issue4457] __import__ documentation obsolete

2008-12-05 Thread Mart Sõmermaa
Mart Sõmermaa [EMAIL PROTECTED] added the comment: Brett, don't you think the import sys __import__('x.y.z') mod = sys.modules['x.y.z'] idiom should be recommended instead of/additionally to the lengthy getattr() one? ___ Python tracker [EMAIL PROTECTED

[issue4489] shutil.rmtree is vulnerable to a symlink attack

2008-12-02 Thread Mart Sõmermaa
New submission from Mart Sõmermaa [EMAIL PROTECTED]: Race condition in the rmtree function in the shutils module allows local users to delete arbitrary files and directories via a symlink attack. See also http://bugs.debian.org/286922 Attack: --- # emulate removing /etc $ sudo cp -a /etc

[issue4457] __import__ documentation obsolete

2008-11-30 Thread Mart Sõmermaa
Mart Sõmermaa [EMAIL PROTECTED] added the comment: Also, the examples that clarify __import__ behaviour by Nick Coghlan should be added: http://mail.python.org/pipermail/python-dev/2008-November/083735.html --- from foo.bar import baz stack top = __import__('foo.bar', globals(), locals

[issue4438] Add an easy way to __import___ submodules

2008-11-28 Thread Mart Sõmermaa
Mart Sõmermaa [EMAIL PROTECTED] added the comment: Implement imp.import_module() instead. See http://mail.python.org/pipermail/python-dev/2008-November/083758.html Added file: http://bugs.python.org/file12147/imp_import_module.diff ___ Python tracker [EMAIL

[issue4438] Add an easy way to __import___ submodules

2008-11-28 Thread Mart Sõmermaa
Mart Sõmermaa [EMAIL PROTECTED] added the comment: Note that the hack described in http://bugs.python.org/issue2090 should be disabled once this gets integrated. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4438

[issue4438] Given a module hierarchy string 'a.b.c', add an easy way to import tail module 'c'

2008-11-28 Thread Mart Sõmermaa
Changes by Mart Sõmermaa [EMAIL PROTECTED]: -- components: -Interpreter Core title: Add an easy way to __import___ submodules - Given a module hierarchy string 'a.b.c', add an easy way to import tail module 'c' ___ Python tracker [EMAIL PROTECTED

[issue4438] Add an easy way to __import___ submodules

2008-11-27 Thread Mart Sõmermaa
Mart Sõmermaa [EMAIL PROTECTED] added the comment: Corrections and clarifications: * I'd say labeling the patch naive and breaking things was misleading (there was a breakage that resulted from stale files with incorrect permissions from my previous build of Python 2.6; after a make distclean

[issue4438] Add an easy way to __import___ submodules

2008-11-27 Thread Mart Sõmermaa
Mart Sõmermaa [EMAIL PROTECTED] added the comment: See also http://mail.python.org/pipermail/python-dev/2008-November/083727.html ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4438

[issue2090] __import__ with fromlist=[''] causes double initialization of modules

2008-11-26 Thread Mart Sõmermaa
Mart Sõmermaa [EMAIL PROTECTED] added the comment: Just for reference, the simplest workaround is to use: modname = foo.bar.baz.baq mod = __import__(modname, {}, {}, [modname.rsplit(., 1)[-1]]) -- nosy: +mrts ___ Python tracker [EMAIL PROTECTED

[issue2090] __import__ with fromlist=[''] causes double initialization of modules

2008-11-26 Thread Mart Sõmermaa
Mart Sõmermaa [EMAIL PROTECTED] added the comment: See also http://bugs.python.org/issue4438 ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue2090 ___ ___ Python

[issue4438] Add an easy way to __import___ submodules

2008-11-26 Thread Mart Sõmermaa
Mart Sõmermaa [EMAIL PROTECTED] added the comment: Attached is a naive proof-of-concept implementation (that breaks things, i.e. the real implementation should strive for better general compatibility), but works as expected: __import__('imprt.foo.foo', submodule=True) module 'imprt.foo.foo

[issue4438] Add an easy way to __import___ submodules

2008-11-26 Thread Mart Sõmermaa
New submission from Mart Sõmermaa [EMAIL PROTECTED]: The need to dynamically import module foo given a module name string 'bar.baz.foo' is quite common. Quite often, the hack described in http://bugs.python.org/issue2090 is used (see e.g. the Google code results linked from the issue). Quoting

[issue4438] Add an easy way to __import___ submodules

2008-11-26 Thread Mart Sõmermaa
Mart Sõmermaa [EMAIL PROTECTED] added the comment: Just a note that `make test` passes: 322 tests OK. 38 tests skipped: test_aepack test_al test_applesingle test_bsddb test_bsddb185 test_bsddb3 test_cd test_cl test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr

[issue3518] multiprocessing: BaseManager.from_address documented but doesn't exist

2008-10-24 Thread Mart Sõmermaa
Mart Sõmermaa [EMAIL PROTECTED] added the comment: I propose we add the following to that section as well. If you need to provide access to a queue from both local and remote processes, use `multiprocessing.Queue` in the server: from multiprocessing import Process, Queue from

[issue3518] multiprocessing: BaseManager.from_address documented but doesn't exist

2008-10-23 Thread Mart Sõmermaa
Mart Sõmermaa [EMAIL PROTECTED] added the comment: The documentation should be amended as follows: Running the following commands creates a server for a single shared queue which remote clients can access: from multiprocessing.managers import BaseManager import Queue queue = Queue.Queue

[issue3518] multiprocessing: BaseManager.from_address documented but doesn't exist

2008-10-23 Thread Mart Sõmermaa
Mart Sõmermaa [EMAIL PROTECTED] added the comment: Also, it would be helpful to elaborate a bit more on: major: * how to implement a queue that is shared both locally and remotely (i.e. n local processes access the queue as well as m remote processes) minor: * blocking (assumption: q.get