I'm trying to simply imitate what "tail -f" does, i.e. read a file, wait
until it's appended to and process the new data, but apparently I'm
missing something.
The code is:
54 f = file(filename, "r", 1)
55 f.seek(-1000, os.SEEK_END)
56 ff = fcntl.fcntl(f.fileno(), fcntl.F_GETFL)
5
grbgooglefan wrote:
> I am creating functions, the return result of which I am using to make
> decisions in combined expressions.
> In some expressions, I would like to inverse the return result of
> function.
>
> E.g. function contains(source,search) will return true if "search"
> string is found
Hi,
Is there a straightforward way to convert an XML-RPC server application
(written for SimpleXMLRPCServer) to use WSGI so that it can be used as s
fastcgi server? By "straightforward" I mean something simple, without
using some external framework.
Alternatively, I don't really care about WSGI,
joa2212 wrote:
> We have a Sun T1000 with 8 cores and 8 GB of RAM. First, I installed
> Solaris 10 because I know this OS better than Debian Linux. Result:
> poor Performance. After that I decided to migrate to debian:
Do you know the architecture of this machine? It's extremely streamlined
for d
Laurent Pointal wrote:
The ugly part is the 'tmp' name, try to choose a name with a proper
meaning about what it is really, and it become clean and readable:
filerefs = some.big.structure.or.nested.object.with.file.references
filerefs.encoding = "utf-8"
filerefs.name = "MyFileName.txt"
fileref
Hi,
I'm looking for a construct that's similar to (Turbo) Pascal's "with"
statement. I read about the Python's new "with" statement, but I was
dissapointed to learn that it does something different (I still don't
see how it's better than try..except..finally, but that's not my question).
Is there
Amit N wrote:
About 800+ 10-15MB files are generated daily that need to be processed. The
processing consists of different steps that the files must go through:
-Uncompress
-FilterA
-FilterB
-Parse
-Possibly compress parsed files for archival
You can implement one of two easy straightforward
Bruno Desthuilliers wrote:
TheFlyingDutchman a écrit :
Python user and advocate Bruce Eckel is disappointed with the
additions (or lack of additions) in Python 3:
http://www.artima.com/weblogs/viewpost.jsp?thread=214112
I'd say Mr Eckel fails to graps some of the great points about Python's
Mark Dickinson wrote:
> That's because the call to abs() usually collapses two values to one
> (e.g. -2 and 2 both end up being 2),
> but there's only one integer n for which abs(n) == 0.
Ah. Need to sleep more.
signature.asc
Description: OpenPGP digital signature
--
http://mail.python.org/ma
Jeffrey Barish wrote:
> If you take the difference between two uniformly distributed random
> variables, the probability density function forms an isosceles triangle
> centered at 0. Take the absolute value of that variable and the pdf is a
> straight line with maximum value at 0 tapering to 0 at
Hi,
I have a list of items, and need to choose several elements from it,
"almost random". The catch is that the elements from the beginning
should have more chance of being selected than those at the end (how
much more? I don't care how the "envelope" of probability looks like at
this point - can
Jay Loden wrote:
> I was hoping for some experiences that some of you on the list may have had
> in dealing with Python in a high performance and/or threaded environment. In
> essence, I'm wondering how big of a deal the GIL can be in a real-world
> scenario where you need to take advantage of
Hi!
Is there an easy off-the-shelf way to get HTML formatting inside the
TextArea widget? I've looked at TextBuffer but it appears to have only
support for manual applying of attributes to portions of text. I don't
need anything complex, bold, italic and font-size would be enough.
--
(\__/)
(O.o
Bruno Desthuilliers wrote:
>> The error (not an exception, only the message appears and the handler
>> doesn't work):
>>
>> ** (finstall.py:7551): WARNING **: handler for 'on_button_next_clicked'
>> not callable or a tuple
>
> Is this the full message, or did you skip the preceding lines ?
The f
Bruno Desthuilliers wrote:
>> "WARNING: "on_button_clicked" not callable or a tuple"
>
> Please post the relevant code and the full traceback.
The code:
Class W:
def __init__(self):
self.xml = gtk.glade.XML("glade/mainwin.glade")
self.window = self.xml.get_widget("mainwin")
self
John K Masters wrote:
> Can someone point me in the direction of a good tutorial on programming
> python with a GUI? I'm just starting out with python and have written a
> few scripts successfully but would like to add a graphical front end to
> them to make it easier for my work colleagues, most o
Bruno Desthuilliers wrote:
> You're not doing anything wrong, that's just how Python works. "methods"
> are wrapper objects around function objects attributes. The wrapping
> only happens at lookup time, and returns different kind of "method"
> wrapper (resp. unbound or bound methods) if the attri
Marc Christiansen wrote:
> Nope, at least for PyGTK 2 :) See below.
Aaah, but!
> [...]
>> This looks like it should be easy, but I can't find the solution :(
>
> Use the doc, Luke, oops, Ivan :)
> Citing the gtk.glade.XML.signal_autoconnect documentation:
> def signal_autoconnect(dict)
>
[EMAIL PROTECTED] wrote:
> I think you want "dir(instance)" __dict__ returns the instance
Part of the problem is that dir(instance) returns a list of strings, so
iterating the dir(instance) gets me strings, not methods. Alternatively,
is there a way to get a "bound" instance by its name - some
i
While using PyGTK, I want to try and define signal handlers
automagically, without explicitly writing the long dictionary (i.e. I
want to use signal_autoconnect()).
To do this, I need something that will inspect the current "self" and
return a dictionary that looks like:
{
"method_name" : self.
Is it possible to draw a widget or a window in an off-screen buffer?
What I'm trying to do is capture rendered HTML to a bitmap (in other
words, something like html2bitmap) by using wxWindows' HTML widget. If
anyone has a different way of doing it, I'd be glad to hear it...
--
http://mail.python.o
Sebastian 'lunar' Wiesner wrote:
> Carsten Haese <[EMAIL PROTECTED]> typed
>> I don't think that that has anything to do with Linux or not. The
>> script is not the actual executable, hence its suid bit is irrelevant.
>
> I don't think so. From what I know, the script is passed as executable
> to
Ramdas wrote:
> Well,
>
> I need to add users from a web interface for a web server, which runs
> only Python. I need to add users, set quotas and in future even look at
> managing ip tables to limit bandwidth.
>
> I know os.system(), but this has to be done through a form entry
> through a web i
Duncan Booth wrote:
> print "There are"+number+"ways to skin a"+furryanimal
>
> or at least something equivalent to it. If I try to make the same mistake
> with a format string it jumps out to me as wrong:
>
> "There are%sways to skin a%s" % (number, furryanimal)
Related to this, formatting wi
Nico Grubert wrote:
> Is there anything special I have to care about or is installing Python
> on a 64 Bit OS just as easy as installing it on a 32-Bit OS?
It is as easy. Look around, you'll probably find a pre-built binary
package for your OS.
--
http://mail.python.org/mailman/listinfo/python
Andrew MacIntyre wrote:
>> That's only because I need the .readline() function. In C, I'm using
>> fgets() (with the expectation that iostream will buffer data).
>
> The readline method of the file object lookalike returned by makefile
> implements all of the line splitting logic in Python code,
Around three weeks ago there was a thread about Python WebDAV servers,
and I mentioned my "PanDAV" work (old homepage:
http://ivoras.sharanet.org/projects/pandav.html). There was some
interest in continuing the development and merging patches made by its
users, so I requested a SourceForge proj
Andrew MacIntyre wrote:
> Comparative CPU & memory utilisation statistics, not to mention platform
> and version of Python, would be useful hints...
During benchmarking, all versions cause all CPU to be used, but Python
version has ~1.5x more CPU time allocated to it than PHP. Python is 2.4.1
I have a simple network protocol client (it's a part of this:
http://sqlcached.sourceforge.net) implemented in Python, PHP and C.
Everything's fine, except that the Python implementation is the slowest
- up to 30% slower than the PHP version (which implements exactly the
same logic, in a class)
What is the fastest way (execution speed) to backslash-escape characters
from a specific set? Specifically: \r, \n and \0?
(i.e. I need "some\r\nstring\0" to become "some\\r\\nstring\\0")
--
http://mail.python.org/mailman/listinfo/python-list
Kyler Laird wrote:
> Ivan's been working on a problem I've been experiencing with Windows XP
> ("failure to launch"). He sent a new version my way today. I'm going
> to test it tomorrow when I've got some XP users available. If it works
> I'm going to work on putting my changes into a subclass.
Dorian Mcfarland wrote:
> Hi there,
> I have installed python(2.4.3) & trac(0.9.4) on freebsd(4.8) from the
> ports collection and I seem to have an underlying problem with the
> thread module.
> Salling 'import thread' from the python prompt yields the same result.
>
> I have a 'threading.py'
robert wrote:
> maybe thats a good idea to put it on sf.net to boil out all bugs.
> Yet I like it in that simple default manner, maybe switch on those
> additional creation functions with commandline switches (or config class
> instance passed to run..(config=None) )
I'm thinking of making a sm
Kyler Laird wrote:
> I added the ability to create and delete collections (directories),
> delete members (files), authenticate users, and run per-user setuid/
> setgid. It works well with Cadaver but I'm waiting for some MS users
> to report how it works under Windows.
>
> The only thing on my
robert wrote:
>
> thanks, that's exactly to the point:
>
> python server.py 8080 mydavrootfolder
Thanks for the patch, I assume it's free to incorporate it into the
original archive?
Also, see my reply to "Kyler Laird"...
--
http://mail.python.org/mailman/listinfo/python-list
robert wrote:
> For testing purposes I'm looking for a simple DAV server - best a python
> thing serving a folder tree. Don't want to install/change/setup the
> complex apache dav ..
>
You can try this one: http://ivoras.sharanet.org/projects/pandav.html
It's been a while since I last updated
Siah wrote:
> I just launched my django site for a client. My problem is something
> is caching my db data in a bizzar way. Here are some of the behaviours
> I get:
>
> - I login, and every other page it makes me login again for a 5 minutes
> or so and then it remembers that I am logged in.
> -
James Stroud wrote:
> The reasons given in the blog were fairly precise. I think "only on
> vague[...]" is misleading here. The idea of the article was to educate a
> Java user how to change his or her frame of reference to better use Python.
>
> The author was not being territorial as you are
Gregory Petrosyan wrote:
> I have to write _simple_ gui library, for embedding into game. My
> first attempt was to use XML
...
> But after reading "Python Is Not Java"
> http://dirtsimple.org/2004/12/python-is-not-java.html (BTW I'm not a
> Java programmer) I realised that it is actually not
Lee Leahu wrote:
> However, I have encountered the following error after I have started my 381st
> thread:
This number (actually, ~380) is suspicious when seen with threads
because it almost always means running out of process address space. As
threads are part of a single process, and that pr
Dennis Lee Bieber wrote:
> FYI: That's GLOBAL Interpreter Lock
Yes, sorry about the confusion.
--
http://mail.python.org/mailman/listinfo/python-list
Aahz wrote:
>
> When did Perl gain threads?
At least in 2001:
http://mail.python.org/pipermail/python-dev/2001-August/017079.html
http://www.xav.com/perl/lib/Pod/perlthrtut.html
> If you read Bruce Eckel, you also know that
> the Java threading system has been buggy for something like a decade
Neil Hodgson wrote:
>Lua has coroutines rather than threads. It can cooperate with
> threading implemented by a host application or library.
I mentioned it because, as far as I know the Lua's intepreter doesn't do
implicit locking on its own, and if I want to run several threads of
pure Lu
Peter Hansen wrote:
> Ivan, what makes you say that Python is bad for threads? Did the
> qualifcation "concurrently executing/computing" have some significance
> that I missed?
Because of the GIL (Giant interpreter lock). It can be a matter of
opinion, but by "good threading implementation" I
Tuvas wrote:
> waits for a lul in the computing process. How can I ensure that this
> does not happen? This thread uses little processing power, so it could
> be set to a high priority, if there is a way to do this. Thanks!
Python is bad for concurrently executing/computing threads, but it
shoul
Ivan Voras wrote:
> Because "bar and aba happen to be parts of extension library" :)
To end this disussion: I meant "doing it in C" as a colloquial
expression, not a technical one. The expression holds true for every
case where a function/class/module/etc is imple
Fredrik Lundh wrote:
>
> uhuh? so why did you just argue that
>
> if foo.bar():
> bar.aba()
>
> means "doing it in C" if bar and aba happens to be parts of an extension
> library ?
Because "bar and aba happen to be parts of extension library" :)
--
http://mail.python.org/mailman/
Terry Hancock wrote:
> To me, "doing it in C" implies that I must write some C
> code.
Ok, perhaps it is a bit imprecise :)
> In this case, that won't be required at all. Everything the
> OP wants to do can be done exclusively by writing Python
> code. He will, of course, be *using* some exten
Grant Edwards wrote:
> On 2006-02-03, Ivan Voras <[EMAIL PROTECTED]> wrote:
>
>>[EMAIL PROTECTED] wrote:
>>
>>>Actually, manipulating and mixing audio samples can be both fast and
>>>elegant, in Python, if you use Numeric or a similar library.
>>
&g
Fuzzyman wrote:
> Only in as much as doing anything in Python is *really* doing it in C,
> surely ?
>
> Come to that, you're **really** doing it in machine code...
I've yet to see someone calling
if a == '5':
print "it's 5"
machine code. It's the distinction on which level the program's l
[EMAIL PROTECTED] wrote:
> Actually, manipulating and mixing audio samples can be both fast and
> elegant, in Python, if you use Numeric or a similar library.
... at which point you're actually doing it in C, not pure python... :)
--
http://mail.python.org/mailman/listinfo/python-list
Levi Campbell wrote:
> Hi, I'm thinking about writing a system for DJing in python, but I'm
> not sure if Python is fast enough to handle the realtime audio needed
> for DJing, could a guru shed some light on this subject and tell me if
> this is doable or if I'm out of my fscking mind?
Any and al
Jens Theisen wrote:
> cp bigfile bigfile2
>
> cat bigfile > bigfile3
>
> du bigfile*
> 8 bigfile2
> 1032bigfile3
>
> So it's not consumings 0's. It's just doesn't store unwritten data. And I
Very possibly cp "understands" sparse file and cat (doint what it's
meant to do) doesn't :
Rocco Moretti wrote:
> Could it be APL?
No, it was much newer... someone did it as a hobby language.
--
http://mail.python.org/mailman/listinfo/python-list
Jens Theisen wrote:
> Ivan wrote:
>>Yes, but AFAIK the only "modern" (meaning: in wide use today) file
>>system that doesn't have this support is FAT/FAT32.
>
> I don't think ext2fs does this either. At least the du and df commands
> tell something different.
ext2 is a reimplementation of BSD
Steven D'Aprano wrote:
> Isn't this a file system specific solution though? Won't your file system
> need to have support for "sparse files", or else it won't work?
Yes, but AFAIK the only "modern" (meaning: in wide use today) file
system that doesn't have this support is FAT/FAT32.
--
http://m
Robert Kern wrote:
> On OS X,
>
> ≤ is Alt-,
> ≥ is Alt-.
> ≠ is Alt-=
Thumbs up on the unicode idea, but national keyboards (i.e. non-english)
have already used almost every possible
not-strictly-defined-in-EN-keyboards combination of keys for their own
characters. In particular, the key com
[EMAIL PROTECTED] wrote:
> inefficient. Since these data are coming from an OMR scanner at 9600 bps (or
> faster if I can reset it programmatically to 38K over the serial cable), I
> want a fast algorithm.
It depends on your actual environment, of course, but 38kbps is usually
not considered "fa
As it seems that few people are actually using this, I've made a small
update to xmldict library, available here:
http://ivoras.sharanet.org/xmldict.py.gz
Some border-cases involving empty tags and atributes are resolved, and
examples are updated.
WHAT IS IT
--
It's a very small (8KB,
Mike Meyer wrote:
>>A GUI builder is more pleasant to work with, at least
>>with a good one like Delphi or Qt designer.
>
> That is your opinion, and I'm sure it's true for you. It isn't true
> for me.
Not trying to start a war here, but I consider this discussion something
like using regular e
Lawrence Oluyede wrote:
> Python *does* have GUI, you only have to decide which one you prefer.
>
> ps. the customer wants Windows as a platform, we develop on Linux using
> PyGTK, postgre and sql server for some old data. This is the true power of
> cross-platform :)
Maybe the OP really wants a
Mike Meyer wrote:
> The easy way to do all these things - from C, anyway - is with
> daemon(3). That isn't wrapped as part of the Python library. The
> easiest way to solve your problem may be write a wrapper for that
> call. If daemon exists on enough systems, submitting your wrapper as a
> patch
Gerard Flanagan wrote:
> def Square( self ):
> self *= self
You probably mean
return self * self
> A = FibonacciMatrix()
> A.Square()
Make this
A = A.Square()
--
http://mail.python.org/mailman/listinfo/python-list
Thomas Jollans wrote:
> interpreter. This is based on the assumption that py2exe really
> generates a pure exe and not an exe that interprets bytecode python.
> be that the case, it may yield decent results, but ugly nontheless.
It is - py2exe embeds python bytecodes. It seems it does it in the
[EMAIL PROTECTED] wrote:
> I'm creating an persistant index of a large 63GB file
> containing millions of peices of data. For this I would
> naturally use one of python's dbm modules. But which is the
> best to use?
BDB4, but consider using sqlite - it's really simple, holds all data in
a single
Luis P. Mendes wrote:
> I need to build it from the server and also client side.
>
> For the client side I'll be using Python.
>
> But for the server side, I would like to hear some opinions. Is it worth
> learning Php?
If you know Python and don't know PHP, there's little benefit from
spend
poisondart wrote:
> Ultimately I desire two things from the license (but not limited to):
> - being able to distribute it freely, anybody can modify it
> - nobody is allowed to make profit from my code (other than myself)
GPL does something like this, except it doesn't forbid anyone to sell
the
Since the .encoding attribute of file objects are read-only, what is the
proper way to process large utf-8 text files?
I need "bulk" processing (i.e. in blocks - the file is ~ 1GB), but
reading it in fixed blocks is bound to result in partially-read utf-8
characters at block boundaries.
--
ht
Paul Rubin wrote:
>>your active code is then in some library.zip shared between the
>>three, and you need never change alice.exe, bob.exe, and carol.exe
>
> I think I understand what you're saying and it sounds like a very
> good idea. Thanks.
One thing about updating files - sorry if I'm stati
Solved - I didn't know the importance of "proportion" parametar.
--
http://mail.python.org/mailman/listinfo/python-list
Ivan Voras wrote:
> - panel, vertical BoxSizer
> - a single VListBox
Forgot to mention it - I'm using wx.GROW flag on both of them.
--
http://mail.python.org/mailman/listinfo/python-list
I hava a hierarhical sizer layout in which there's a panel in the upper
part of a window with some buttons, and another panel with wxVListBox
that's meant to occupy all the remaining space in the window. Both
panels are put inside a vertical BoxSizer, and the VListBox in its panel
is also in Bo
Peter Hansen wrote:
> call to recv() does not guarantee that the full 608 bytes of data is
Does read() have that guarantee?
--
http://mail.python.org/mailman/listinfo/python-list
Blake T. Garretson wrote:
> I want to save some sensitive data (passwords, PIN numbers, etc.) to
> disk in a secure manner in one of my programs. What is the
> easiest/best way to accomplish strong file encryption in Python? Any
> modern block cipher will do: AES, Blowfish, etc. I'm not looking
Does wxPython (actually, the wx toolkit) support setting up ListCtrls or
similar to allow custom element drawing?
Something like generating an 'OnPaint()' event in which I could paint
whatever I like in a listbox element. (example from some other toolkits)
--
http://mail.python.org/mailman/list
Grant Edwards wrote:
> On 2005-05-03, mahasamatman <[EMAIL PROTECTED]> wrote:
>>password = pasword.decode("base64")
>
> That will delay the attacker for a few minutes.
True, but a script kiddie that only knows about the 'strings' program
will be forever baffled :)
Though deprecated, I think the
Heather Stovold wrote:
> I still need to decide on a database I've really only used Access,
> and my SQL skills aren't that great. It would also need to be free
As many others have suggested, if you're comming from Access, SQLite or
Gadfly would probably be good starting points, b
Jp Calderone wrote:
I want to 'reuse' the same method from class A in class B, and without
introducing a common ancestor for both of them - is this possible in
an elegant, straightforward way?
This is what sub-classing is for. If it makes you feel better, call it
"mixing in" instead. You can
Can this be done: (this example doesn't work)
class A:
def a_lengthy_method(self, params):
# do some work depending only on data in self and params
class B:
def __init__(self):
self.a_lengthy_method = A.a_lengthy_method
# I know that data in "self" of class B o
Grant Edwards wrote:
Huh? wxPythonGTK requires GTK runtimes as well:
He was probably talking about Windows, where wx toolkit uses native
(more or less...) controls.
But then, installing GTK runtime libraries on Windows is a one-click
job, there are automated installers for it.
--
http://mail.py
M.-A. Lemburg wrote:
Not true: mxTidy integrates tidy as C lib. It's not an interface
to the command line tool.
Thanks, I'll look at it again!
--
http://mail.python.org/mailman/listinfo/python-list
Is there a HTML clean/tidy library or module written in pure python? I
found mxTidy, but it's a interface to command-line tool.
What I'm searching is something that will accept a list of allowed tags
and/or attributes and strip the rest from HTML string.
--
http://mail.python.org/mailman/listin
Mage wrote:
foo = dict()
or:
foo = {}
--
http://mail.python.org/mailman/listinfo/python-list
John Machin wrote:
Just a thought: I noticed from the traceback that you are running this
on a Windows box. Profound apologies in advance if this question is an
insult to your intelligence, but you do know that Windows code page
1250 (Latin 2) -- which I guess is the code page that you would be
usi
John Machin wrote:
(Does anyone else feel that python's unicode handling is, well...
suboptimal at least?)
Your posting gives no evidence for such a conclusion.
Sorry, that was just steam venting from my ears - I often get bitten by
the "ordinal not in range(128)" error. :)
--
http://mail.python
Jp Calderone wrote:
You don't have a string fetched from a database, in iso-8859-2, alas.
That is the root of the problem you're having. What you have is a
unicode string.
Yes, you're right :) I actually did have iso-8859-2 data, but, as I
found out late last night, the data got converted to
I have a string fetched from database, in iso8859-2, with 8bit
characters, and I'm trying to send it over the network, via a socket:
File "E:\Python24\lib\socket.py", line 249, in write
data = str(data) # XXX Should really reject non-string non-buffers
UnicodeEncodeError: 'ascii' codec can'
Irmen de Jong wrote:
XML is not known for its efficiency
Surely you are blaspheming, sir! XML's the greatest thing
since peanut butter!
I'm just *waiting* for the day someone finds its use on the rolls of
toilet paper... oh the glorious day...
--
http://mail.python.org/mailman/listinfo/py
Dennis Lee Bieber wrote:
On Sat, 19 Mar 2005 14:36:02 +0100, Ivan Voras <[EMAIL PROTECTED]>
declaimed the following in comp.lang.python:
Hey, IIRC, old Turbo Assembler (tasm, by Borland) had those. Much of it
was still manual, by it supported semi-automatic vtables and such :)
I
[EMAIL PROTECTED] wrote:
I've been searching high and low for a way to simply convert a small
XML configuration file to Python data structures. I came across gnosis
XML tools, but need a built-in option for doing something similar.
I too needed such thing, and made this simple parser:
http://ivora
Dennis Lee Bieber wrote:
You know of an assembly language that does Object Oriented?
My... The world has been waiting with bated breath for that.
Hey, IIRC, old Turbo Assembler (tasm, by Borland) had those. Much of it
was still manual, by it supported semi-automatic vtables and such :)
--
Cappy2112 wrote:
Eric3 has been compiled for Windows, without Cygwin and Without a
commercial license
Can it be downloaded from somewhere? (where from?) Or is it forbidden by
the license?
--
http://mail.python.org/mailman/listinfo/python-list
Mathias Waack wrote:
As I stated I wrote a simple C-program before. The c-program was able
to allocate a bit more than 900MB in 32 bit mode.
Sorry, I should've paid more attention :)
--
http://mail.python.org/mailman/listinfo/python-list
Mathias Waack wrote:
amounts of data. I figured out that a 32 bit application on HP-UX
cannot address more than 1 GB of memory. In fact (I think due to the
overhead of memory management done by python) a python application
cannot use much more than 500 MB of "real" data. For this reason
I don't thi
94 matches
Mail list logo