ot;env" parameter have to be ASCII,
not Unicode, even though Windows fully supports Unicode in CreateProcess.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
odule named on the Python command
line. Is that correct? Thanks.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Benjamin wrote:
> On Jan 14, 6:26 pm, Bjoern Schliessmann [EMAIL PROTECTED]> wrote:
>> John Nagle wrote:
>>> It turns out that the strings in the "env" parameter have to be
>>> ASCII, not Unicode, even though Windows fully supports Unicode in
>>> C
Miki wrote:
> http://docs.python.org/lib/module-imp.html
Ah. "imp.find_module". I was looking in "sys" and
path-related places. Thanks.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
instance.
I need its path so I can start it in a subprocess.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Diez B. Roggisch wrote:
> John Nagle wrote:
>
>> Benjamin wrote:
>>> On Jan 14, 6:26 pm, Bjoern Schliessmann >> [EMAIL PROTECTED]> wrote:
>>>> John Nagle wrote:
>>>>> It turns out that the strings in the "env" parameter have
nicode.
The DOS/Win16/Win9x family did not. But they did have CreateProcess.
So the current code will handle Win9x, but not Unicode.
When do we drop support for Win9x? It probably has to happen in
Python 3K, since that's Unicode-everywhere.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
oad" reaches an end of
file, it properly raises EOFError. So it's OK to do "load" after
"load" until EOFerror is raised.
"pickle" and "cPickle" seem to be interchangeable in this application,
so that works.
It's a useful way to talk to a subprocess, but you need to know all the
issues above to make it work.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Irmen de Jong wrote:
> Christian Heimes wrote:
>> John Nagle wrote:
>>> It's possible to use "pickle" for interprocess communication over
>>> pipes, but it's not straightforward.
>>
>> IIRC the processing module uses pickle for IPC. May
code
if errorcode == kmysqlduplicateentry : # if dup on insert
... deal with duplicate entry
If Django has a problem, you'll have to take that up with them.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
John Nagle wrote:
> Irmen de Jong wrote:
>> Christian Heimes wrote:
>>> John Nagle wrote:
>>>> It's possible to use "pickle" for interprocess communication over
>>>> pipes, but it's not straightforward.
Another "gotcha".
ader info.
Don't read the content at all.
Setting the socket timeout will shorten the timeout when the requested
domain won't respond at all. But if the remote host opens an HTTP connection,
then sends nothing, the socket timeout is ineffective and you wait for a while.
This is rare,
Carl Banks wrote:
> On Jan 17, 2:28 pm, John Nagle <[EMAIL PROTECTED]> wrote:
>
>> It's also necessary to call Pickle's "clear_memo" before each "dump"
>> call, since objects might change between successive "dump" calls.
>>
Paul Boddie wrote:
> Unlike your approach, pprocess employs the fork system call.
Unfortunately, that's not portable. Python's "fork()" is
"Availability: Macintosh, Unix." I would have preferred
to use "fork()".
ke to avoid having a thread to manage each pipe, but if I
have to, so be it.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Scott David Daniels wrote:
> John Nagle wrote:
>>I need some way to find out if a pipe has data available for
>> a read without blocking if it does not.
> ...
>> I'd like to avoid having a thread to manage each pipe, but if I
>> have to, so be it.
>
>
2. Please check.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
How can I tell whether an object is of type Exception?
At least in Python 2.4, "Exception" is an old-style class, and
the "type" of Exception objects is "instance".
Clearly "repr" knows; it returns:
elf. Fan out the incoming file into
one file for each first letter, sort each subfile, merge the
results.
With DRAM at $64 for 4GB, I'd suggest just getting more memory and using
a standard in-memory sort.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Paul Rubin wrote:
> John Nagle <[EMAIL PROTECTED]> writes:
>> - Get enough memory to do the sort with an in-memory sort, like
>> UNIX "sort" or Python's "sort" function.
>
> Unix sort does external sorting when needed.
Ah, someone
nonportable workarounds
(http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/347462)
but no portable solution.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Christian Heimes wrote:
> John Nagle wrote:
>> There doesn't seem to be any way to portably kill another process
>> in Python. "os.kill" is Mac/Unix only. The "signal" module only lets
>> you send signals to the current process. And the "s
tion they see.
Enforced, it makes it possible to start getting serious about
optimizing compilers for Python, like Shed Skin. Shed Skin
can usually figure out typing within a module, but across module
boundaries, some help is needed if you want to push optimization from
run time to compile time.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
than CPython), and none of them are close to being usable.
Letting the author of one implementation control the language discourages
other implementations.
Submitting Python 2.5 to ISO/ANSI might be a good idea.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Colin J. Williams wrote:
> John Nagle wrote:
>> Paddy wrote:
>>> I would value the opinion of fellow Pythoneers who have also
>>> contributed to Wikipedia, on the issue of "Is Python Standardized".
>>> Specifically in the context of this
tive to TurboGears:
http://trac.turbogears.org/ticket/872
I suspect that MySQL has auto-reconnect turned off, but doesn't document this.
(MySQL 5 on Fedora Core)
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
o valid database handle
db = MySQLdb.connect(...) # connect to database
which is a bit ugly.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
me discussions of this in blogs, but nobody
really seems to know.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
This has me completely mystified. Some SELECT operations performed through
MySQLdb produce different results than with the MySQL graphical client.
This failed on a Linux server running Python 2.5, and I can reproduce it
on a Windows client running Python 2.4. Both are running MySQL 2.5.
The
Carsten Haese wrote:
> On Mon, 2008-02-04 at 11:30 -0800, John Nagle wrote:
>> Restarting the MySQL instance changes the database. The entry "google.com"
>> disappears, and is replaced by "www.google.com". This must indicate a
>> hanging
>> tr
it makes sense to close the cursor before committing. That
frees up the connection for the next command.
But I'm not sure, and I have a bug that seems to be related to
a transaction not committing properly.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Steve Holden wrote:
> John Nagle wrote:
>> Carsten Haese wrote:
>>> On Mon, 2008-02-04 at 11:30 -0800, John Nagle wrote:
>>>> Restarting the MySQL instance changes the database. The entry
>>>> "google.com"
>>>> disappears, and is r
hings you do after solving the problems of being
10x-30x slower than C.
The real optimization trick for Python is figuring out at compile time what
might change at run time, and what won't be. Then all the things that
can't change can be hard-bound during compilation. Shed Ski
Paul Boddie wrote:
> On 4 Feb, 20:30, John Nagle <[EMAIL PROTECTED]> wrote:
>>This has me completely mystified. Some SELECT operations performed
>> through
>> MySQLdb produce different results than with the MySQL graphical client.
>> This failed on a Linux
voiding huge numbers of unnecessary lookups and yielding a considerable
speedup. It's necessary to provide for the late-binding case to keep
the dynamism of the language, but late-binding everything kills
performance.
Shed Skin has restrictions like that, but Shed Skin is being
developed by
ions.
On x86, with some difficulty, you can turn an FPU exception into a
C++ exception using Microsoft's compilers. But that's not portable.
x86 has exact exceptions, but most other superscalar machines
(PowerPC, Alpha, if anybody cares) do not.
For Python, I'd suggest throwing
Preston Landers wrote:
> Hey guys and gals. What are all the cool kids using these days to
> document their code?
HTML. Text-only docs are so last-cen.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
uot;vertical interval tasks", and
similar hacks to work around the lack of one.)
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
x27;t even have to allocate
storage during compile time. The run-time environment is a tree of hashes.
The resulting implementation will be slow, but then, so is CPython.
Too much time goes into hash lookups.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
3 are always compiled to hard machine code,
and Java can be. (GCC offers that option.)
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
or per database connection. The MySQLdb API makes it look
like you can have multiple cursors, but that doesn't actually
work.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
nts in URLs, which are
generally ignored. But it also does something with commas, and it's not
clear why.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
vedranp wrote:
> I would like to avoid the step of taking data out from database in
> order to process it.
You can probably do this entirely within SQL. Most SQL databases,
including MySQL, will let you put the result of a SELECT into a new
table.
John
blem.
In the rare cases that it is needed, it can be implemented with callbacks.
It doesn't require a language extension.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
f, 'end_' + tag)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xae'
in position 46: ordinal not in range(128)
Should attributes be restricted to ASCII, or is this a bug?
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
John Machin wrote:
> On Mar 14, 5:38 am, John Nagle <[EMAIL PROTECTED]> wrote:
>>Just noticed, again, that getattr/setattr are ASCII-only, and don't
>> support
>> Unicode.
>>
>>SGMLlib blows up because of this when faced with a Unicode end tag:
here's no sign of footnotes or references to prior work. The notation
doesn't seem to do anything not previously possible; it's just different.
Back when I was doing program verification work, we used to refer to
stuff like that as the "logic of the month club".
What's the cheapest way to test for an empty dictionary in Python?
if len(dict.keys() > 0) :
is expensive for large dictionaries, and makes loops O(N^2).
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Brian Lane wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> John Nagle wrote:
>>What's the cheapest way to test for an empty dictionary in Python?
>>
>> if len(dict.keys()) :
>>
>> is expensiv
Bryan Olson wrote:
> D'Arcy J.M. Cain wrote:
>> John Nagle wrote:
>>>What's the cheapest way to test for an empty dictionary in Python?
>
>> Try this:
>>
>> if dict:
>
> D'Arcy is right; that's the way to go. I'll a
the graph cycle free. So
the memory is recovered by reference count update as soon as you
let go of the head of the tree. That helps with the garbage problem.
What are you parsing? If you're parsing well-formed XML,
BeautifulSoup is overkill. If you're parsing real-world HTML,
E
idgetfn
def callwidgetbyname(self, widgetname, args)
self.widgets[widgetname](*args)
The only reason to use attributes is when you want to allow the
use of the notation
objectinstance.attributename
If you're only going to get the attributes with getattr, they
don't need to be attributes.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
l at which it
recognizes other files.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Paul Rubin wrote:
> John Nagle <[EMAIL PROTECTED]> writes:
>> Fast cgi is a good technology, but it's not well documented or
>> well supported. For some reason, the Apache people don't like it.
>> It used to be part of the Apache distribution, but that
over pipes. M2Crypto isn't used much. We've
spent much time finding and dealing with problems in the components.
Yet all this works quite well.
Does anyone else architect their systems like this?
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Heiko Wundram wrote:
> Am Mittwoch, 26. März 2008 18:54:29 schrieb Michael Ströder:
>> Heiko Wundram wrote:
>>> Am Mittwoch, 26. März 2008 17:33:43 schrieb John Nagle:
> I didn't say it was unusual or frowned upon (and I was also taught this at
> uni
> IIRC a
rly all the way down into Windows? And what about
Linux, where the "stty" interface is quite different?
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Grant Edwards wrote:
On 2009-02-14, John Nagle wrote:
Can Python's serial port support be made to run at 45.45 baud,
the old "60 speed" Teletype machine speed?
If your hardware and OS supports it, Python can be made to
support it.
OK, tried to open the port, using Pyt
John Nagle wrote:
OK, tried to open the port, using Python 2.6, latest PySerial
and PyWin32:
ser = serial.Serial(port, baudrate=baud,
bytesize=serial.FIVEBITS,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_TWO)
ValueError: Cannot configure port
MRAB wrote:
John Nagle wrote:
[snip]
So the correct combination, 5 bits with 1.5 stop bits, isn't supported in
Python. 1 stop bit will not physically work on Baudot teletypes; the
main camshaft doesn't come around fast enough. (Yes, there's an actual
mechanical reason fo
w, and "read" functions should return a "bytearray".
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Roy Smith wrote:
In article <49970ce7$0$1665$742ec...@news.sonic.net>,
John Nagle wrote:
At the hardware level, there's a clock rate, a counter, and a divisor,
so arbitrary baud rates can be set.
Is that really true of modern hardware? The last time I looked at serial
po
n32
>>> xx = b'x'
>>> repr(xx)
"'x'"
>>> repr(xx[0])
"'x'"
>>> repr(xx[0][0])
"'x'"
>>>
But that's not what "repr" indicates. The bytearray element is apparently
being promoted to "bytes" as soon as it comes out of the array.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
understand the mindset, but the documentation needs to be improved.
Right now, we have a few PEPs and the 2.6 "New features" article, but
no comprehensive documentation. The relationship between "str", "unicode",
"bytearray", "array.array('B')", and integers, and how this changes from
version to version of Python, needs to be made clearer, or conversion
to 2.6/3.0 will not happen rapidly.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
John Nagle wrote:
MRAB wrote:
John Nagle wrote:
[snip]
So the correct combination, 5 bits with 1.5 stop bits, isn't
supported in
Python. 1 stop bit will not physically work on Baudot teletypes; the
main camshaft doesn't come around fast enough. (Yes, there's an actual
mechan
Benjamin Kaplan wrote:
On Sun, Feb 15, 2009 at 11:57 AM, John Nagle wrote:
Benjamin Peterson wrote:
Because b'x' is NOT a bytearray. It is a bytes object. When you actually use
a bytearray, it behaves like you expect.
type(b'x')
type(bytearray(b'x'))
Benjamin Kaplan wrote:
On Sun, Feb 15, 2009 at 11:57 AM, John Nagle wrote:
Benjamin Peterson wrote:
Because b'x' is NOT a bytearray. It is a bytes object. When you actually use
a bytearray, it behaves like you expect.
type(b'x')
type(bytearray(b'x'))
Steve Holden wrote:
John Nagle wrote:
Benjamin Kaplan wrote:
On Sun, Feb 15, 2009 at 11:57 AM, John Nagle wrote:
...Re "bytes" not behaving as documented in 2.6:
That's indeed how Python 2.6 works. But that's not how
PEP 3137 says it's supposed to work.
Steve Holden wrote:
John Nagle wrote:
Steve Holden wrote:
John Nagle wrote:
Benjamin Kaplan wrote:
On Sun, Feb 15, 2009 at 11:57 AM, John Nagle wrote:
...Re "bytes" not behaving as documented in 2.6:
That's indeed how Python 2.6 works. But that's not how
PEP 313
win32.py around line 88,
and don't see any nonzero timeout parameters being fed to Windows
when "timeout=None". Checking the Microsoft documentation, at
http://msdn.microsoft.com/en-us/library/aa363190(VS.85).aspx
feeding all zeroes into the COMMTIMEOUT structure should result in no
a
Grant Edwards wrote:
On 2009-02-22, John Nagle wrote:
I've been using PySerial on Windows (Win2000, amusingly) to
drive a Baudot teletype at 45.45 baud. Input and output work,
but there's a delay of about 1 second (!) on the input side
between receiving a character and reporting
mply using SqlAlchemy instead of direct MySQLDb module).
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Warren DeLano wrote:
Why was it necessary to make "as" a reserved keyword?
Embrace the pain.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
NX) so you can be sure
there won't be any paging. Then make sure you've gotten rid of
anything unwanted running in the background (always a headache
on Windows), and crank up the priority of your real-time task.
And put in a hardware stall timer.
cover that the rest of the file has a non-ASCII encoding,
and restart the parse from the beginning. BeautifulSoup has the
machinery for that.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
stem, lockups, and/or terrible performance.
And none of the usual debugging tools for Python will help you.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
MySQLdb, the Python shim for MySQL, still supports Python only to
Python 2.5. See "http://sourceforge.net/projects/mysql-python";. Are there
any plans to support Python 2.6 or 3.x?
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
ntly, either there's a network problem,
or the server has inadequate socket or MySQL resources configured.
Do a SHOW PROCESSLIST on the server to see what it's doing.
You may have clients which are keeping idle connections open and
tying up server resources.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Alia Khouri wrote:
John Nagle wrote:
MySQLdb, the Python shim for MySQL, still supports Python only to
Python 2.5. See "http://sourceforge.net/projects/mysql-python";. Are there
any plans to support Python 2.6 or 3.x?
Are you running windows? If so, check the forums of the g
Alia Khouri wrote:
John Nagle wrote:
Whoever did the port somehow created a dependency on the
Intel math library, "libguide40.dll" and "libmmd.dll". That shouldn't
be needed in the MySQL Python shim. It's not freely distributable,
either; you have to buy th
received.
I wonder if there is a kind of setting for socket to allow no delays?
Is the program CPU-bound? If so, CPython is too slow for what you want
to do.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
eference parameter, and name parameters.
For assignment, ":=" specified a value assignment, and ":-" specified
a reference assignment.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
g. Adding bytes as a separate
type would have complicated a lot of things.
Regards,
Martin
No, it's broken. PEP 3137 says one thing, and the 2.6 implementation
does something else. So code written for 2.6 won't be ready for 3.0.
This defeats the supposed point of 2.6.
embedded Python code.
Now there's an example of exactly what exec and eval shouldn't be used for.
You don't put general-purpose execution mechanisms into your web site
template system. That's just asking for trouble.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
tml";.
I'm not sure how you're handling this. The Javascript actually
has to be run before you get anything.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
u're looking for based on the XPath functions. This
could be due to an error in the parsing, or it could be due to an admin
changing the site (removing/adding courses etc...)
What URLs are you looking at?
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Leadership Laboratory II",
"section_title":{},
"description":{},
"notes":{},
"type":"Lec",
"units":"1",
"spaces_available":"30",
"number_registered":"2",
"wait_qty":"0",
&quo
It's a useful option if you're doing something that doesn't work
like a typical web application.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
ected error to do so.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
outputting various forms of
installations in a particular directory structure, e.g. /pxe-installs,
/iso-install, /dd-installs, etc...
If this is under Windows, there's a Windows function to monitor a
directory for changes. This is far more efficient than polling.
d be detected and treated as a syntax error. (Whether to use
tabs or spaces is a religious argument, but mixing them is clearly
wrong, and results in non-visible bugs. CPython should enforce
that.)
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
In COBOL, one writes
PICTURE $999,999,999.99
which is is way ahead of most of the later approaches.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Any idea when PyWin32 will be available for Python 3.x?
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
casual about integer
overflow that nobody cared about this level of correctness. Today, of course,
"buffer overflows" are a way of life.
This is really off topic for the group.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Tim Golden wrote:
John Nagle wrote:
Any idea when PyWin32 will be available for Python 3.x?
John Nagle
Release 213 is out already:
http://sourceforge.net/project/showfiles.php?group_id=78018&package_id=79063&release_id=661475
I think it's still considered
Tim Golden wrote:
John Nagle wrote:
That "wizard" won't even install unless Python 3.0 is "in the
registry", which apparently means "installed as the default Python".
No, it just means "installed somewhere". I have 6 different
versions of Pyth
Tim Golden wrote:
John Nagle wrote:
Well, of some other packages I use:
MySQLdb: "Python versions 2.3-2.5 are supported."
Ref: http://sourceforge.net/projects/mysql-python
M2Crypto: Latest version is for Python 2.6.
Ref: http://chandlerproject.org/bin/vie
systems, where you have objects with pointers going in many
directions, yet object destruction has substantial side effects.
Python originally had only reference counting, and didn't have weak pointers.
If weak pointers had gone in before the garbage collector, Python might have
gone in this direction.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
he higher priority story may disappear
from a later feed cycle, and the old story may come back.
So you can't actually trust those fields, and have to back them up with
checks of your own if you want exactly one copy of each item. It's
something that "feedparser" should per
omatic back pressure?
Do Linux sockets have back pressure?
Yes, and yes.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
601 - 700 of 1270 matches
Mail list logo