Re: How to write fast into a file in python?

2013-05-19 Thread Tim Roberts
Carlos Nepomuceno wrote: >Python really writes '\n\r' on Windows. Just check the files. It actually writes \r\n, but it's not Python that's doing it. It's the C runtime library. And, of course, you can eliminate all of that by opening the file in binary mode open

Re: Scope of a class..help???

2013-05-23 Thread Tim Roberts
ill automatically refer to the global class. It won't. The only way to solve this dilemma is to change the name you use in the "while" loop. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Tim Roberts
latin-1'? Because that's the default character set for pymysql. You could have learned this yourself -- you have the full source code for pymysql on your machine. You can override the default character set: con = pymysql.connect( db = 'metrites', host = 'lo

Re: How to get an integer from a sequence of bytes

2013-06-04 Thread Tim Roberts
#x27;s domain. When ASCII became unavoidable, most programs changed to using 5x 12-bit "bytes" per word. Ah, memories. I spent 10 years working for Control Data. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: A certainl part of an if() structure never gets executed.

2013-06-11 Thread Tim Roberts
is not a tuple. My guess is that this will work fine: cur.execute( "SELECT * FROM works WHERE YEAR(lastvisit)=%s ORDER BY lastvisit", (year,) ) It seems silly to fire up a regular expression compiler to look for a single character. if name.find('=') < 0 and month.find('=') < 0 and year.find('=') < 0: -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get an integer from a sequence of bytes

2013-06-13 Thread Tim Roberts
Fábio Santos wrote: >On 5 Jun 2013 06:23, "Tim Roberts" wrote: >> A single machine word was 60 bits, so a single register read got you 10 >> characters. > >10 characters! Now that sounds like it's enough to actually store a word. >However long words c

Re: A certainl part of an if() structure never gets executed.

2013-06-15 Thread Tim Roberts
, or if they're all true, the last value. Why? Because it can't know whether the whole expression is true unless it looks at every value. So: 0 and 1 and 'what' ==> 0 1 and 0 and 'what' ==> 0 1 and None and 0 ==> None 1 and 1 and 'what' ==> 'what' -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: A certainl part of an if() structure never gets executed.

2013-06-18 Thread Tim Roberts
Nick the Gr33k wrote: > >On 16/6/2013 4:55 ??, Tim Roberts wrote: > >> Nick the Gr33k wrote: >> Because Python lets you use arbitrary values in a Boolean context, the net >> result is exactly the same. > >What is an arbitrary value? don even knwo what arbit

Re: How to tell Script to use pythonw.exe ?

2013-07-02 Thread Tim Roberts
%1" %* You can create your own, if you want. If you want files with a .script extension to run PythonW, you can type: assoc .script=Python.NoConFile -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Geo Location extracted from visitors ip address

2013-07-05 Thread Tim Roberts
h a block of IP addresses. That does not necessarily bear any resemblence to the actual location of the user. It tells you the location of the Internet provider that registered the IP addresses. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: hex dump w/ or w/out utf-8 chars

2013-07-12 Thread Tim Roberts
Joshua Landau wrote: > >Isn't a superscript "c" the symbol for radians? That's very rarely used. More common is "rad". The problem with a superscript "c" is that it looks too much like a degree symbol. -- Tim Roberts, t...@probo.com Providenza

Re: How do I get the OS System Font Directory(Cross-Platform) in python?

2013-07-12 Thread Tim Roberts
onts directory. Linux doesn't even have a dedicated windowing system. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: must be dicts in tuple

2013-07-29 Thread Tim Roberts
re supposed to have dicts in a tuple. What you have is a dict in a tuple in a tuple. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: when "normal" parallel computations in CPython will be implemented at last?

2012-07-04 Thread Tim Roberts
ck. After all, you don't patch code on a byte-by-byte basis -- you just change function bindings. That can be done atomically. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I disable module of tkinter when compiling Python 2.5 on redhat9 ?

2012-07-09 Thread Tim Roberts
cheetah wrote: > >I don't need it. It's not worth worrying about. You're talking about way less than a megabyte of disk space, and there is no performance penalty unless you're using it. In general, the parts of the Python standard library are not individually sele

Re: Search and replace text in XML file?

2012-07-28 Thread Tim Roberts
or substitution should have been able to do this in two seconds. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: when an iterable object is exhausted or not

2012-08-04 Thread Tim Roberts
esting that it DOESN'T happen in Python 2. The first "i" is of type list, the second "i" is of type string, and both are restartable. What's the type of "i" in the second case in Python 3? -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: On-topic: alternate Python implementations

2012-08-04 Thread Tim Roberts
ramework. IronPython is written in C#. It generates code that runs in the .NET Framework. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: calling loaded DLL function expecting POINT * argument

2012-08-26 Thread Tim Roberts
fined as __cdecl. Try cdll.LoadLibrary instead of oledll.LoadLibrary. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Sending USB commands with Python

2012-08-28 Thread Tim Roberts
aries can be used to talk to USB devices. There is a Python binding. On Windows, you still need to have a driver, but the libusbx instructions can help you find an install one. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Sending USB commands with Python

2012-08-30 Thread Tim Roberts
sb_setup_async] invalid >endpoint 0x02\n' USB endponts only go in one direction. There will be one endpoint for outoging data, and one endpoint for incoming data. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: 'indent'ing Python in windows bat

2012-09-17 Thread Tim Roberts
sys.exit( {'Cope':1,'Perform':2}.get(sR,3) ) The best way to convert a batch file to Python is to convert the whole file to a Python script. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing arguments to & executing, a python script on a remote machine from a python script on local machine (using ssh ?)

2012-09-19 Thread Tim Roberts
nts ( 3/4 string arguments, containing whitespaces like spaces, etc ) >to a python script, remote.py running on 'remote' (the remote machine). You haven't provided very many details, so it's possible ssh is the low-impact solution, but don't discard the possibility of usi

Re: How to limit CPU usage in Python

2012-09-22 Thread Tim Roberts
You will not find generic mechanisms wrapping them. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Exact integer-valued floats

2012-09-22 Thread Tim Roberts
Control Data 6000/Cyber series had sign bit and 11-bit exponent, with either a 48-bit mantissa or a 96-bit mantissa, packed into one or two 60-bit words. Values were not automatically normalized, so there was no assumed 1 bit, as in IEEE-754. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Exact integer-valued floats

2012-09-22 Thread Tim Roberts
for top-posting. My Xoom makes bottom-posting awkward. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. Dave Angel wrote: On 09/22/2012 05:05 PM, Tim Roberts wrote: > Dennis Lee Bieber wrote: >> On 22 Sep 2012 01:36:59 GMT, Steven D'Aprano wrote: >>> For

Re: How to limit CPU usage in Python

2012-09-24 Thread Tim Roberts
Paul Rubin wrote: > >Tim Roberts: reasons to want to do this might involve a shared host >where excessive cpu usage affects other users; That's what priorities are for. >...or a computer with >limited power consumption, where prolonged high cpu activity causes >thermal or

Re: Who's laughing at my responses, and who's not?

2012-09-24 Thread Tim Roberts
ds of thousands of people reading this forum. A few of those people probably don't like you. So what? Illegitemi non carborondum -- don't let the bastards wear you down. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Experimental Python-based shell

2012-10-02 Thread Tim Roberts
ility >and searching above pinpointing files in heirarchies. > >I invite you to try it. Without intending to detract from your work in any way, are you familiar with the IPython project? http://ipython.org/ You may find some interesting synergy with them. -- Tim Roberts, t...@prob

Re: Generating C++ code

2012-10-10 Thread Tim Roberts
e PHP code (it generates data access objects from a live database schema). -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Understanding http proxies

2012-10-14 Thread Tim Roberts
not "www.bigsite.com", that receipient can tell exactly who is supposed to get the message. So, a web proxy receives requests intended for other sites, and forwards them on, possibly after restricting or modifying them. That's it. -- Tim Roberts, t...@probo.com Providenza & Boeke

Re: pls help me with this prog

2012-10-20 Thread Tim Roberts
>= n: yield iter[:n] iter = iter[n:] Now you can do this: def main(data): for first3 in N_at_a_time(data, 3): print CalcCenter(first3) -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Listen for changes in variable (alsaaudio.Mixer(x, x).getvolume(x)

2012-10-24 Thread Tim Roberts
;re talking about real-time response makes me think you might be misunderstanding this. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: awk like usage in python

2012-11-09 Thread Tim Roberts
OS_: extract the 15 lines starting with T(est) from the file out-Dy-eos2 to a temporary file extract the 2nd field from the line with T(est) in it extract the 6th field from the first line with "s1,torque" extract the 7th field from the first line with "s1,torque&quo

Re: Subprocess puzzle and two questions

2012-11-13 Thread Tim Roberts
ystem), and that command has a different output format. The csh "time" command is different yet again. >1) how can I recover that third digit from the subprocess? Do you actually believe that the third decimal place has any meaning at all? It doesn't. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: changing process name

2012-11-19 Thread Tim Roberts
andrea crotti wrote: >I have very long processes to spawn which I want to lauch as separate >processes (and communicate with ZeroMQ), but now the problem is that the >forked process appears in "ps" with the same name as the launcher >process. http://code.google.com/p/py

Re: os.popen and the subprocess module

2012-11-28 Thread Tim Roberts
place almost every use case for os.system and os.popen. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: why does dead code costs time?

2012-12-05 Thread Tim Roberts
areful about spelling (and pronouncing) the whole word "peephole". The word as you have spelled it here (twice) is a vulgarity. Now, I'm all in favor of the occasional vulgarity, but if this is a misunderstanding, you could find yourself as the butt of some awkward jokes at s

Re: Python USB control on Windows 7?

2012-12-22 Thread Tim Roberts
asily, no. It's not really a USB device -- I'm betting it doesn't even enumerate. It's just sucking power from the USB wires. There's nothing to control. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the name of a function while defining it

2012-12-26 Thread Tim Roberts
more obscure: two = lamba : "one" one = two Which one of these is the "name" of the function? -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: I am facing an issue while decoding json string using json.loads

2012-12-26 Thread Tim Roberts
ng also contains one instance of \\] . Who is doing the JSON encoding? It appears to be doing it incorrectly. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the name of a function while defining it

2012-12-28 Thread Tim Roberts
x27;t know just one name, and when a function object is invoked, it has NO IDEA what name was used to invoke it. The information is simply not available. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: pickle module doens't work

2012-12-28 Thread Tim Roberts
train it every time >anew? Is there no way to save its trained values? When you say "train on data", what do you mean? If your training creates computed data in other members, those members and their values should also be saved in the pickle. -- Tim Roberts, t...@probo.com Provide

Re: pickle module doens't work

2013-01-01 Thread Tim Roberts
ed the "train" method, there IS no MaxEntClassifier object. Once you have called "train", you should be able to pickle the new MaxEntClassifier and fetch it back with its state intact. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: the class problem

2013-01-01 Thread Tim Roberts
to derive from the "object" base class. The class is still simply called "haha", and to create an instance of the class "haha", you write "haha()". -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: got stuck in equation

2013-01-01 Thread Tim Roberts
y, it isn't practical to solve this for SN. That probably means you're going to need a iterative solution. That is, you start with a guess, see how far off you are, and refine the guess until you narrow in on a solution. That means you'll have to figure out whether raising SN gets you c

Re: how to download internet files by python ?

2013-01-09 Thread Tim Roberts
iMath wrote: > >There is also a httplib2 module >https://code.google.com/p/httplib2/ > >which one is more pythonic and powerful ? Both are Pythonic, and power is irrelevant for this. Your code is going to spend 90% of its time waiting for the network. Just solve the problem.

Re: Problem with importing in Python

2013-01-11 Thread Tim Roberts
Dave Angel wrote: > >As Adnan has pointed out, Python is case insensitive. That's not really what you meant to say... -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Uniquely identifying each & every html template

2013-01-21 Thread Tim Roberts
tered files, then there is absolutely no way to teach a computer how to do it. It IS impossible. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Uniquely identifying each & every html template

2013-01-21 Thread Tim Roberts
e same page as page1.html? What if I subsequently delete page1.html? What if I don't? How long will you wait before deciding they are the same? -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: changing sys.path

2012-02-02 Thread Tim Roberts
ctually adding multiple paths? One possible cause for error would be this: sys.path.extend( '/usr/local/lib' ) That succeeds, but it doesn't do what you meant. It adds "/" as a path, then "u", then "s", then "r", and so on. -- Tim Rober

Re: Problem sending an email in html with mime image

2012-02-02 Thread Tim Roberts
content of the message is irrelevant to the sending process, unless it makes your message way too big. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs. C++11

2012-02-14 Thread Tim Roberts
ost line-for-line translation of my Python programs to C++ programs. (Microsoft has had a "for each" extension for a while that made this easier.) -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Numerical Linear Algebra in arbitrary precision

2012-02-16 Thread Tim Roberts
//docs.scipy.org/doc/numpy/reference/routines.linalg.html -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: pyusb and microchip mcp2210 interface

2012-02-29 Thread Tim Roberts
jobattle wrote: > >Has anybody out there had any experience in using the PYUSB library with >the new Microchip MCP2210 USB to SPI chip? It appears to the system as a HID device. You don't need to use PyUSB -- it already has a driver. Check libhid -- it has a Python binding. --

Re: are int, float, long, double, side-effects of computer engineering?

2012-03-05 Thread Tim Roberts
n in exchange for performance. It is a performance choice that we choose to make. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Biologist new to cgi in python

2012-03-07 Thread Tim Roberts
t of type multiport/form-data. There is a module called "poster" that can do the appropriate encoding for you: http://stackoverflow.com/questions/680305/using-multipartposthandler-to-post-form-data-with-python -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- htt

Re: PyUSB available for current versions of Windows?

2012-03-09 Thread Tim Roberts
keyboard and mouse? No, that's just being overly cautious. Libusb-Win32 can act as a filter driver, inserting itself into an existing USB stack, but to do so the device stack you are filtering must be idle. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Will MySQL ever be supported for Python 3.x?

2012-03-31 Thread Tim Roberts
Every SQL >statement has to be rewritten, with the parameters expressed >differently. It's a good approach, but very incompatible. Those changes can be automated, given an adequate editor. "Oursql" is a far better product than the primitive MySQLdb wrapper. It is worth the

Re: Python Gotcha's?

2012-04-07 Thread Tim Roberts
ns to follow the same quoting rules as Python. Now, I fully understand that it is the way it is. I'm merely pointing out that his was not an unreasonable expectation. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: f python?

2012-04-11 Thread Tim Roberts
to use >slashes in paths: All of them should do so. They're just string being passed to CreateFile, and CreateFile accepts forward slashes just fine. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: functions which take functions

2012-04-11 Thread Tim Roberts
7;: doAdd, 'subtract' : doSubtract, 'multiply' : doMultiply, 'divide' : doDivide } nextCommand = parseCommandLine( line ) invokeCommand( commands[NextCommand] ) -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: csv: No fields, or one field?

2012-04-25 Thread Tim Roberts
t;I admit a blank, one-field csv record just isn't very >insteresting, but isn't this a special case that ought to be >documented? But that's what you have in the first line, and the reader has returned to you a list containing one (empty) string. I just don't see your interpretation. The results are exactly what I would have expected. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: HTML Code - Line Number

2012-04-27 Thread Tim Roberts
is one tweak to the HTML, and your scraping fails although the page continues to look the same. A much better plan is to use sgmllib to write yourself a mini HTML parser. You can handle "td" tags with the attributes you want, and count down until you get to the "td" tag you want. --

Re: %d not working in re at Python 2.7?

2012-05-15 Thread Tim Roberts
st or web, >Do you have any idea what's problem here? Yes. %d has never worked. \d+ is the right answer. It's just that simple. Where did you read that %d should work? -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Function declarations ?

2011-06-12 Thread Tim Roberts
n habits, not C habits. What construct led you to think you need to declare a function like that? This code, for example, works fine: def g(): return f() def f(): return 3 print g() The name "f" does not have to be defined until the function "g&

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-12 Thread Tim Roberts
ing in the design of the QWERTY layout is an urban legend. Once your fingers have the mapping memorized, the actual order is irrelevent. Studies have shown that even a strictly alphabetical layout works perfectly well, once the typist is acclimated. -- Tim Roberts, t...@probo.com Providenza &

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-15 Thread Tim Roberts
Dennis Lee Bieber wrote: > >On Sun, 12 Jun 2011 21:30:43 -0700, Tim Roberts >declaimed the following in gmane.comp.python.general: > >> More than that, any layout "more efficient" than QWERTY is practically >> meaningless. The whole "intentional inef

Re: Run Python script from JS

2011-06-16 Thread Tim Roberts
Gnarlodious wrote: > >Is there any way to call a Py script from Javascript in a webpage? It is POSSIBLE to install Python as an active language, so that Internet Explorer lets you write

Re: Run Python script from JS

2011-06-17 Thread Tim Roberts
Hansmeet Singh wrote: > for xhtml wouldnt the syntax be

Re: Strategy to Verify Python Program is POST'ing to a web server.

2011-06-18 Thread Tim Roberts
upload page. Any remedy? The amount of protection you need to take depends on what the cost of interference will be, and how likely it is to be spoofed. How will people find out about your interface? If they found out about it, what would they gain by spoofing it? -- Tim Roberts, t...@probo.com

Re: parse date string having "EDT"

2011-06-20 Thread Tim Roberts
get error Right, because strptime doesn't support %Z. You'll have to handle that yourself and remove it before conversion. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: parse date string having "EDT"

2011-06-22 Thread Tim Roberts
Ben Finney wrote: >Tim Roberts writes: > >> Right, because strptime doesn't support %Z. > >Au contraire: > >Support for the %Z directive is based on the values contained in >tzname and whether daylight is true. Because of this, it is >platform-spec

Re: How can I speed up a script that iterates over a large range (600 billion)?

2011-06-22 Thread Tim Roberts
ed to me on my own. Using your hint, I was able to write a 16-line script that also produced a result instantaneously. Very satisfying. I'm going to save that one... -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: poll of filesystem

2011-07-02 Thread Tim Roberts
the kernel. The data is ALWAYS available. If you want the data once a second, just do it the easy way: import time while True: print open('/proc/loadavg').read() time.sleep(1) -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Serial & reset of the device

2011-07-08 Thread Tim Roberts
#x27;m not sure what that means. The RS-232 standard does not have the concept of "reset". What is it that triggers a device reset? -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes: point to buffer in structure

2011-07-10 Thread Tim Roberts
aximumLength gives the allocated size of the buffer. Length gives the length of the string currently held in the buffer. It can be less than the maximum length, and the buffer does NOT necessarily contain a zero-terminator. UNICODE_STRING and ANSI_STRING are used in kernel programming to avoid the

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-16 Thread Tim Roberts
but it certainly allowed. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-18 Thread Tim Roberts
and friends with ts=8 and sw=4 will use 4 spaces, then tab, then tab plus 4 spaces, then two tabs, etc. That's recognizable, but I still convert such a file to all spaces when I find one. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: I am fed up with Python GUI toolkits...

2011-07-22 Thread Tim Roberts
tioning. With style sheets, you can get very complete control over the look and feel. This is very similar to what Microsoft has done with Windows Presentation Foundation, except that they are using a more sophisticated XML DTD. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc

Re: I am fed up with Python GUI toolkits...

2011-07-24 Thread Tim Roberts
Gregory Ewing wrote: >Tim Roberts wrote: >> >> I don't think your glibness is justified. There is a legitimate appeal to >> this notion. The fact is that MANY APIs can be completely and adequately >> described by HTML. > >My brain raises a TypeErr

Re: how to separate a list into two lists?

2011-08-06 Thread Tim Roberts
= dict(L).values() but that reorders the tuples. They still correspond, but in a different order. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: multiprocessing timing issue

2011-08-10 Thread Tim Roberts
sing before, but never with a Queue like this. >Any notes or suggestions are very welcome. The obvious implication is that your timeout is simply not long enough for your common cases. If you know how many chapters to expect, why have a timeout at all? Why not just wait forever? -- Tim Rob

Re: allow line break at operators

2011-08-14 Thread Tim Roberts
the author mistakenly typed a period instead of a comma: DO 10 I=1.8 That, unfortunately, is a perfectly valid statement that assigns the value "1.8" to the floating point variable "DO10I", supposedly resulting in the loss of an unmanned launch vehicle... -- Ti

Re: Wait for a keypress before continuing?

2011-08-16 Thread Tim Roberts
the escape key. You are running this from a console process, and not a GUI process, right? >That means char=msvcrt.getch() is getting something? Did you ever think about inserting a debug statement to help you? print hex(ord(char)) -- Tim Roberts, t...@probo.com Providenza &

Re: string to unicode

2011-08-16 Thread Tim Roberts
v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> x = '\xe8\x9f\x92\xe8\x9b\x87' >>> x.decode('utf8') u'\u87d2\u86c7' -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Idea for pure-python templates using AST.

2011-08-16 Thread Tim Roberts
essentially how the original CherryPy version 1 web framework worked.In the end, I think it was decided that this represented too much of a mix of processing and presentation, and CherryPy 2 and 3 use a different scheme. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: why i cannot import djang?

2011-08-16 Thread Tim Roberts
smith jack wrote: > >this package is already in the site-packages directory, but i cannot >import it , it's really confusing ... The package is called "django". The name you put in the subject line is wrong. Does your code use the right spelling? -- Tim Roberts, t

Re: Wait for a keypress before continuing?

2011-08-21 Thread Tim Roberts
John Doe wrote: > >Tim Roberts wrote: > >> That exact code works perfectly for me. The function returns as >> soon as I press the escape key. You are running this from a >> console process, and not a GUI process, right? > >No. I am running this from wit

Re: Why PyImport_ExecCodeModule takes char*?

2011-08-28 Thread Tim Roberts
Mateusz Loskot wrote: > >I'm wondering, why PyImport_ExecCodeModule function takes char* >instead of const char*? My guess is "history". -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help parsing a text file

2011-08-30 Thread Tim Roberts
ML and slimy HTML, and "htmllib", which derives from it. I have used "htmllib" to parse HTML files where the tags were not properly closed. Perhaps you could start from "htmllib" and modify it to handle the quirks in your particular format. -- Tim Roberts, t..

Re: Best way to print a module?

2011-09-05 Thread Tim Roberts
rce code, perhaps with syntax coloring. Surely there is no reason to have an "optimal" method of doing this -- this is never going to be in an inner loop. If you have a method that works, there is little justification to optimize... -- Tim Roberts, t...@probo.com Providenza & B

Re: wxPython SQLite and Reportlab demo

2011-02-24 Thread Tim Roberts
his announcement or your sourceforge.net page, do you say a single word about what this application actually is. Just a few sentences describing what the application does would go a long way toward stirring up interest in this app. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc

Re: Suggestion Reqd for Designing a Website in Python

2011-02-24 Thread Tim Roberts
want your app to run on a web server so people use it through your browser). Please clarify. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Dijkstra Algorithm Help

2011-03-09 Thread Tim Roberts
ying to pass this >parameter to the next function so that the distance from the start >node can be calculated How do those numbers say anything about the distances between nodes? -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: How should I handle socket receiving?

2011-03-12 Thread Tim Roberts
g to want to use "select". You can store the objects in a dictionary where the key is the socket number. That way, you can use the result of the select and get your network object directly. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: python script to find Installed programs in Uninstall folder in registry

2011-03-14 Thread Tim Roberts
64 bit machines. There shouldn't be any difference. What error do you get, exactly? Also, let me point out that you can access the registry in a couple of ways, without invoking the overhead of WMI. I grant you that they are a bit wordier, but it might get you around this issue. -- Tim Rob

Re: call php function from python

2011-04-01 Thread Tim Roberts
e yourself look exactly like a human being at a browser. Fortunately, that's not too hard. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: List comprehension vs filter()

2011-04-20 Thread Tim Roberts
art of the local namespace of the outer function, but it's not part of the local namespace of the lambda. You can solve this through the common lamba idiom of a closure: lst=filter(lambda x,posttype=posttype: x["type"].lower()==posttype,lst) -- Tim Roberts, t...@probo.com Providenza

Re: What other languages use the same data model as Python?

2011-05-04 Thread Tim Roberts
onstant 4. Such an abomination is simply not possible in C. Is that implemented under-the-hood with pointers/addresses? Of course it is. However, that does not change the parameter passing model as defined by the language specification. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   7   8   9   10   >