[issue6972] zipfile.ZipFile overwrites files outside destination path

2012-04-07 Thread Thomas W. Barr

Thomas W. Barr t...@rice.edu added the comment:

I'll update my patch to work on the current 3.x head later tonight.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6972
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Creating a very simple revision system for photos in python

2011-03-11 Thread Thomas W
I`m thinking about creating a very simple revision system for photos
in python, something like bazaar, mercurial or git, but for photos.
The problem is that handling large binary files compared to plain text
files are quite different. Has anybody done something like this or
have any thoughts about it, I`d be very grateful. If something like
mercurial or git could be used and/or extended/customized that would
be even better.

We are talking about large numbers of photos and some of them are
large in size as well, but the functionality does not have to be a
full fledged revision system, just handle checking out, checking in,
handling conflicts, rollbacks etc, preferrably without storing
complete copies of the files in question for every operation.

Thanks for any input. :-)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Creating a very simple revision system for photos in python

2011-03-11 Thread Thomas W
On 11 Mar, 17:23, Tim Golden m...@timgolden.me.uk wrote:
 On 11/03/2011 16:05, Chris Hulan wrote:









  On Mar 11, 9:56 am, Thomas Wthomas.weh...@gmail.com  wrote:
  I`m thinking about creating a very simple revision system for photos
  in python, something like bazaar, mercurial or git, but for photos.
  The problem is that handling large binary files compared to plain text
  files are quite different. Has anybody done something like this or
  have any thoughts about it, I`d be very grateful. If something like
  mercurial or git could be used and/or extended/customized that would
  be even better.

  We are talking about large numbers of photos and some of them are
  large in size as well, but the functionality does not have to be a
  full fledged revision system, just handle checking out, checking in,
  handling conflicts, rollbacks etc, preferrably without storing
  complete copies of the files in question for every operation.

  Thanks for any input. :-)

  Most traditional revision systems excel at managing text, but suck at
  binary.
  I recall that Picassa has a revision system

  It occurs to me you could use Uuencoding to make binaries more
  amendable to
  handling by text-oriented revision systems

 I'm not sure there's much point in doing that. Certainly Subversion,
 and I imagine the other main RCS, handle binary data perfectly well;
 I mean, they don't stop when they come across a NUL byte or anything
 like that. You can't do much with the result except retrieve it, but
 I'm not sure that uuencodeing (or any other encoding) adds anything
 there, either.

 FWIW TortoiseSvn offers an image-diff utility which superimposes the
 two versions of an image with an alpha blend (if that's what it's
 called). It's basically the electronic equivalent of holding two
 sheets of paper up to the light. Don't know if this helps the OP,
 mind you.

 TJG

Hmm ... encoding my photos using uuencoding will just eat up space, it
adds about 40% or so ( if I remember correctly ) to the total size of
the encoded file, a file which may allready be 10+ MB. That`s the
problem using git and friends as well; it creates full copies of the
files and that`s part of the thing I want to avoid, if possible.

Sounds like this is a task for more experienced users than me, but I`m
gonna take a stab at it anyway, allthough my ideas for a solution is
pretty basic and simple.

Anyway, thanks a lot for your input :-)

Thomas
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue8005] datetime's comparison methods do not return NotImplemented when they should

2010-04-27 Thread Thomas W. Barr

Thomas W. Barr t...@rice.edu added the comment:

It's just a test. Finishing the patch completely slipped my mind. I'll work on 
it later tonight.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8005
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8005] datetime's comparison methods do not return NotImplemented when they should

2010-04-27 Thread Thomas W. Barr

Thomas W. Barr t...@rice.edu added the comment:

I'm still reasonably new to the codebase, but I'm certainly going to try to fix 
the issue.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8005
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6972] zipfile.ZipFile overwrites files outside destination path

2009-10-01 Thread Thomas W. Barr

Thomas W. Barr t...@rice.edu added the comment:

Even if we can't fix things for this release, presumably it's not too
late to fix things for 2.7, right?

Yes, there certainly are cases where you might want to have creative
usage of symlinks and stored paths to allow overwriting existing files,
and placing files outside of the extraction path, but that doesn't seem
like the default case to me. Would it be a decent compromise to add a
extract_under_path=True default option to extract() and extractall() for
2.7?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6972
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6972] zipfile.ZipFile overwrites files outside destination path

2009-09-29 Thread Thomas W. Barr

Thomas W. Barr t...@rice.edu added the comment:

Uploading patch. This actually should fix my theoretical symlink bug
since realpath() properly follows symlinks. The only thing that I
haven't been able to test is the behavior of realpath() on
case-insensitive operating systems. This should do the right thing, the
path should be normalized, but can someone confirm this?

--
Added file: http://bugs.python.org/file15003/zipfile-6972-patch.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6972
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7008] str.title() misbehaves with apostrophes

2009-09-28 Thread Thomas W. Barr

Thomas W. Barr t...@rice.edu added the comment:

If correct handling of apostrophe's and quotation marks, keeping the
string length unchanged, and only changing desired letters from lower to
uppercase with no other side-effects is the criterion we want, then
what I suggested (toupper() the first character, and any character that
follows a space or punctuation character) should work. (Unless I'm
missing something.) Do we want to tolower() all other characters, like
the interpreter does now?

I can make a test and patch for this if this is what we decide.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7008
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6972] zipfile.ZipFile overwrites files outside destination path

2009-09-28 Thread Thomas W. Barr

Changes by Thomas W. Barr t...@rice.edu:


--
nosy: +twb

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6972
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6606] csv.Sniffer.sniff on data with doublequotes doesn't set up the dialect properly

2009-07-31 Thread Thomas W. Barr

Thomas W. Barr t...@rice.edu added the comment:

Patch uploaded to rietveld: http://codereview.appspot.com/96202/show

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6606
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6606] csv.Sniffer.sniff on data with doublequotes doesn't set up the dialect properly

2009-07-30 Thread Thomas W. Barr

Thomas W. Barr t...@rice.edu added the comment:

The Sniffer.sniff routine doesn't set the doublequote property at all
right now. I'm working on a patch to see if I can add this functionality.

--
nosy: +twb
type: behavior - feature request

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6606
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6606] csv.Sniffer.sniff on data with doublequotes doesn't set up the dialect properly

2009-07-30 Thread Thomas W. Barr

Thomas W. Barr t...@rice.edu added the comment:

Test for this issue.

--
keywords: +patch
Added file: http://bugs.python.org/file14610/test_csv.py.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6606
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6606] csv.Sniffer.sniff on data with doublequotes doesn't set up the dialect properly

2009-07-30 Thread Thomas W. Barr

Thomas W. Barr t...@rice.edu added the comment:

Patch for the issue. Looks for extraneous quote inside the quotes by the
delimiters.

--
Added file: http://bugs.python.org/file14611/csv.py.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6606
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6606] csv.Sniffer.sniff on data with doublequotes doesn't set up the dialect properly

2009-07-30 Thread Thomas W. Barr

Thomas W. Barr t...@rice.edu added the comment:

The documentation doesn't actually say what parameters are sniffed, so
technically, that doesn't need to be changed. Should this be added?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6606
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6606] csv.Sniffer.sniff on data with doublequotes doesn't set up the dialect properly

2009-07-30 Thread Thomas W. Barr

Changes by Thomas W. Barr t...@rice.edu:


Removed file: http://bugs.python.org/file14611/csv.py.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6606
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6606] csv.Sniffer.sniff on data with doublequotes doesn't set up the dialect properly

2009-07-30 Thread Thomas W. Barr

Thomas W. Barr t...@rice.edu added the comment:

Reformatted line in patch.

--
Added file: http://bugs.python.org/file14612/csv.py.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6606
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Start multiple listening servers in one file

2009-01-16 Thread Thomas W
I`m working on a django-project where I`m using the awsome pyftpdlib
for ftpserver-functionality. I also have a simple worker deamon
running in the background, but not listening to any port. How can I
start all of these processes on one file? Tried using subprocess and
popen but that resulted in an eternal loop starting the servers over
and over until all resources were used, then crash.

Any hint on how to do this would be highly appreciated.
--
http://mail.python.org/mailman/listinfo/python-list


pyxml package not working? No xml.dom.ext.reader module available after install.

2007-10-10 Thread Thomas W
I've tried to install the pyxml-package, available at 
http://pyxml.sourceforge.net/,
both from source and using some hack on the win32-binary package
available for python2.4, but without luck. After install the module
xml.dom.ext.reader is not available, eventhough the folder, __init__py
and everything is in place.

Why? And could someone please make a win32-binary package of pyxml for
python2.5? Thanks!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyxml package not working? No xml.dom.ext.reader module available after install.

2007-10-10 Thread Thomas W
On 10 Okt, 11:13, Stefan Behnel [EMAIL PROTECTED] wrote:
 Thomas W wrote:
  I've tried to install the pyxml-package, available 
  athttp://pyxml.sourceforge.net/,
  both from source and using some hack on the win32-binary package
  available for python2.4, but without luck. After install the module
  xml.dom.ext.reader is not available, eventhough the folder, __init__py
  and everything is in place.

  Why? And could someone please make a win32-binary package of pyxml for
  python2.5? Thanks!

 PyXML has not been actively maintained for some years now. Use ElementTree or
 lxml instead.

 http://codespeak.net/lxml

 Stefan

But the problem is that I'm using some piece of code that needs pyxml.
Wouldn't be a problem if I was developing this project myself.

Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list


Virtual filesystem in python ( Fuse or WebDav ? )

2007-10-09 Thread Thomas W
I want to create a virtual filesystem based on a relational database.
It might run as a server on a different machine, but  it has to be
available like a normal filesystem, either shared using SAMBA or
windows filesharing or thru something else like WebDav.

The idea is that I scan a local filesystem and then create relations
between those files stored in a relational database, eg. a create a
group called family, add a bunch of files related to my family in that
virtual group/folder. When the user accesses the virtual filesystem
and types ls or dir the result is a list of groups, in my case ., ..
and family. The user types cd family and dir/ls in that virtual
folder will show all files in that group. How can this be done? I've
looked at dav, especially mod_dav and fuse. I want to be able to
access the files ( and even add files, like if I copy a file into the
family-folder, a relation in the relational database will be created,
but the newly added file itself might be stored some other place on
the filesystem, based on extension or perhaps EXIF-info if it's an
image being added ) using standard filesystem tools, like explorer on
win32 or the shell on linux.

I don't think I can use WebDav directly, because I want to control
what happens if somebody copies a file into a virtual folder, but I
don't know much about webdav so I might be wrong.

Any hint or clue would be appreciated.

-- 
http://mail.python.org/mailman/listinfo/python-list


Dynamic/runtime code introspection/compilation

2006-11-28 Thread Thomas W
Maybe a stupid subject, but this is what I want to do :

I got some python code stored in a string:

somecode = 

from somemodule import ISomeInterface

class Foo(ISomeInterface):
param1 = ...
param2 = 



and I want to compile that code so that I can use the Foo-class and
check what class it extends, in this case ISomeInterface etc. I've
tried eval, codeop etc. but it doesn't work. Something like this would
be nice :

from somemodule import ISomeInteface

d = compile(sourcecode)

myfoo = d.Foo()

print ISomeInterface in myfoo.__bases__

Any hints?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dynamic/runtime code introspection/compilation

2006-11-28 Thread Thomas W
Great !!! That works like charm.

Thanks alot.

Thomas


Leo Kislov wrote:

 Thomas W wrote:
  Maybe a stupid subject, but this is what I want to do :
 
  I got some python code stored in a string:
 
  somecode = 
 
  from somemodule import ISomeInterface
 
  class Foo(ISomeInterface):
  param1 = ...
  param2 = 
 
  
 
  and I want to compile that code so that I can use the Foo-class and
  check what class it extends, in this case ISomeInterface etc. I've
  tried eval, codeop etc. but it doesn't work. Something like this would
  be nice :
 
  from somemodule import ISomeInteface
 
  d = compile(sourcecode)
 
  myfoo = d.Foo()
 
  print ISomeInterface in myfoo.__bases__
 
  Any hints?

 Here is hello world program for plugins:

 import sys

 somecode = 
 class Foo:
param1 = Hello, world!
 

 plugin = type(sys)('unknown_plugin') # Create new empty module
 exec somecode in plugin.__dict__
 
 print plugin.Foo.param1
 
   -- Leo

-- 
http://mail.python.org/mailman/listinfo/python-list


Unicode/ascii encoding nightmare

2006-11-06 Thread Thomas W
I'm getting really annoyed with python in regards to
unicode/ascii-encoding problems.

The string below is the encoding of the norwegian word fødselsdag.

 s = 'f\xc3\x83\xc2\xb8dselsdag'

I stored the string as fødselsdag but somewhere in my code it got
translated into the mess above and I cannot get the original string
back. It cannot be printed in the console or written a plain text-file.
I've tried to convert it using

 s.encode('iso-8859-1')
Traceback (most recent call last):
  File interactive input, line 1, in ?
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1:
ordinal not in range(128)

 s.encode('utf-8')
Traceback (most recent call last):
  File interactive input, line 1, in ?
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1:
ordinal not in range(128)

And nothing helps. I cannot remember hacing these problems in earlier
versions of python and it's really annoying, even if it's my own fault
somehow, handling of normal characters like this shouldn't cause this
much hassle. Searching google for codec can't decode byte and
UnicodeDecodeError etc. produces a bunch of hits so it's obvious I'm
not alone.

Any hints?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Unicode/ascii encoding nightmare

2006-11-06 Thread Thomas W
Ok, I've cleaned up my code abit and it seems as if I've
encoded/decoded myself into a corner ;-). My understanding of unicode
has room for improvement, that's for sure. I got some pointers and
initial code-cleanup seem to have removed some of the strange results I
got, which several of you also pointed out.

Anyway, thanks for all your replies. I think I can get this thing up
and running with a bit more code tinkering. And I'll read up on some
unicode-docs as well. :-) Thanks again.

Thomas



John Machin wrote:
 Thomas W wrote:
  I'm getting really annoyed with python in regards to
  unicode/ascii-encoding problems.
 
  The string below is the encoding of the norwegian word fødselsdag.
 
   s = 'f\xc3\x83\xc2\xb8dselsdag'

 There is no such thing as *the* encoding of any given string.

 
  I stored the string as fødselsdag but somewhere in my code it got
  translated into the mess above and I cannot get the original string
  back.

 Somewhere in your code??? Can't you track through your code to see
 where it is being changed? Failing that, can't you show us your code so
 that we can help you?

 I have guessed *what* you got, but *how* you got it boggles the mind:

 The effect is the same as (decode from latin1 to Unicode, encode as
 utf8) *TWICE*. That's how you change one byte in the original to *FOUR*
 bytes in the mess:

 |  orig = 'f\xf8dselsdag'
 |  orig.decode('latin1').encode('utf8')
 | 'f\xc3\xb8dselsdag'
 | 
 orig.decode('latin1').encode('utf8').decode('latin1').encode('utf8')
 | 'f\xc3\x83\xc2\xb8dselsdag'
 | 

  It cannot be printed in the console or written a plain text-file.

 Incorrect. *Any* string can be printed on the console or written to a
 file. What you mean is that when you look at the output, it is not what
 you want.

  I've tried to convert it using
 
   s.encode('iso-8859-1')
  Traceback (most recent call last):
File interactive input, line 1, in ?
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1:
  ordinal not in range(128)

 encode is an attribute of unicode objects. If applied to a str object,
 the str object is converted to unicode first using the default codec
 (typically ascii).

 s.encode('iso-8859-1') is effectively
 s.decode('ascii').encode('iso-8859-1'), and s.decode('ascii') fails for
 the (obvious(?)) reason given.

 
   s.encode('utf-8')
  Traceback (most recent call last):
File interactive input, line 1, in ?
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1:
  ordinal not in range(128)

 Same story as for 'iso-8859-1'

 
  And nothing helps. I cannot remember hacing these problems in earlier
  versions of python

 I would be very surprised if you couldn't reproduce your problem on any
 2.n version of Python.

  and it's really annoying, even if it's my own fault
  somehow, handling of normal characters like this shouldn't cause this
  much hassle. Searching google for codec can't decode byte and
  UnicodeDecodeError etc. produces a bunch of hits so it's obvious I'm
  not alone.
 
  Any hints?

 1. Read the Unicode howto: http://www.amk.ca/python/howto/unicode
 2. Read the Python documentation on .decode() and .encode() carefully.
 3. Show us your code so that we can help you avoid the double
 conversion to utf8. Tell us what IDE you are using.
 4. Tell us what you are trying to achieve. Note that if all you are
 trying to do is read and write text in Norwegian (or any other language
 that's representable in iso-8859-1 aka latin1), then you don't have to
 do anything special at all in your code-- this is the good old legacy
 way of doing things universally in vogue before Unicode was invented!
 
 HTH,
 John

-- 
http://mail.python.org/mailman/listinfo/python-list


Tutorial on setuptools

2006-10-24 Thread Thomas W
I'm might just be dumb, but I cannot get the hang of usting setuptools
based on the docs at
http://peak.telecommunity.com/DevCenter/setuptools. Is there a simple
example available showing how to pack a few modules, a few scripts,
some resources files ( images ) and list a few dependencies ?

I've searched google and the links I found seemed to be dead or not
about setuptools at all, but as I allready mentioned; I might be
loosing my mind over here so ...

-- 
http://mail.python.org/mailman/listinfo/python-list


The status of Python and SOAP?

2006-10-24 Thread Thomas W
I'm going to give a presentation of python to my co-workers at a very
pro-microsoft workplace. Almost everything we need is currently
supported by the standard distro + the win32all package, but we also
need support for SOAP. I've tried SOAPpy ( didn't get it to compile,
needed a library from a dead site ) and a few others, but I cannot help
the feeling that SOAP isn't very high on the list of priorities in the
python community. I hope I'm wrong.

In short: What library is currently the best alternative to implement
stable, efficient SOAP-webservices, both client and servers? What
library is being actively maintained?

Any hint or help would be great.

-- 
http://mail.python.org/mailman/listinfo/python-list


Read Picasa metadata using Python?

2006-08-17 Thread Thomas W
I know this is slightly off-topic, but since Python is hot at Google
and several key members from the python community works there, I was
hoping to get some help on this subject.

I want to create a small app that reads my Picasa-metadata related to a
specified image and uploads my image and metadata to my
Flickr.com-account ( as far as I know Picasa only support Blogger ).

Anyway, if there are any other app allready reading Picasa metadata
with Flickr-support that you know of that would save me alot of
work/hassle. Still, Picasa is great, but I would really like access to
my own metadata outside Picasa and I want to use python to do it.

Thanks in advance,
Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list



Py2Exe and sys.argv : The Lost Arguments

2006-08-17 Thread Thomas W
I've created a simple script like so :

import sys
import wx

app = wx.PySimpleApp()
dlg = wx.MessageDialog(None, %s % sys.argv, 'A Message Box',
wx.YES_NO | wx.ICON_QUESTION)
retCode = dlg.ShowModal()
app.MainLoop()

If I run this on the command line like
python testcmd.py path-to/somefile.ext path-to/anotherfile.ext

it displays a messagebox with a stringformatted list containing
testcmd.py, somefile.ext and anotherfile.ext.

Then I compile the script using py2exe, generate a file called
testcmd.exe and select the same two files in Explorer, right click,
Open with ..., browse to testcmd.exe and proceed. Now the dialogbox
only shows two items in the list; testcmd.exe and one of the files I
selected. Why?

Is it impossible to compile a script using py2exe and pass selected
items in Explorer to my script? It works fine when called on the
command line so it might be something related to Explorer but I'm
completly lost.

-- 
http://mail.python.org/mailman/listinfo/python-list


Find similar images using python

2006-03-29 Thread Thomas W
How can I use python to find images that looks quite similar? Thought
I'd scale the images down to 32x32 and convert it to use a standard
palette of 256 colors then compare the result pixel for pixel etc, but
it seems as if this would take a very long time to do when processing
lots of images.

Any hint/clue on this subject would be appreciated.

Best regards,
Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list


Using gettext to provide different language-version of a script

2005-11-22 Thread Thomas W
I'm trying to wrap my head around the docs at python.org related to the
gettext-module, but I'm having some problem getting it to work. Is
there any really simple, step-by-step on how to use this module
available?

This is my script so far :

import gettext
gettext.install('test2', '.', unicode=1)
lang1 = gettext.translation('test2', languages=['no'])
print  _('writing a log to file')

in the folder where the test2.py-script lives I've created a
folder-structure like

./locales/NO/LC_MESSAGES/messages.mo

the messages.mo-file I've created using the scripts in the
\Tools\i18l\-folder by running :

python pygettext.py test2.py

and renaming the generated messages.pot-file to messages.po, and
editing it to look like :

# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR [EMAIL PROTECTED], YEAR.
#
msgid 
msgstr 
Project-Id-Version: PACKAGE VERSION\n
POT-Creation-Date: 2005-11-22 13:02+W. Europe Standard Time\n
PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n
Last-Translator: FULL NAME [EMAIL PROTECTED]\n
Language-Team: LANGUAGE [EMAIL PROTECTED]\n
MIME-Version: 1.0\n
Content-Type: text/plain; charset=CHARSET\n
Content-Transfer-Encoding: ENCODING\n
Generated-By: pygettext.py 1.5\n


#: test2.py:5
msgid writing a log to file
msgstr skriver logg til fil

and then run python msgfmt.py messages.po and moving it to

./locales/NO/LC_MESSAGES/messages.mo

When I run

python test2.py

it gives me this error :

Traceback (most recent call last):
  File C:\Program
Files\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py,
line 307, in RunScript
debugger.run(codeObject, __main__.__dict__, start_stepping=0)
  File C:\Program
Files\Python24\Lib\site-packages\pythonwin\pywin\debugger\__init__.py,
line 60, in run
_GetCurrentDebugger().run(cmd, globals,locals, start_stepping)
  File C:\Program
Files\Python24\Lib\site-packages\pythonwin\pywin\debugger\debugger.py,
line 631, in run
exec cmd in globals, locals
  File C:\Program Files\Python24\Tools\i18n\test2.py, line 4, in ?
lang1 = gettext.translation('test2', languages=['no'])
  File C:\Program Files\Python24\lib\gettext.py, line 456, in
translation
raise IOError(ENOENT, 'No translation file found for domain',
domain)
IOError: [Errno 2] No translation file found for domain: 'test2'

Hmmm ... any hints?

Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list


Writing Win32 shell extensions in python?

2005-11-08 Thread Thomas W
Well, is it possible to write Win32 shell extension in python? I want
to create a virtual folder ( like gmailfs ) to serve files from a
http-server ( and no, I cannot use webdav ) so that users can access
them like normal files in Windows Explorer.

Any hints or info about this would be highly appreciated.

Regards,
Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list


Py2Exe produced binary shows terminal screen on execution

2005-11-02 Thread Thomas W
I've produced a binary version of a python-script using Py2Exe and
when run on WinXP it shows a terminal window for a brief moment then
the window disappears. How can I avoid this? I want the script to run
without being visible at all.

Thanks in advance,
Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list


Construct raw strings?

2005-09-07 Thread Thomas W
I got a stupid problem; on my WinXP-box I want to scan the filesystem
and enter a  path to scan like this :

path_to_scan = 'd:\test_images'

This is used in a larger context and joined like

real_path_after_scanning = os.path.join(path_to_scan, somepart, 'foo',
'bar', filename)

Using os.path.exists(real_path_after_scanning) returns false. The
problem is that some of the parts being joined contains escape
characters, like \. If I take the seperate parts and join them using
the interpreter, like :
 f = r'd:\test_images\something\foo\bar\test.jpg'

it works ok and os.path.exists(f) returns True, but I cannot the that
r' in front using the os.path.join-method in my code.

I don't know if this makes any sense at all, but I'm lost. Damn those
stupid windows-paths !! 

Thanks in advance,
Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list


WSGI-server in the standard distro?

2005-08-07 Thread Thomas W
Will there be a WSGI-server like BaseHTTPServer etc in the standard
distro? I think that would increase the adoptation of the
WSGI-standard. A new web-framework for python pops up every other week
and more and more support WSGI. Why not focus on getting an optimized,
production-grade fully documented WSGI-server into the distro? Right
now the BaseHTTPServer seems to be usable for development and testing,
not production environment. Perhaps if there was allready a working
WSGI-server in the distro we could focus on that being ready for real
heavy-loads in production environment instead of making a WSGI-server
for each and every web-framework available ( CherryPy and Django each
got their own WSGI-server written in python, think Twisted has one as
well, but they all claim it's only suitable for testing/development.).

The problem is perhaps the threads vs select ( vs fork? )
discussion/war?? If the distro contained a working thread-based
WSGI-server the select/twisted-camp wouldn't use it anyway?

The beauty of python is that it comes with batteries included, with
servers for CGI, HTML etc. but it doesn't seem like these are ready for
real work. I don't care if some parts of the server has to be done in C
for speed reasons, but it's bummer to allways have to install Apache to
get a production-ready environment. Having a HTTP1.0/1.1-compliant
production-grade WSGI-only server in the distro would be sweet :-)

I might be demanding a bit much here, but still ... Any thoughts?

Anyhow, even a test/development-only WSGI-server implementation should
be in the standard distro IMHO. 

Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list


cx_freeze error : LookupError: no codec search functions registered: can't find encoding

2005-06-09 Thread Thomas W
I get this error when I try to run a freezed exe on my ubuntu 5.04
running Python 2.4 :

LookupError: no codec search functions registered: can't find encoding

I've tried to use --include-modules encodings,codecs when freezing
without luck.

Any hints?

Regards,
Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: cx_freeze error : LookupError: no codec search functions registered:can't find encoding

2005-06-09 Thread Thomas W
Ok, I'll post my findings here since there are allready several
questions about this topic on the net allready :

The solution was to do an explicit import in my module, like so :

from encodings import ascii
from encodings import idna

This solved the problem, at least in my case.

Regards,
Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list


NSLU2 and python - a love story ?

2005-06-01 Thread Thomas W
Has anybody done any work using Python on the Linksys NSLU2[1][2]? I'm
especially interested in stuff related to compiling additional modules,
like PIL. There are allready a bunch of stuff available in the current
replacement-firmware, but PIL seems to be missing.

If you haven't heard about the NSLU2-box yet start with the references
below and then google for it. It's very small, quiet, cheap and runs a
complete linux system, with python available ( and MySQL, PostgreSQL,
Apache etc etc ). It's very cool =)

Anyway, any information related to python and the nslu2-box are of
interest.

Regards,
Thomas

References :
[1] : http://www.nslu2-linux.org/
[2] :
http://www.linksys.com/products/product.asp?grid=35scid=43prid=640

-- 
http://mail.python.org/mailman/listinfo/python-list


Monitoring a USB-drive / Card-reader using python?

2005-06-01 Thread Thomas W
I want to monitor a given USB-device, like a Memory Card-reader, and
when a memory card is inserted I want to move the data on the card to a
different location on the filesystem ( or do something else with the
files).

Does anybody know how to do this ( on Linux and/or windows ) or if it's
even do-able ?

Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: NSLU2 and python - a love story ?

2005-06-01 Thread Thomas W
Well, AFAIK people are running web-sites using apache, php and mysql on
it and with ok performance. I'm not saying this would replace a real
server, but for normal home-use with not too much traffic it seems to
do the job.

It's a fact that Linksys uses a somewhat modified version of linux on
the NSLU2, maybe they don't advertise it on their web-page, but who
cares? They got similar products based on or running linux which also
have replacement-firmware. The point is that alot of people have
modified their NSLU2, which by the way don't remove any of the
functionality of the original product as I understand it, and made it
possible to do cool things with it; run a subversion server for their
projects etc. and by adding up to two large ( 300GB + ) drives you have
enought storage for most things. And FYI the root filesystem can be
stored on one of the USB-devices. It doesn't have to be stored on the
8MB flash.

My interest in it is due to the fact that my current two servers makes
alot of noise, are big and uses alot of eletricity. If I could replace
them with a NLSU2 running linux and python I could use all my allready
developed software on a system costing 1/10th of my current server,
with almost no noise and consume very little eletricity. I just think
that's very interesting.

The first project I have in mind is a web-interface to my digital image
collection, in which I can organise the pictures in categories, add
metadata, generate galleries and slideshows etc. From what I can see
the NSLU2 would have little problems serving this specific purpose, in
addition to serving the images thru samba as well so I can access them
with my laptop, my KISS DP-558 PVR and my XBox. The
distro/replacement-firmware for the NSLU2 allready have most of the
modules I need ( CherryPy, pySQLite/SQLite ). The only thing missing
is, as I said earlier, PIL.

I think anything running linux and especially Python, is awsome, I'll
admit that. Perhaps I'm just blinded by all that and cannot see the
fact that 266Mhz isn't enough juice. But I really do think the NSLU2
is suitable for running a project like I described above, based on the
stuff I've read about other projects using the box. If I'm wrong a
heads up would be great so I can save my money. Save money to buy a
mini mac/mini intel/barebone, because that's the alternative for me
right now, and really silent barebone systems tend to cost alot more,
generate heat and use electricity like a normal computer ( and pack
alot more punch of course ).

I don't own a NSLU2 yet, but intend to buy one soon. If the python
project is successful I'll post some info here.

-- 
http://mail.python.org/mailman/listinfo/python-list


Parsing text into dates?

2005-05-16 Thread Thomas W
I'm developing a web-application where the user sometimes has to enter
dates in plain text, allthough a format may be provided to give clues.
On the server side this piece of text has to be parsed into a datetime
python-object. Does anybody have any pointers on this?

Besides the actual parsing, my main concern is the different locale
date formats and how to be able to parse those strange us-like
month/day/year compared to the clever and intuitive european-style
day/month/year etc.

I've searched google, but haven't found any good referances that helped
me solve this problem, especially with regards to the locale date
format issues.

Best regards,
Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list


Speed of the different python-based HTTP-servers

2005-05-12 Thread Thomas W
I'm thinking of switching from my Twisted-HTTP-server-project to
CherryPy or Snakelets etc etc. The project involves alot of
database-access using SQLObject and SQLite ( perhaps MySQL and
PostgreSQL in the future ) and some heavy IO-stuff ( scanning of local
filesystem to extract meta information about images and storing this
info in the database. This won't happen too often though).

I don't expect this project to have alot of traffic once online, but it
would kinda suck if my software couldn't handle it if it really took
off.

So my question is; based on the very brief description above, are there
any of the python-based frameworks that fits my project better than the
others? And are there some of the frameworks that doesn't scale
particulary well? Benchmarks anyone?

My main focus is simplicity, one of the main reason I'm looking for
something else than Twisted. I'm a little conserned about the
threading-issues when using thread-based frameworks though, but if
speed and scalability would increase dramatically I'm inclined to
struggle with the threads anyhow.

Snakelets and CherryPy both look interesting compared to Twisted ( and
CherryPy seems to have some code available using SQLObject allready,
while Snakelets does not, so I'm leaning towards CherryPy at the moment
).

I want to use ZPT or simpleTAL for templating and SQLObject for
database-access etc if that makes any differences.

Thanks for any input you might have.

Best regards,
Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list


Serving binary data from a cgi-script

2005-05-11 Thread Thomas W
Hi,

I'm having some problems serving binary data in a simple CGI-script.
I'm setting content-type ( application/octet-stream ), content-length
and Content-disposition and I think these are correct, but the size of
the served file/data is different than the source. The read and write
the data I'm doing a plain :

f = open (..., 'rb')
d = f.read(2048)
while d:
  if not d: break
  print d
  d = f.read(2048)
f.close()

Any hints?

Best regards,
Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list


Downloading all files older than 3 hours from a ftp-server.

2005-03-15 Thread Thomas W
I need to download all files older than 3 hours from a ftp-server.
What's the easiest way to this? I've looked into the standard ftplib,
but it seems like the only way to go is to parse the
ftp.retrlines('LIST') command and that seems to be very easy to mess
up. 

any hints? 

Best regards,
Thomas W

-- 
http://mail.python.org/mailman/listinfo/python-list