> 2. Kill the subprocess in a platform independent manner (i.e. no third party
> modules and no hacks).
What's wrong with the .terminate method of the Popen object?
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
> this is very annoying.
Posting to so many lists is even more annoying. You might not get
a single helpful answer just because people are so frustrated by
this behavior.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
o keep the rules in mind
that you want to follow).
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
;t use the official product code, but create your own
one.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
> these threads -- it doesn't add a lot, I think.
shame
1 a. a painful emotion caused by consciousness of guilt,
shortcoming, or impropriety
2 a condition of humiliating disgrace or disrepute
So who do you think should feel guilt? Or should
be disgraced or disreputed?
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
oices.
(FWIW, in 2.x, x>=4?, it's None < numbers < anything else;
numbers are ordered by value, everything else is ordered
by type name, then by address, unless comparison functions
are implemented).
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
John Henry wrote:
How do I determine is something a function?
For instance, I don't want to relying on exceptions below:
def f1():
print "In f1"
def f3():
print "In f3"
def others():
print "In others"
for i in xrange(1,3):
fct = "f%d()"%(i+1)
try:
exec fct
except:
s()
I'd write that as
for i in xrange(1,3):
globals().get("f%d" % (i+1), others)()
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
> sorry for bringing up such an old thread, but this seems important to me
> -- up to now, there are thousands [1] of python programs that use
> hardcoded time calculations.
Would you like to work on a patch?
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
ss it on python-dev.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
> Well, http://bugs.python.org/issue1673409 seems very closely related.
I can't see the relationship. This issue is about conversion methods,
not about arithmetic.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
o bugs.python.org, optionally also post a message
referring to that patch to python-dev.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
> Martin said it but nevertheless it might not be true.
>
> We observed similar very bad behaviour -- in a Web application server.
> Apparently, the standard behaviour is far from optimal when the
> system contains a large number of objects and occationally, large
> numbers of o
ble -- I'm speaking of algorithmic and system
> libraries).
I don't see the connection. Why do you think your
.keys() implementation breaks just because dict.keys
has a different semantics now?
An existing application of an existing dict-like
object will continue to work just fine
from adjusting the Python standard library
itself, and from converting Django to Python 3.
In my experience (from the same applications), by far the most
significant change in Python 3 is the change to the meaning of
string literals, and the disposal of the 2.x str type.
Regards,
Martin
--
http://mail.
t's why they are tunable
parameters), just that the defaults shouldn't change (as the OP was
requesting).
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
at Unicode object contains non-ASCII
parameters.
>> I did, of course, try unicode(e) but that fails.
>
> Converting unicode to unicode doesn't help.
e is an exception object, not a Unicode object.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
> Should I report this as a bug? I suspect it's a misfeature.
Please no. There isn't much that can be done about it, IMO.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
> lib/python/site-packages/psycopg2/_psycopg.so: symbol round:
> referenced symbol not found
You need to link _psycopg.so with the math library, -lm.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
> Martin, could you please tell me how to do this, I am pretty new in
> Solaris.
It's fairly complicated, so I'm not sure I can give you the full
tutorial in a Usenet message.
In essence, you need to spot the linker line in the build process,
(e.g. by the -o option to the compil
> How can I authorise to the Python Cheese Shop in order to use
> setup.py upload? Currently, I get
>
> Upload failed (401): You must be identified to edit package information
You need to add your PyPI password to .pypirc.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
shouldn't even
have to know that the application is written in Python.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
he very least
> there isn't a significant difference in code size between the two
> methods.
>
> I don't know what the equivalent error is called in *nix but assume it
> is PosixError (it isn't)
The common base class to use here is actually OSError. Win
t, I recommend
SixXS (http://www.sixxs.net/). You can setup a tunnel to the IPv6 net
through your IPv4 POP, using a close IPv6 POP who participates in SixXS.
To set up the tunnel, you then use aiccu, which works really well for
me (and is packaged conveniently as a Debian package).
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
cess, you are out of luck. Some systems
just don't support a null device, so Python can't possibly emulate it.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
socket
module, the system does not support mapped sockets.
Unfortunately, there is an exception to the last rule: on Vista,
the option is supported, but Python won't magically know what the
option numeric value is. So on Windows, you need to define
IPV6_V6ONLY yourself (the value is 27), an
l suggested:
def some_thing(s):
return some_thing_real(s.encode("utf-8"))
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
semantics. Why don't
generators follow the usual eager evaluation semantics of Python and
immediately execute up until right before the first yield instead?
Giving generators special case semantics for no good reason is a really
bad idea, so I'm very curious if there is a good reason for i
d you're not going to be
surprised by it. You may still want to change the semantics, but for
reasons that are irrelevant to my point.
Martin
--
http://mail.python.org/mailman/listinfo/python-list
er a query result set in my original post, I see
even less of a problem. Maybe I'm simply daft and you need to spell it
out for me. :-)
Martin
--
http://mail.python.org/mailman/listinfo/python-list
v4vijayakumar wrote:
When I started coding in python, these two things surprised me.
1. my code is inconsistently indented with the combination of tabs and
spaces. Even lines looked intended, but it is not.
Even the standard editor Idle tries to guess the intendation, so this
was never a probl
s Xml
> Schema?
The libxml bindings for Python can do that.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
> Python 2.5.2, so I guess the dependencies must be somewhere there.
> Does Ubuntu have any non-standard lib dir ?
You need to manually install the -dev packages (through aptitude)
before building Python.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
ue class as a base
class, though, rather than starting from scratch.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
ocumentation around.
If you need to find out what option is supported by what widget,
there isn't really much point in duplicating that information in
Tkinter, IMO - the Tk documentation has it all.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
> I just can't figure out how to get the metadata, I guess.
See
http://wiki.python.org/moin/PyPiXmlRpc
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
()
> EnvironmentError: [Errno 22] Invalid argument
I see. This is
http://bugs.python.org/issue678250
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
ove-programs,
select Python, then Repair.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
hon, that will fail: even if installation would succeed, you still
couldn't use the resulting installations, since you just can't mix
the two architectures in a single process.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
32 to create
> a window and a message pump and display it there. I anticipate using pywin32
> for some other function calls.
It also depends on your console. On Linux, with an UTF-8
capable-and-enabled console,
py> print u"\u0413"
Г
work just fine.
Regards,
Martin
--
http://m
g the file openopt-0.19.tar.bz2. If that doesn't help, contact
the setuptools mailing lists.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
ints to existing solutions.
> Can anybody help me ?
I recommend to use distutils. It can already build extension modules
and install them. For testing, you would need to supply your own test
command. Alternatively, try setuptools - there seems to be a test
command already included.
Regards,
Mart
>>>> foolib = cdll.LoadLibrary('foo.so')
>>>> foolib.foo(0xF)
> 0
Shouldn't you tell ctypes that the argument and the result
of foo is a pointer?
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
r/prog/python.html
which has the exact text he quoted. Unfortunately, this text has
foreach in bold, so he might have assumed foreach to be a keyword
(despite the example to the right demonstrating the contrary).
What this has to do with OO, or with numpy, is beyond me.
Regards,
Martin
--
http:
ccess data structure or not. However i have
> no idea how to access the values of a data structure that doesn't
> allow random access.
Can you please explain how you did that in C? IOW, how did you do
the partition function (template) in case you don't have random
access to the co
that allows you to modify the
underlying collection. There is the iter() function/type, but it only
allows read access.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
the ASCII representation with
> escapes for all other characters
You can use the ascii() builtin if you want that.
> especially considering the "repr() should produce output suitable for
> eval() when possible" rule.
But that is preserved under the new behavior, also! Just try
the output encoding to Python, rather than assuming a fixed
UTF-8 output encoding.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
5001, and emit the UTF-8 explicitly.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
run under Linux/Mac, how should I
> call the help file under Linux/Mac.
Provide an HTML tree of the documentation, and use the webbrowser module
to start a browser on it.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
Devin wrote:
> So Python can have unicode variable names but you can't
> "explode" (**myvariable) a dict with unicode keys? WTF?
That works fine for me.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
Devin wrote:
> On Oct 3, 1:57 pm, Peter Otten <[EMAIL PROTECTED]> wrote:
>> "Martin v. Löwis" wrote:
>>> Devin wrote:
>>>> So Python can have unicode variable names but you can't
>>>> "explode" (**myvariable) a dict wit
oesn't mean that you can use all Unicode characters in all places
of the code.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
>
>>>> '\xc3\xab' in 'Arj\xc3\xabn'
> True
>
> I just don't get it, what's the difference?
It's the repr():
py> '\xc3\xab' in 'Arj\xc3\xabn'
True
py> repr('\xc3\xab') in repr('Arj\xc3\xabn')
False
py> repr('\xc3\xab')
"'\\xc3\\xab'"
py> repr('Arj\xc3\xabn')
"'Arj\\xc3\\xabn'"
repr('\xc3\xab') starts with an apostrophe, which doesn't
appear before the \\xc3 in repr('Arj\xc3\xabn').
HTH,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
your application. Don't use byte strings to represent text, but use
Unicode strings all the time, except at the system boundary (where
you decode/encode as appropriate).
There are some limitations with Unicode .lower also, but I don't
think they apply to Russian (specifically, SpecialCasing
lize only once. It is well-known
that initializing the Python interpreter allocates memory that
can never be freed, e.g. global variables in extension modules
(there just isn't any API to tell all the modules to release their
memory). So a cycle of Py_Initialize/Py_Finalize will certainly
leak.
The second form should be used, but not in interactive mode.
In a Python script, make sure you properly declare the encoding
of your script, e.g.
# -*- coding: iso-8859-1 -*-
print u'é'
That should work. If not, give us your Python version, operating
system name, and mode of operation.
ghtly slower.
> And reasons to prefer one?
For what purpose? To find out whether a letter is lower-case?
Just use the .islower() method on the character for that.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
told that the next version of Python will release memory,
> so that's good news. You can get it now if you're willing to build
> Python from the latest source code.
That still won't release all memory - only the arenas that don't
have live Python objects on them anymor
this with Python
2.4 (which is linked with msvcr71.dll), you cannot use PyRun_*File*.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
g of XML (in absence of a
declaration) is UTF-8.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
While I was reading PEP 8 I came across this part:
"""
Function and method arguments
Always use 'self' for the first argument to instance methods.
Always use 'cls' for the first argument to class methods.
"""
Now I'm rather new to programming and unfamiliar to some basic concepts
of OOP.
well just assume ISO 8859-1.
The point is that you can tell UTF-8 reliably. If the data decodes
as UTF-8, it *is* UTF-8, because no other encoding in the world
produces the same byte sequences (except for ASCII, which is
an UTF-8 subset).
So if it is not UTF-8, the guessing starts.
Regards,
Marti
Steven, Bruno, Terry & Duncon, thank you for your insights, it really
helped me a great deal.
--
mph
--
http://mail.python.org/mailman/listinfo/python-list
k of any multi-byte encoding that can't produce
> valid UTF-8 byte sequence.
The same reasoning applies for them.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
n the Python
> version?
Don't use readline/readlines. Instead, read in larger chunks, and break
it into lines yourself. For example, if you think the entire file should
fit into memory, read it at once.
If that helps, try editing gzip.py to incorporate that approach.
Regards,
Martin
--
http://mai
nsions
> for python.
The error message is misleading. It is not the SDK that you need,
but Visual Studio 7.1.
Alternatively, you can try building the extension with the GNU
mingw32 compiler.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
ary likely crashes. In addition to changing the
type of Py_UNICODE, you also need change all calls to
Microsoft API that expects UCS-2 (i.e. all *W API).
Contributions are welcome.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
nge.
If it does change, sys.get_counts() will give you the
number of objects per type.
Furthermore, sys.getobjects() will give you a list of
all objects allocated (excluding the result list).
HTH,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
tf-8 -*-
into the file, or start the file with the UTF-8 signature
(if your editor supports that).
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
1, I suppose).
That's all correct, except for the last parenthetical remark: using
a single-byte character set isn't the same as using Latin-1. There
are various single-byte characters sets; they have names like Latin-2,
Latin-5, Latin-15, KOI8-R, CP437, windows-1252, and so on.
Reg
w whether a certain string literal is meant to denote bytes
or characters, we can't just change the interpretation.
Unicode is a superset of ASCII and Latin-1, but not of byte sequences.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
encode a character, or it might
be that they are parts of two characters, e.g. when you get the
second byte of the first character and the first byte of the
second one. In some encodings (e.g. ISO-2022), these bytes
may indicate *no* character, e.g. when the bytes just indicate
an in-stream ch
Geoffery wrote:
> I want to add some applications to Freevo.
> Let Freevo recgonize the USB device is the one.
> Thank u for your answer.
>
Have a look at 'man 5 usbd.conf'
--
mph
--
http://mail.python.org/mailman/listinfo/python-list
that gzip decompresses the current block
over an over again if the caller only requests 100 bytes each time.
This is a pure guess - you would need to read the zlib source code
to find out.
Anyway, decompressing the entire file at one lets zlib operate at the
highest efficiency.
Regards,
Mart
arge - it might exhaust
your memory. Such a setting shouldn't be the default.
Somebody should research what blocking size works best for zipfiles,
and then compare that in performance to "read it all at once".
It would be good if the rationale for using at most 100 bytes at
a time coul
Hi all,
I was doing some popen2 tests so that I'm more comfortable using it.
I wrote a little python script to help me test that (testia.py):
-
someline = raw_input("something:")
if someline == 'test':
print("yup")
else:
print("nope")
---
onfig.h?
When you compile the file
#include
LOOK HERE: LONG_BIT
with
cc -E -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED=1 a.c
what output do you get after LOOK HERE?
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
gry@ll.mit.edu wrote:
>
> You gave it a single string, not a list(sequence) of strings. Try
> something like:
> std_in.writelines(["notgood"])
>
I got this output then:
>>>
something:
Traceback (most recent call last):
File "F:\coding\pwSync\popen_test\popen_test.py", line 8, in ?
Donn Cave wrote:
>
> 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:
>
> |> (pyt
s intentional, of course: there is no "canonical"
compatibility character for every decomposed code point.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
ore elaborate and
precise than in the early days. Likely, the Unicode consortium found
somebody speaking the Western Armenian dialect (given that many of these
speakers live in North America today); the decision might have been
a mixture of lack of knowledge, ignorance, and perhaps even poli
tp://www.vrplumber.com/programming/mstoolkit/
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
James Thiele wrote:
> Is there a standard way of getting the name of a function from inside
> the function?
No, there isn't.
Martin
--
http://mail.python.org/mailman/listinfo/python-list
right now. However, I can readily
believe that Python easily crashes when invoked
with -U, and I can also believe that it only happens
on some systems.
If you care, please research the cause, and submit a
bug fix. Just submitting the bug report likely won't
react in action (atleast not from
[EMAIL PROTECTED] wrote:
> Hi Everyone
>
> I want to run a python script in all the machines that are connected
> through local network and collect the information about that machine
> such as HDD size, RAM capacity(with number of slots) ,processer speed
> etc.
>
> But i want to run a script fro
Sathyaish wrote:
> And that the "extra-memory" operation I've given above is expensive, I
> believe. Is there an efficient way to do it?
>
If i recall correctly a string is an immutable list.
I would do it this way:
>>> strTXT = "foo"
>>> strREV = strTXT[::-1]
>>> strREV
'oof'
--
mph
--
http
Fuzzyman wrote:
>
From the site:
"Advanced Program for Research In Licensing, whose First Object-Oriented
License"
string = "Advanced Program for Research In Licensing, whose First
Object-Oriented License"
for letter in string:
if ord(letter) in range(65,91):
print(letter),
--
ning None).
What do you want it to return?
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
s don't return anything, not even None (they don't have
a value). If print becomes a function, the question about its return
value becomes meaningful.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
ance has no attribute 'encoding'
What operating system and Python version are you using? This ought to
work.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
trol the actions taken in REINSTALL by setting the
REINSTALLMODE property:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/reinstallmode.asp
So if you want to reinstall everything, you need to set REINSTALLMODE
to, say, "amus" (or "saum").
Regards,
t; True
Ok. But how about that:
py> s='\xe9\xab\x98'
py> ss=u'\u9ad8'
py> s1=s.decode('utf-8')
py> s1==ss
True
Here, ss is a single character, which uses 3 bytes in UTF-8.
In your example, ss has three characters, which are not Chinese,
but European.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
look for _gtk.so on sys.path.
Try copying _gtk.so into the directory where the binary is,
or set PYTHONPATH before running the binary.
If you want to freeze _gtk into the application, you need it as
a static library.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
going to write a Python
extension, an Apache module, or a Linux kernel module in the
near future, start learning C today. If you don't know what you
want to use it for, learning it might be a waste of time, as
you won't know what to look for if you don't have a specific project
in mind.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
language, for that
matter). You will read the book, and might be able to *read* C programs
afterwards. To be able to write them, you need practice, and, for
that, you need a specific inducement.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
That's everybody's choice, of course. If you enjoy programming
languages on their own merits, you won't need further motivation.
However, then you don't post to a newsgroup "should I learn
this language", but you just go ahead and do it.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
nt yourself. It's just very hard to properly learn
> a language without having an idea what to do with it (in fact, I have
> seen people interested to learn programming utterly fail in doing so
> because they had absolutely no clue what to program).
This is my experience also.
R
ne and still don't
> have another.
> Or maybe you have an idea how this can be fixed?
Why do you want to restrict the lifetime of a variable?
If you want the variable to become unassigned, just invoke the del
statement.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
ay, invoke the add method, do
PyObject_CallMethod(s, "add", "O", o);
HTH,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
3701 - 3800 of 4332 matches
Mail list logo