Making directories with python
I've been looking in the archives, but can't find anything similar. I'm trying to write a script which would make directories (winxp platform, py2.5) - actually, just one - a new directory with a date name. That is it would be called, for example: 20081129 (today's date). Are there any modules which could be helpful here ? I don't have much literature on py, and the manual is a little hard to follow to me as a beginner, so I'm asking your help. I'd appreciate any advice you can give. Robert -- http://mail.python.org/mailman/listinfo/python-list
Can this be done in py?
Now, don't get me wrong if this is a trivial question, or even an apsurd one. I'm new to python, so my mileage may vary. I have several exe files, console applications that pretty much run on the principle: first.exe Enter file name: start.dat second.exe Enter file name: filename.dat ... you get the point. These are old exe programs, not mine (I can't recompile them or modify them in any way), but which work fine and I still regularly use them. However, I would like to automate this process (since they are not just two, and since this process of entering always the same data is tiresome. Is there a way this could be done with a python script ? A script which starts the .exe file, enters some predefined data, waits for an exe to finish, then again, starts the second .exe file, ... ? I would appreaciate any input you can give on this problem. -- Bob -- http://mail.python.org/mailman/listinfo/python-list
Re: disable ctrl-P in idle?
On Mon, 10 Nov 2008 10:40:28 -0800 (PST), "timw.google" <[EMAIL PROTECTED]> wrote: >Is there a way to disable ctrl-P (print window) in IDLE? I'm editing >some python code in IDLE and I keep hitting this by mistake from my >years of emacs editing. > >Thanks in advance. Try autohotkey and map it to something else. Like, nothing :-) Internally, I don't think so, it's part of CUI. -- Bob -- http://mail.python.org/mailman/listinfo/python-list
Re: disable ctrl-P in idle?
On Mon, 10 Nov 2008 20:56:46 +0100, Robert Singer <[EMAIL PROTECTED]> wrote: >On Mon, 10 Nov 2008 10:40:28 -0800 (PST), "timw.google" ><[EMAIL PROTECTED]> wrote: > >>Is there a way to disable ctrl-P (print window) in IDLE? I'm editing >>some python code in IDLE and I keep hitting this by mistake from my >>years of emacs editing. >> >>Thanks in advance. > >Try autohotkey and map it to something else. Like, nothing :-) > >Internally, I don't think so, it's part of CUI. > >-- Bob ... continue: Or, you can just continue using emacs. I'm using vim, and can't think of a single reason why I should change it for idle. -- Bob -- http://mail.python.org/mailman/listinfo/python-list
Re: disable ctrl-P in idle?
On Mon, 10 Nov 2008 12:27:22 -0800 (PST), "timw.google" <[EMAIL PROTECTED]> wrote: > >Thanks. I on a XP box now, and it's a pain to get things installed >here. That's why I'm not using emacs. When I'm on Linux, I use emacs. >It's not worth the trouble to install something else for just this. Actually, it's not necessary to install it. It's just unzip&start program. You'll figure out how to do the mapping in no time (one line). After that compile the script (autohotkey) to an exe file, and you can delete the rest of the stuff. Just start the exe file, before starting idle. But, as I can see, RichardT solved the problem already :-) (yeah, I could've puted this at the beggining of the post, and saved you the trouble of reading the rest :-) -- Bob -- http://mail.python.org/mailman/listinfo/python-list
Re: hello
On Mon, 10 Nov 2008 19:34:42 -0800 (PST), javed044 <[EMAIL PROTECTED]> wrote: >THIS IS MY NEW BLOG. BLOG TYPE COOL WALLPAPERS AND PICTURE. > This is my new kill filter candidate. -- Bob -- http://mail.python.org/mailman/listinfo/python-list
Re: Python is slow?
On Tue, 23 Sep 2008 06:23:12 -0700 (PDT), sturlamolden <[EMAIL PROTECTED]> wrote: >I have recently been playing with a kd-tree for solving the "post >office problem" in a 12-dimensional space. This is pure cpu bound >number crunching, a task for which I suspected Python to be >inefficient. Well, python is not a number crunching language. However much we would like it to be (we would ? :-). No scripting language is. Developing time is shorter, I agree, but when you have, for example a problem which takes 8,31 minutes to go through in optimized fortran code (like the one I had the other day), then that hardly matters. > >My prototype in Python 2.5 using NumPy required 0.41 seconds to >construct the tree from 50,000 samples. Unfortunately, searching it >felt a bit slow, finding the 11 nearest-neighbours of 1,000 points >took 29.6 seconds (and there were still 49,000 to go). Naturally, I >blamed this on Python. It would be 100 times faster if I used C++, >right? Not necessarily. Before resorting to rewriting the problem try psyco. It speeds up things sometimes. Also, (I'm not that familiar with python yet, so I don't know how to do it in python), try finding the bottlenecks of your calculation. Are the loops where most of the processing time is wasted, or disk accessing, or ... ? > >After having a working Python prototype, I resorted to rewrite the >program in C++. The Python prototype took an hour to make, debug and >verify. The same thing in C++ took me almost a day to complete, even >with a working prototype as model. To my surprise, the resulting beast >of C++ required 64.3 seconds to construct the same kd-tree. Searching >the tree was not faster either, 1,000 points required 38.8 seconds. I >wasted a day, only to find my Python prototype being the faster. > >We may conclude that I'm bad at programming C++, but I suspect that is >not the case here. Albeit micro-benchmarks may indicate that Python is >100-200 times slower than C++, they may not be applicable to the real >world. Python can be very efficient. And when combined with libraries >like NumPy, beating it's performance with hand-crafted C++ is >difficult. At least, my 10 years experience programming scientific >software in various languages was not sufficient to beat my own Python >prototype with C++. > >That is not to say I have never seen C++ run a lot faster than Python. >But it tends to be very short pieces of CPU bound code, no more than a >function or two. But as the problem grows in complexity, C++ >accumulates too much of its own bloat. > Well, personally, I try to combine fortran (being a fortran programmer by trade) with python (in the last few years), as I find fortran to be, by two grades, more comfortable for solving scientific problems then c (or python for that matter, although it has its merits). Starting from ith his capabilities for "normal" array handling, to optimisation and easy readability, to whatnot. Best regards Bob -- http://mail.python.org/mailman/listinfo/python-list
Re: Python is slow?
On Tue, 23 Sep 2008 11:07:22 -0700 (PDT), sturlamolden <[EMAIL PROTECTED]> wrote: >On Sep 23, 3:44 pm, Robert Singer <[EMAIL PROTECTED]> wrote: > >> Well, python is not a number crunching language. However much we would >> like it to be (we would ? :-). > >> No scripting language is. > >Not even Matlab, R, IDL, Octave, SciLab, S-PLUS or Mathematica? > No. And just to avoid eventual useless discussions which might arise, I ment to say that *in general* compiled languages are faster. We can always have discussions whether or not some newer scripting languages like some from the above list, come close, but that usually is just wasted time. Specifically, I cannot say about R, IDL or S-PLUS, since I never used those (not even heard of IDL till now). Octave and Mathematica have been with me for such a short time (we had a few licences for Wolfram's child for one year, but not my part of the company, so ...) that I would rather not give my opinion about those. I've used Matlab and Scilab for a longer time (still do actually - Matlab for measurement data acquisition, and Scilab ... well, it just sits on the disk somewhere actually), and although Matlab is quite fast when disk I/O is involved, it still comes far. >> Also, (I'm not that familiar with python yet, so I don't know how to >> do it in python), try finding the bottlenecks of your calculation. > >I did use a profiler, there is no particular single bottle-neck. You're talking about your c or your python version of the program? There is always a bottleneck - that's just the part which works most slowly. Try to find the part which takes the longest to execute, try to put it differently. If it cannot be done, go to the next slowest part. >Good compilers are too expensive, and gfortran is not good enough yet. > ? Gfortran is one of the better compilers on the market. There was, just the other day, a nice discussion on comp.lang.fortran how it is marvellous what a group of enthousiasts managed do in their time, what commercial giants still didn't. May I ask what are your main objections to it ? Best regards Bob -- http://mail.python.org/mailman/listinfo/python-list
Re: Python is slow?
On Tue, 23 Sep 2008 13:34:10 -0700 (PDT), sturlamolden <[EMAIL PROTECTED]> wrote: >1. gfortran is not Absoft. I find this comment absurd. What did you mean by it ? Yes, gfortran is not Absoft, just as red is not blue (?!). I also don't understand whether you're looking for a free or a commercial compiler. I got the impression from your previous post that money was an object. >2. If I program the same in C99 and Fortran 95, and compile with gcc >and gfortran, the C99 code runs a lot faster (I've only tested with >wavelet transforms). Hmm. Unfortunatelly, i have none whatsoever experience in that field. Completely different area of study here, so without seeing at least some code, I cannot comment anything on that part. And 'a lot faster' is a very relative term. > >3. gfortran is not Absoft. > True. Best regards Bob -- http://mail.python.org/mailman/listinfo/python-list
pyXLWriter warnings
Platform: winXP, excel 2003 Python 2.5.2 XLWriter 0.4a3 (http://sourceforge.net/projects/pyxlwriter/) Is anyone here using this very nice package, for writing excel files? I'm using it on python 2.5.2. (although it is made for older version of python) and cannot find a way to get rid of this error (code and errors below). Does anyone know how to avoid it ? I would appreciate all help and ideas you can think of. Bob >>> import pyXLWriter as xl >>> workbook = xl.Writer("test.xls") >>> worksheet = workbook.add_worksheet('first') >>> worksheet.write([3,3], "Hello doc !") >>> worksheet.write_comment([3,3], "I'm hunting for a wabbit") 0 >>> workbook.close() Warning (from warnings module): File "C:\Python25\lib\site-packages\pyXLWriter\OLEWriter.py", line 135 unknown3 = pack(">> -- http://mail.python.org/mailman/listinfo/python-list