How can I watch the messages being sent back and for on urllib shttp
requests? If it were simple http I would just watch the socket traffic
but of course that won't work for https. Is there a debug flag I can
set that will do this?
context: I am dealing with a web service bug and I want to tell
I'm looking for something like Tcl's [clock scan] command which parses
human-readable time strings such as:
% clock scan "5 minutes ago"
1246925569
% clock scan "tomorrow 12:00"
1246993200
% clock scan "today + 1 fortnight"
1248135628
Does any such package exist for Python
I'm sure this is a FAQ, but I certainly haven't been able
to find an answer.
Is it possible to set the program name as seen by the
operating system or lower-level libraries?
I'm connecting to a database, and the runtime helpfully
sends some information to the server, such as username,
pid, and pr
John Machin wrote:
> T=lambda x:x in(25401,25402,25408);import dis;dis.dis(L);dis.dis(T)
I've learned a lot from this thread, but this is the
niftiest bit I've picked up... thanks!
--
Mark Harrison
Pixar Animation Studios
--
http://mail.python.org/mailman/listinfo/python-list
Is there any reason to prefer one or the other of these statements?
if e.message.code in [25401,25402,25408]:
if e.message.code in (25401,25402,25408):
I'm currently using [], but only coz I think it's prettier
than ().
context: these are database errors and e is database excepti
Cameron Simpson wrote:
> - Keep the "#!/usr/bin/env python" and then:
> ln -s /usr/anim/menv/bin/pypix /usr/local/bin/python
Ah, that's a good idea. The pypix is a company-wide maintained
python, but ln -s python pypix on my local Mac laptop python
install makes the env work quite nicel
Benjamin Peterson wrote:
> #!/usr/bin/env python
But how can I handle this with two differently named pythons?
#!/usr/anim/menv/bin/pypix
#!/Users/mh/py/bin/python
Thanks!
Mark
--
Mark Harrison
Pixar Animation Studios
--
http://mail.python.org/mailman/listinfo/python-list
I've got a bunch of python programs on linux that start with:
#!/usr/anim/menv/bin/pypix
Now I'm moving some to the mac, where I'm changing that to:
#!/Users/mh/py/bin/python
What's the best way to handle this? I've got an install script
that rewrites the f
Paul McGuire wrote:
> Pyparsing will easily carve up these function declarations, and will
I didn't know about this module, it looks like what I was looking
for... Thanks!!!
--
Mark Harrison
Pixar Animation Studios
--
http://mail.python.org/mailman/listinfo/python-list
Robert Kern wrote:
> On 2009-02-26 15:29, m...@pixar.com wrote:
> Use the compiler module to generate an AST and walk it. That's the real
> way. For me, that would also be the quick way because I am familiar with
> the API, but it may take you a little bit of time to get used to it.
ah, that's
I have some strings that look like function calls, e.g.
"junkpkg.f1"
"junkpkg.f1()"
"junkpkg.f1('aaa')"
"junkpkg.f1('aaa','bbb')"
"junkpkg.f1('aaa','bbb','ccc')"
"junkpkg.f1('aaa','with,comma')"
and I need to split them into the function name and li
J. Clifford Dyer wrote:
> Just google for call-by-object, and ignore the hell out of that thread.
Now I've got to go read it! ;-)
--
Mark Harrison
Pixar Animation Studios
--
http://mail.python.org/mailman/listinfo/python-list
Chris Rebert <[EMAIL PROTECTED]> wrote:
> Not directly possible or encouraged. You can emulate it by sticking
> the value in a container object (e.g. list) though:
Thanks, that's just what I needed. I'm using this to monkeypatch
a test driver into some code that I can't touch, otherwise
I would
How can I make a "var" parm, where the called function can modify
the value of the parameter in the caller?
def f(x):
x = x + 1
n = 1
f(n)
# n should now be 2
Many TIA!!
Mark
--
Mark Harrison
Pixar Animation Studios
--
http://mail.python.org/mailman/listinfo/python-list
I am really loving the output, and have started using RST for some
of my own docs as well.
It's wonderful and I know it was a lot of work on somebody's part
to think it through and make the changes.
If it was you, Many Thanks!!!
--
Mark Harrison
Pixar Animation Studios
--
http://mail.python.org
I've got some python xmlrpc servers and clients.
What's the best way to accelerate them?
xmlrpclib.py attempts to import these modules:
import _xmlrpclib
import sgmlop
from xml.parsers import expat
and falls back to defining the SlowParser class.
So, which of these modules is the pr
"Martin v. Lowis" <[EMAIL PROTECTED]> wrote:
> The definition in logic, in turn, matches my understanding of the
> English word "to comprehend": If I know all attributes, marks,
> etc of an object, I understand it fully, i.e. I comprehend it.
I think also that as was pointed out, "comprehension" m
Chris Rebert <[EMAIL PROTECTED]> wrote:
> the term
> "comprehension" for the concept was first used in the NPL programming
> language (Wikipedia again).
Ah, thanks... and does "comprehension" have any special computer
science meaning?
--
Mark Harrison
Pixar Animation Studios
--
http://mail.pytho
I googled and wiki'ed, but couldn't find a concise clear answer
as to how python "list comprehensions" got their name.
Who picked the name? What was the direct inspiration, another
language? What language was the first to have such a construct?
I get that it's based on set notation.
Thanks!
Ma
Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> Now you can monkey patch class A if you want. It's probably not a great
> idea to do this in production code, as it will effect class A everywhere.
>
This is perfect for me. The code in question is basically a protocol
translator... it receives reque
I am instantiating a class A (which I am importing from somebody
else, so I can't modify it) into my class X.
Is there a way I can intercept or wrape calls to methods in A?
I.e., in the code below can I call
x.a.p1()
and get the output
X.pre
A.p1
X.post
Many TIA!
Mark
class A:
[EMAIL PROTECTED] wrote:
> Is there a way to import a module from one of these subdirectories?
> Any other more pythonic ways to approach the situation?
ah, the magic of __init__.py.
Thanks all!
--
Mark Harrison
Pixar Animation Studios
--
http://mail.python.org/mailman/listinfo/python-list
I'm currently sharing a directory on sys.path with another
group.
We don't have the option to modify sys.path.
In order to reduce conflicts between the two group's code,
installation procedures, etc, I'd like to make a subdirectory
for each group, and have each group manage their own subdirectory
Vinay Sajip <[EMAIL PROTECTED]> wrote:
> Did you try setting logRequests to false?
Perfect, that's just what I needed.
Thanks Vinay!!
Mark
--
Mark Harrison
Pixar Animation Studios
--
http://mail.python.org/mailman/listinfo/python-list
My SimpleXMLRPCServer program prints to stderr a line like
this for each request:
ohm..pixar.com - - [25/Sep/2008 17:57:50] "POST /RPC2 HTTP/1.0" 200 -
Is there a way to turn this logging off? I have RTFM and can't
seem to find a way to do so.
Many TIA!
Mark
--
Mark Harrison
Pixar Animation S
I want to interate over two arrays in parallel, something like this:
a=[1,2,3]
b=[4,5,6]
for i,j in a,b:
print i,j
where i,j would be 1,4,2,5, 3,6 etc.
Is this possible?
Many TIA!
Mark
--
Mark Harrison
Pixar Animation Studios
--
http://mail.python.org/mailman/listi
Paul McNett <[EMAIL PROTECTED]> wrote:
> When confronted with this type of question, I ask the interpreter:
> >>> [1,2,3] == [1,2,3,]
> True
Well I guess that's a pretty authoritative answer... thanks!
--
Mark Harrison
Pixar Animation Studios
--
http://mail.python.org/mailman/listinfo/python-li
x=[1,2,3]
and
x=[1,2,3,]
are exactly the same, right?
I'm generating some python data, and it's less error prone
to not treat the last element specially, but I want to be
sure I'm generating an equivalent data structure.
Many TIA!
Mark
--
Mark Harrison
Pixar Animation Studios
--
http://mail.py
What's the best Python idiom for this C construct?
while ((x = next()) != END) {
}
Now I'm doing
x = next()
while x != END:
x = next()
There's not an iterator for this function, or I would
just use
for x in ...
Many TIA!
Mark
--
Mark Har
The following bit of code will allow an instance member to
be called by reference. How can I map a string (e.g.
"hello1" or "Foo.hello1" to a the instance member?
class Foo:
def hello1(self, p):
print 'hello1', p
def hello2(self, p):
print 'hello2', p
def dispatch(self
I'm writing a select-based server, and some of the client
connections will want to send an xml-rpc request.
Is there a class in the http hierarchy that will allow
me to manage a socket, and allow me to instantiate the
class like
myhttpserver = SomeHTTPServer(mysocket)
and then let me call so
I'm porting a C lex/yacc based project, and would like to redo
it in python.
What's the best option for a python lex/yacc-like? I've
googled a few things, but wanted to see the current concensus.
Many TIA!
Mark
--
Mark Harrison
Pixar Animation Studios
--
http://mail.python.org/mailman/listinfo
I want to iterate over members of a module, something like:
for i in dir(x):
if type(i) == types.FunctionType: ...
but of course dir() returns a list of strings. If x is a module,
how can I get the list of its members as their actual types?
Many TIA!
Mark
--
Mark Harrison
Pixar An
I'm cleaning up some old code, and want to see what orphan
functions might be sitting around.
Is there a static call tree analyzer for python?
Many TIA!
Mark
--
Mark Harrison
Pixar Animation Studios
--
http://mail.python.org/mailman/listinfo/python-list
I currently have a 2-dim hash, indexed by two strings:
template['py']['funcpre']
template['py']['funcpost']
...
but I would prefer to have these indexed by constants of
some kind, since this seems a bit more natural:
template[py][funcpre]
template[py][funcpost]
...
Curre
John Machin <[EMAIL PROTECTED]> wrote:
> Yes they will be cached.
great.
> But do yourself a favour and check out the
> string methods.
Nifty... thanks all!
--
Mark Harrison
Pixar Animation Studios
--
http://mail.python.org/mailman/listinfo/python-list
I've got a bit of code in a function like this:
s=re.sub(r'\n','\n'+spaces,s)
s=re.sub(r'^',spaces,s)
s=re.sub(r' *\n','\n',s)
s=re.sub(r' *$','',s)
s=re.sub(r'\n*$','',s)
Is there any chance that these will be cached somewhere, and save
me the trouble of having to declare som
Stefan Behnel <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > I'm parsing a log file that's being written out in
> > real time.
> > This is part of an event loop, so I want to have some code
> > that looks like this:
> >
> >when logfile is readable:
> >read one node, includin
So, I'm parsing a log file that's being written out in
real time.
123foo
456bar
<--- no , coz the file hasn't yet been closed
This is part of an event loop, so I want to have some code
that looks like this:
when logfile is readable:
read one node, including children
I don't have access to site-packages, but I would like
to provide versions of my c-language package compiled against
python 2.4 and 2.5.
I "own" a library directory which is included in our site's
sys.path. Currently this is where the 2.4 shared libary
is installed.
What's the most canonical way
So on most modules I import, I can access the .__file__ attribute to
find the implementation. ie:
>>> import time
>>> time.__file__
'/data1/virtualpython/lib/python2.3/lib-dynload/timemodule.so'
>>> import socket
>>> socket.__file__
'/data1/virtualpython/lib/python2.3/socket.pyc'
This doesn't wor
Hi Folks-
I'm trying to do a simple emulation of unix "locate" functionality in
python for windows.
Problem is I don't want to crawl/index optical drives. Do any of the
windows people out there know how I can determine:
1. How many drives are on the system? (I could just iterate over the
alpha
The Spike Asset Manager reports on the cpu speed and amount of memory
for linux, macosx, windows and solaris.
http://spike-asset-mgr.spikesource.com/
matt
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik-
This is a known issue. The tool currently only looks in certain
locations or hints rather then spidering the whole hard drive (which
could take a bit of time). If you have installed in a non-standard
location (or are using a platform or version of software that hasn't
been tested agains
The idea is to have a framework to do this in a semi-crossplatform
manner. The framework could be updated to know about apt, portage
repositories as well as talk to to the windows registry.
Not everyone is running redhat ;)
--
http://mail.python.org/mailman/listinfo/python-list
Spike Asset Manager (SAM) is an open-source cross-platform framework
written in python for probing a system for components and reporting
them. It includes a driver file that probes for components commonly
found in a LAMPJ stack (Apache, MySQL, PHP, Tomcat, etc). Note that
the L in LAMP could be Li
46 matches
Mail list logo