Thank you! goes to those who helped me find the source of the
problem.
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
it is not the proper thing to do. Is it possible to
force ElementTree to output the XHTML code I need it to?
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
the images and style sheets.. A solution which I find to be particularly
ugly. :-)
Any mod_python users out there with any other solutions?
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
as a subelement of fooElement. Do I need to
traverse the elem tree manually, or is there a way to just 'stick it in
there'?
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
Jan Danielsson wrote:
If have an element tree representing an XML document, and I load
another tree from a file, is there an easy way to stick the second tree
into the first one?
fooElement = ET.SubElement(...)
tree = ET.parse(TEMPLDIR + '/welcome.xml')
elem = tree.getroot
checked the specs, and found a '?' there (but not where I
expected it to be). I just checked the first mention of the header,
and didn't see it marked as optional.
However, I want it to be there, simply because it feels better. I'll
check lxml out.
--
Kind regards,
Jan Danielsson
--
http
Hello all,
This is probably a mind numbingly brain dead question.. But how do I
generate the following:
pCurrent date:br/2000-01-01/p
..using ElementTree? The p element kind of needs two text blocks,
as far as I can tell?
--
Kind regards,
Jan Danielsson
--
http://mail.python.org
'
In [8]: ET.dump(p)
pCurrent date:br /2000-01-01/p
That did the trick. Thanks!
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
of interest. So I'll
just shut up and go away.
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
out of something which isn't XML,
you'll probably have to be a little more specific about how this other
format works.
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
)
c = str(cookies['sessId']).split('=', 1)
...then use c[1]. Is that the proper way? Seems kind of strange to
store the cookies in a dictonary without being able to use the benefits
of them?
--
Kind regards,
Jan Danielsson
And now a word from our sponsor
Jan Danielsson wrote:
[---]
Never mind. Cookie objects have a value attribute -- that's what I
was doing wrong.
--
Kind regards,
Jan Danielsson
And now a word from our sponsor --
Want to have instant messaging, and chat rooms, and discussion
groups for your local
or tips.. Please share them.
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
Hello all,
I writing an application based on the SimpleXMLRPCServer class. I
would like to know the IP address of the client performing the RPC. Is
that possible, without having to abandon the SimpleXMLRPCServer class?
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman
fell in love with: Python
Cryptography Toolkit (http://www.amk.ca/python/writing/pycrypt/).
It's just so ... elegant, and functional.
/IMHO
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
is the best way?And how long would it take before I can develop
applications using python?
Depends on your learning skills, and what kind of applications we're
talking about.
--
Kind regards,
Jan Danielsson
And now a word from our sponsor --
Want to have instant
at for ideas).
Is there any Python/web community site anywhere which allows users to
upload template code for others to use?
Note: I am a Python newbie, so there are probably lots of
improvements to be done, if anyone cares enough).
--
Kind regards,
Jan Danielsson
--
http://mail.python.org
appropriate forum.
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
=None):
pass
---
..is not.
Is this by design? Is it possible to get doxygen to include
standalone functions?
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
of memory fragmentation, etc. But since Python is such a high level
language, I'm not sure my traditional reasoning applies.
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
:
newlist = set(int(e[0]) for e in mylist)
...completely avoiding the design issue I raised altogether. Thanks!
Exactly what I was hoping for! :-)
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
to return the image data, like so:
def barchart(req, params):
some_format = matplotlib.generate_fancy_graph(params)
png_buf = make_png_buffer(some_format)
return png_buf
Is this possible? If so -- how?
--
Kind regards,
Jan Danielsson
And now a word from our sponsor
system?.
I would never claim that multithreading is *easier* than
singlethreaded. It's mererly a different way of thinking.
OTOH, multithreaded does have a steeper learning curve. But once you
get past that, there's really not a lot of difference, IMHO. YMMV.
--
Kind regards,
Jan Danielsson
in Python to extract week numbers from a date.
--
Kind regards,
Jan Danielsson
And now a word from our sponsor --
For a quality usenet news server, try DNEWS, easy to install,
fast, efficient and reliable. For home servers or carrier class
installations with millions
.
.isocalendar()
.thanks()
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
:
self.currentName = text
However, I would like to convert the text (which is utf8) to
latin-1. How do I do that? I've been trying to figure it out for some
time now, and I'm just getting frustrated. :-(
--
Kind Regards,
Jan Danielsson
Te audire non possum. Musa sapientum fixa est
Jan Danielsson wrote:
Hello all,
I'm writing a python script which fetches a HTML-page (using wget),
and then parses the retrieved page using a custom htmllib HTMLParser.
The page I fetch is encoded in utf8, and my text-handler currently
looks like this:
def handle_data(self
example? A simple insertion, and a
simple select is all I'm looking for.
--
Kind Regards,
Jan Danielsson
Te audire non possum. Musa sapientum fixa est in aure.
--
http://mail.python.org/mailman/listinfo/python-list
, and reads it line by line.
I would normally have done it like this:
$ tcpdump -nelttt pflog0 | mypythonscript.py
...however, the Perl script solution looks interresting.. Is it
possible to do something like that in Python?
--
Kind Regards,
Jan Danielsson
Te audire non possum. Musa sapientum fixa
of opinion.
--
Kind Regards,
Jan Danielsson
Te audire no possum. Musa sapientum fixa est in aure.
--
http://mail.python.org/mailman/listinfo/python-list
(self):
This method does blah, blah, blah...
I'm going to assume that Python has some official tool which can be
used to automatically create documentation for a .py-file (like Java
does), but what do I need to do to support it, and how does it work?
--
Kind Regards,
Jan
Jan Danielsson wrote:
In [3]: s.encode('string_escape')
Out[3]: 'Hello\\nWorld!'
In [4]: Out[3].decode('string_escape')
Out[4]: 'Hello\nWorld!'
Not *quite* what you asked for, but it ought to be close enough.
That'll do just fine. Many thanks!
Hmm... On second thought, I need to escape more
functioning for me (I'm using XP on this system). No matter what I
search for, I get no results. A week ago, I got a lot of hits for almost
anything I searched for. Anyone seen this behavior, and knows what to do
about it?
--
Kind Regards,
Jan Danielsson
Te audire no possum. Musa sapientum fixa est in aure
Hello,
I'd like to encode the string that outputs:
Hello
World!
to 'Hello\x0aWorld!', and the string that outputs:
Hello\World!
to 'Hello\\World!'.
Obviously, I want to be able to reverse the process.
I'm going to assume this has already been solved in Python.. But how?
--
Robert Kern wrote:
[---]
In [3]: s.encode('string_escape')
Out[3]: 'Hello\\nWorld!'
In [4]: Out[3].decode('string_escape')
Out[4]: 'Hello\nWorld!'
Not *quite* what you asked for, but it ought to be close enough.
That'll do just fine. Many thanks!
--
Hello all,
I have written my first Python application (apart from small test
programs). It's a (distibuted) white board application. I'm going to
assume that there already are a thousand of them, written in Python, but
just in case someone would find it useful:
Dark Cowherd wrote:
[---]
In case you are interested in bug report.
Always!
class LineTool
method OnLeftUp
needs
self.done = True
or else if you are in Line mode and you just click with out moving the
mouse you get an error.
Many thanks; I can't believe I hadn't stumbled across
Will McGugan wrote:
[---]
You should use the keycode constants.
http://www.wxwidgets.org/manuals/2.6.1/wx_keycodes.html#keycodes
[---]
Excellent! Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Hello all,
I have written a simple whiteboard application. In my application, I
want to be able to set draw attributes. This part works. I have a
dictionary object which contains stuff like:
self.attr['Pen.Color'] = ...
self.attr['Pen.Thickness'] = ...
Now, the problem is that I want to be
Hello all,
How do I find out if a blocking socket has data available [for
reading] on it?
I assume I could do something like this:
tmp = self.read(1, socket.MSG_PEEK)
if len(tmp) 0:
# Data available
But is there a better way? A call which specifically checks if data
is available?
--
Hello all,
How do I make a python script actually a _python_ in unix:ish
environments?
I know about adding:
#!/bin/sh
..as the first row in a shell script, but when I installed python on
a NetBSD system, I didn't get a python executable; only a python2.4
executable.
Adding
Hello all,
I recently started using Python, and I must say I like it. Both the
language and libraries available for it.
Background: I have written an application which I use to keep track
of my personal economy. I wrote it in Java because I wanted to learn the
language for a course in
Robert Kern wrote:
I wanted to plot some statistics, so I wrote a simple wxPython class
to do it. Then I realized that I would like to draw bar graphs, so I
added that too.
Since I'm a complete Python newbie, I haven't done much of it the
Python way, I suspect. So, I'm wondering if
Robert Kern wrote:
[---]
It's okay. Just about every Pythonista in the sciences has, at one time
or another, started a plotting library. It's a rite of passage. Welcome
to the club. :-)
Question: I need to install SciPy in order to use matplotlib,
No you don't.
Ah.. I misread. I
Sorry, but I Just Don't Get It. I did search the 'net, I did read the
FAQ, but I'm too dumb to understand.
As far as I can gather, __str__ is just a representation of the
object. For instance:
class ServerConnection:
def __str__(self):
buf = Server: + self.name + \n
buf +=
Hello all,
I'm 100% sure that I saw an example which looked something like this
recently:
a=(1, 2, 3, 4, 5, 6)
b=(2, 3, 6)
a - b
(1, 4, 5)
The only new language I have been involved in lately is Python. Is my
memory failing me, or have I seen such an Python-example somewhere? If
so:
Hello all,
I have a list of servers which an application connects to. If the
connection fails, the application should mark the server as temporarily
unavailable, and should try to use the server again after x units of time.
In C, I would do this:
server.invalidUntil = time(NULL) + 5*60; //
Grant Edwards wrote:
In C, I would do this:
server.invalidUntil = time(NULL) + 5*60; // five minute delay
In Python, I would do this:
server.invalidUntil = time.time() + 5*60 # five minute delay
Ah. Well. Um. I feel like an idiot. I found datetime by accident, and
thought it involves
Hello all,
Is there any way to create a file with a specified size?
--
http://mail.python.org/mailman/listinfo/python-list
Erik Max Francis wrote:
Is there any way to create a file with a specified size?
What do you want to put in the file? Once you've answered that
question, the solution should present itself.
Check blocks from an FEC-encoder (Freenet, more specifically).
The problem is that the design
Grant Edwards wrote:
Is there any way to create a file with a specified size?
What do you want to put in the file? Once you've answered that
question, the solution should present itself.
Check blocks from an FEC-encoder (Freenet, more specifically).
The problem is that the design I'm
Hello all,
I have a list of integers:
q = [ 1, 2, 4, 7, 9 ]
which I would like to convert to a string:
1,2,4,7,9
This is *very* easy to do with a simple while loop.. But I suspect
that there is a more elegant way to do it in Python. Is there? If so: How?
--
Hello all,
Behold:
--
a = [ 'Foo', 'Bar' ]
b = [ 'Boo', 'Far' ]
q = [ a, b ]
print q[0][0]
print q[1][1]
a[0] = 'Snoo'
b[1] = 'Gnuu'
print q[0][0]
print q[1][1]
--
This will output:
Foo
Far
Snoo
Gnuu
I assume it does so because q stores _references_ to a and b. How
would
In OS/2 C, I would do this:
main()
{
...
DosCreateMutexSem(NULL, hmtx, 0UL, FALSE);
...
}
thread()
{
...
DosRequestMutexSem(hmtx);
Locked!
DosReleaseMutexSem(hmtx);
...
}
How would I go about doing that in Python?
I figured this part out:
lockobj = mutex()
lockobj.lock(foo, bar)
Locked!
Reinhold Birkenfeld wrote:
[---]
How would I go about doing that in Python?
I think you will want to create a threading.Lock object.
It would seem so. Thanks for the tip!
--
http://mail.python.org/mailman/listinfo/python-list
57 matches
Mail list logo