> As far as I can tell, you have a bit more code in boo, and somewhere in
> that code (after the print statement), you rebind the name 'kills'.
Okay, yes:
def boo()
kills += 1
print kills
> the absence of a global declaration, this makes this name a local
> variable.
I think I see what you mean
Hi, I'm sure this is a FAQ, but I have just not found clarity on the
web/docs.
(using monospaced type to show the tree)
trunk:$ tree
.
fp
|-- fontypython
| |-- __init__.py
| |-- cli.py
| |-- config.py
(I start it all with ./fp)
fp says:
import cli
cli.py says:
import os
import config
con
> I've now uploaded a new release of the desktop module which is now, in
> fact, a package:
Thanks Paul, I saw it via the cheese shop rss. I have been too busy to read
this list for a week. I will have a look in due course.
\d
--
http://mail.python.org/mailman/listinfo/python-list
Chris wrote:
> print cli.os.environ['HOME']
I was really confused by your reply until I saw the cli.os part. Okay, I see
what you mean.
\d
--
http://mail.python.org/mailman/listinfo/python-list
> would be a VeryBadThing(tm).
:)
> Having explicits imports in each module is good wrt/ readability.
Okay, I can accept that. I worry that it's opening the module file over and
over again - or does it open it once and kind of re-point to it when it
hits a second import of the same thing?
> pac
> You guess. When fisrt imported, the module's source is executed, a
> module object is created and stored in sys.modules, and the needed names
> are inserted into the importing module's namespace. Next times the
> module is "served" directly from sys.modules.
Peachy, thanks.
\d
--
http://mail.
Hi,
Well, I'm beat. I can't wrap my head around this stuff.
I need to create a list that will contain objects sorted by a "name"
property that is in the alphabetical order of the user's locale.
I used to have a simple list that I got from os.listdir and I could do this:
l = os.listdir(".")
l.so
In follow-up: I think this should work:
# -*- coding: utf8 -*-
import locale
locale.setlocale( locale.LC_ALL, "" )
class Test(object):
def __init__(self,nam):
self.name = nam
def __cmp__(self, other):
return cmp(self.name, other.name)
l = [ Test("ABILENE.ttf"), Te
> Which is even more correct than I hoped for -- in Norwegian, aa is
> pronounced the same as å (which is the 29th letter in the Norwegian
> alphabet) and is sorted according to pronunciation.
Much appreciated bjorn.
\d
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
A soon-to-be happy new year to everyone!
I'm 100% new to this i18n lark and my approach so far has been to create
a .mo file per module in my app.
My thinking was, why load one huge .mo file when a single module only needs
a few strings? Since then, it seems, I have made the wrong decision.
Thanks for taking the time to post those links. I have read most of them
before. They don't seem to cover the basic issue in my OP, but i18n on
Python is a dark art and maybe there's something I missed.
\d
--
http://mail.python.org/mailman/listinfo/python-list
Is there a group better suited to gettext/i18n questions of this sort? Just
wondering because I have little time left to finish my "December" project!
> How does one 'merge' gettext.translations objects together? Or is that
> insane?
>
> What's the best way to handle a project with multiple domai
Thorsten Kampe wrote:
> gettext.textdomain('optparse')
> gettext.install('script', unicode = True)
They speak of a 'global' domain in the docs, but (as is my usual beef with
the Python docs -- see PHP docs for sterling help) there is no clarity.
It *sounds* like there can be a .mo file for *eve
Hello,
I hope someone can illuminate this situation for me.
Here's the nutshell:
1. On start I call locale.setlocale(locale.LC_ALL,''), the getlocale.
2. If this returns "C" or anything without 'utf8' in it, then things start
to go downhill:
2a. The app assumes unicode objects internally. i.e.
Hi,
(Gnu/Linux - Python 2.4/5)
Given these two examples:
1.
./fui.py *.py
2.
ls *.py | ./fui.py
How can I capture a list of the arguments?
I need to get all the strings (file or dir names) passed via the normal
command line and any that may come from a pipe.
There is a third case:
3.
ls *.jpg |
> Try the fileinput module.
I did give the fileinput module a go, but I can't find much info on it and
the help is ... well, it's python help ;)
> in goes to its stdin where it is processed if it has an argument of -
> fileinput works that way
Okay, I did think of the dash, but did not know how to
Paddy wrote:
> ls *.a | ./fui.py -f - *.b
To be sure I grok this: I am seeing the single dash as a placeholder for
where all the piped filenames will go, so *.b happens after *.a has been
expanded and they all get fed to -f, right?
I'm also guessing you mean that I should detect the single dash an
Paddy wrote:
> fileinput is set to process each file a line at a time unfortunately.
Wow. So there seems to be no solution to my OP. I'm amazed, I would have
thought a simple list of strings, one from stdin and one from the args,
would be easy to get.
I *really* don't want to open each file, that
Nick Craig-Wood wrote:
> This iterates over the lines of all files listed in sys.argv[1:],
> defaulting to sys.stdin if the list is empty. If a filename is '-', it
> is also replaced by sys.stdin. To specify an alternative list of
> filenames, pass it as the first argument to input(). A single fil
Hexamorph wrote:
> It's a bit clumsy, but seems to do what I guess you want.
Hey, thanks for that! I will have a go.
\d
--
http://mail.python.org/mailman/listinfo/python-list
oard interrupt?
You might try posix.setsid(), from the child fork.
The object is to get the child fork out of the foreground
process group for the Berkeley terminal driver. This defines
who gets signals, when they originate in terminal control keys.
Donn Cave, [EMAIL PROTECTED]
--
http://ma
uld cheerfully accept this,
given the meager and clumsy support for static typing in languages
like C++, but today, it makes me appreciate Haskell's potential
for complex projects.
Donn Cave, [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
rony because there's no way to know when the data is
ready, and 3rd rate I/O because afterwards you still have the
copying to do. I don't see even this much in asyncore.py, but
I just gave it a glance.
thanks,
Donn Cave, [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
t does support "asynchronous, blocking" with
aio -- as VAX/VMS did (and presumably still does), with event
flags.
Donn Cave, [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ed pipe. When you read from one,
you get end of file, i.e., a normal return with 0 bytes.
When you test it, make sure to try a configuration with more
than one child process. Since the parent holds the write end
of the pipe, subsequently forked child processes could easily
inherit it, and they
tify the backup
error unit, if the command line parameter option isn't available
for some reason.
Donn Cave, [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ome of the maintenance issues, since at least you can upgrade on
your own schedule, but of course it has its costs too. Anyone who
might be thinking about using Python for an application should
seriously think about this.
Donn Cave, [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ation is a lot more fun in some ways,
but I think if you were to apply a sort of conspiracy analysis
to the situation - "who benefits from language change" - this
would be a couple items down on the list of motivations.
Donn Cave, [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
27;t imagine how you could be
convinced of this. Changes to Python in 3.0 won't satisfy
the continuing "need" for change thereafter.
Donn Cave, [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
hey are not better known'
If English isn't your 1st language, you deserve a lot of credit for your
mastery of it, but you need a better dictionary.
Donn Cave, [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ket, dict, whatever?
A sort of generic solution might be to follow str's behavior
with respect to '__str__', extending it to fall back to repr()
whatever goes wrong.
def xtr(a):
try:
return str(a)
except:
return repr(a)
...
27;t see how this is possible if os.path.exists(pth) returns
> True, why is it os.execve() has problems finding it.
I haven't used chroot enough to know all the pitfalls, but
here's one guess: suppose the CGI script file `pth' might
actually be a script, with a `#!' top line t
t;> resulting in the desired result or a typecasting error otherwise.
> >> Furthermore, it could do it more efficiently than a developer having to
> >> put conditional code at the beginning of traditionally typecasting
> >> functions.
I know awk works a bit like that, maybe Perl? but it's
surely way out of place in Python.
Donn Cave, [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
is not connected')
>
> This is despite the client waiting on a socket.recv() statement. Is
> the client really not connected, or is the server unaware of the
> connection? And how do I fix this?
You can either connect() as well as bind(), or use
sendto(data, file)
Do
In article <[EMAIL PROTECTED]>,
"J Rice" <[EMAIL PROTECTED]> wrote:
> Hi Donn,
> Not sure I fully understand your suggestion. bind() only works once --
> I can't bind again in the client. Same thing with connect() -- once I
> issue a connect in
; value, before you can assume that
you got the data you asked for. I would suggest that you print
these values out somewhere, it will put you in a position where
you can probably answer your question better than we can.
Donn Cave, [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ducing strings.
Anyway, it seems unlikely he would get that INVARG error for this
reason. That's an error from the host operating system, not the
interpreter, and it mostly likely refers to the file descriptor.
Since it works for me, I guess his problem is basically this:
|> (python 2.4
servers, but there it's email net protocol data, POP or IMAP. If
Mahogany has been using this format for `local' folders (i.e., via
filesystem), I think that may have been kind of poor judgement on the
part of its developers.
Donn Cave, [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Quoth "David Isaac" <[EMAIL PROTECTED]>:
| Donn Cave, [EMAIL PROTECTED]
|> I suppose it isn't supported by the mailbox module basically because
|> it isn't all that commonly encountered. It may be more common on mail
|> servers, but there it's email net pro
e places
where it may be better to write
if not expr:
than
if expr is None:
or worse yet,
if expr == False:
That's what I think, anyway.
Donn Cave, [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
gs, or open the output file some other way that
creates a file object and use its fileno() function. Flush
stdout before each dup2().
To revert back to the original stdout, you will want a
copy of that stream, which you can get with the os.dup()
function, prior to redirection. All the left over file
than a pipe, but you can probably
get something going with openpty or forkpty from
the os/posix module, or there may still be 3rd
party packages for this.
Donn Cave, [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
exc_traceback = None), the applications
used a terminal graphics library, like curses, and I often
depended on finalization (__del__) to run the "close" rendering
for a graphic element. Worked fine until an exception, so I
add this precaution to every I/O flush.
Donn Cave, [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ents fcntl.flock() with fcntl(2),
I guess on the theory that you can't have enough brain
damage. The worst case would be if Python's configure
missed a bona fide flock(2), which is unlikely but may
be worth checking if you use flock(2) for a reason.
Donn Cave, [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
401 - 444 of 444 matches
Mail list logo