Re: Microsoft Hatred FAQ
> Q: Are you confident enough to bet your wifes and daughters for > what you say? > > A: No. But I put my reputation in. > --- Hang on... ... BAHAHAHAHAHA!! Your "reputation", sir, is of import only to billy-goats who happen to be debating whether to cross the bridge today. Thanks for once again polluting the threads with incoherent, unhelpful, off-topic flamebait. The extra 9 squillion posts in a thread you clearly had no intention of participating in must really have made your day. Downloading them has not, as you might gather, made mine :P -- Ten pgpgMDMmEK1Jm.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
Re: Cheapest pocket device to code python on
On Friday 04 November 2005 03:55, [EMAIL PROTECTED] wrote: > What is the cheapest/affordable pocket device that I can code python > on? I think the closest I have seen is pocketpc from this page: > > http://www.murkworks.com/Research/Python/PocketPCPython/Overview Depends what you're using it for, and how cheap you mean. Having seen the PocketPC angle covered, I may as well cover a different angle give an even cheaper option. I use an old epocpython on a Psion Revo Plus for jotting down python concepts and testing out ideas, and I wouldn't be without it - especially because the Revo keyboard is usable in a way touchscreens aren't for me. It's not the most extensive python installation, and it won't stand much earthshifting (it doesn't include some modules, like tkinter) but it's a hell of a lot of portable python considering the fact you can pick one up for around 10 to 20 squids on ebay. Better keyboard than a pda, portable python for next to nothing. -- http://mail.python.org/mailman/listinfo/python-list
Re: Configuring IDLE on Linux
On Friday 14 July 2006 04:26, Satya Kiran wrote: > Hello, > I have upgraded to Python2.4 on my Red Hat 9.0 Linux box. > I want to work with IDLE and ran a search to check it's presence. > Here is what I get. > > [EMAIL PROTECTED] bin]# find / -iname idlelib > /usr/local/lib/python2.4/idlelib > > [EMAIL PROTECTED] bin]# cd /usr/local/lib/python2.4/idlelib > [EMAIL PROTECTED] idlelib]# python PyShell.py > ** IDLE can't import Tkinter. Your Python may not be configured for Tk. ** > > How do I resolve this and get IDLE working? > > thanks in advance, > Kiran Satya You need to install python's tkinter functionality separately in some RPM-based distros (suse and redhat off the top of my head). Search your package repository for the package called python-tkinter (it may be named slightly differently on redhat - ie: python_tkinter, but whichever, that's the one) HTH Ten -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: send an email with picture/rich text format in the body
On Sunday 28 May 2006 07:27, anya wrote: > Acctualy there is a solution: > see http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/473810 > (thanks darrin massena for sharing) > > and , if you will set all the neccessary parametrs, it won't be > recognized as a > spam, > thanks Ahah - a slightly different thing to what I thought you were after. I'd looked at "every one who open the email will see the picture" and discounted html mail. Glad you got what you wanted done, done. Ten. -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: Fancy GUI with Python
On Sunday 28 May 2006 19:25, [EMAIL PROTECTED] wrote: > Hi all. I just downloaded and installed the new Office suite from MS > with their new 'ribbon' based UI. I think it's pretty cool and AFT* > for a new UI paradigm. I hope it sticks. > > Anyway, I'm wondering how to implement a gui like this with Python. I > don't think wx or qt or gtk or tkinter support this sort of fading and > glowing type of effects... or do they? I played with wx way back in > 2000 or so (C++ version), and it certainly didn't have any of that. I > don't know if this stuff is now built into XP, or if it's specialized > libraries only accessible to MS for their purposes. Can a python gui > framework be redirected to use the new gui? Or is this something that > has to be manually emulated from a low-level if python is to make use > of it? What about under linux? > > So I'm not sure if this is a Python question, a xxx-Python question > (where xxx is the widget toolkit of choice), or a windows API type of > question. > > How does one make fancy fading guis with python? (cross-platform if > possible) > > thanks > ms > > *AFT = about freakin' time Unless I'm missing something (I haven't examined it exhaustively), everything therein seems quite easily doable using python and Qt. I'd check it out. Ten -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: send an email with picture/rich text format in the body
On Monday 29 May 2006 11:28, Max M wrote: > Ben Finney wrote: > > "anya" <[EMAIL PROTECTED]> writes: > >>Acctualy there is a solution: > >>see http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/473810 > > > > Again, sending anything but plain text as the message body ensures > > that your message is unreadable to a large number of people using a > > variety of software. It's your choice whether to restrict your > > audience in this way, but know that that's what you're doing. > > 90% of users are non-technical users who use standard email readers, > that can easily read html messages. > Even if your 90% were any kind of real statistic, 90% of everyone is not everyone, and there ends the technical debate. 100 != 90 As a matter of interest, I'm almost sure that on checking you'd find that of the widely available mail clients, only a minority will display such a mail properly without further interaction. You might find that platform neutrality and usefulness to people are genuine considerations for those with any kind of technical integrity, and that "most people use this particular piece of proprietary software so let's just say screw the rest" (whilst still benefiting from a platform-neutral medium, and bouncing it off open source servers) is widely considered a shabby and broken way of working. If people want to palm people off with excuses and generally implement things in a lazy, badly badly planned, mercenary and undisciplined way, they're probably better off spending their time with the non-technical management and not amongst programmers. Sorry for the rant, good luck to the guy if he's solved his problem, but damn, that "90% so let's not bother doing things properly" stuff makes my blood boil. -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: saving settings
On Monday 29 May 2006 12:28, SuperHik wrote: > aum wrote: > > On Mon, 29 May 2006 09:05:36 +0200, SuperHik wrote: > >> Hi, > >> > >> I was wondering how to make a single .exe file, say some kind od clock, > >> and be able to save some settings (alarm for example) into the same > >> file? Basically make code rewrite it self... > >> > >> thanks! > > > > Yikes!!! > > > > I'd strongly suggest you read the doco for ConfigParser, and load/save > > your config file to/from os.path.join(os.path.expanduser("~")). > > > > Another option - save your stuff in the Windows Registry > > but if I copy this file on the other computer settings will be lost... A pretty standard behaviour in this context is to have your program create its own config file if it's absent, say on first run, per user, or if it's copied to a new machine. Just do it using whatever defaults are in the python file itself. Regards, Ten. -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: John Bokma harassment
On Tuesday 30 May 2006 10:36, [EMAIL PROTECTED] wrote: > >Your first question should be: Is it alright that Xah harasses 5 > >newsgroups? Or maybe work on your spelling, harass is with one r, but > >maybe you didn't read the subject, which wouldn't amaze me, since you > >sound like you should be spending time on MySpace OMG!. > > Dear John, > Should I ask myself the question about Xah first, or work on my > spelling? > I knew har*ass it had 1 or more r's in it but I couldn't figure out the > exact number. > That makes me suspect my spelling is good enough and I should dive > right into the > Xah issue. What do you think John? > I don't get the MySpace OMG reference, but rest assured John, you are > still my favorite > newsnet nazi. I know you have been feeling pretty insecure about this > Xah fellow, but > you know that is just silly, don't you? > Yours truly > Immanuel > > P.S Do not hesitate to comment on form, spelling or style of this > message. I am always > eager to learn. Immanuel, The guy cross-posts wildly off-topic posts as a flimsy pretext on which to plaster advertisements for his website. That's even if you don't consider the posts themselves drivel. He starts flame wars, or just maildrops and doesn't respond. He does so despite the way he does it being impolite, probably in violation of every TOS he crosses, and inconsiderate to those of us who just want to use the newsgroup. If you want to waste your time on mounting a tenacious defence of that, good luck to you, but consider the possibility that you may be wrong. Of course we can ignore the guy - I'm sure many do without giving it further thought, but being able to ignore a transgression or discourtesy doesn't magically mean the person isn't doing it does it? As for all this specious nonsense about freedom of speech - every organised forum for discussion has some level of regulation, varying from taking turns speaking, to staying a certain distance from the opposition, to wearing the appropriate hat, to not physically hitting your colleagues. To confuse that simple and civilised thing with some desire to *stifle* opinion or basic freedoms would be a little childish, wouldn't it? Isn't it just people wanting to use this resource as a place to discuss the topics at hand, without loads and loads of noise and cynical advertising at our expense? Cheers, Ten PS: Nice to see Godwin's ticking over nicely these days. :) -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Help
On Wednesday 14 June 2006 16:57, Kathy Garcia wrote: > htmldiv style='background-color'DIV class=RTE > P BR FONT face="Courier New"To Whom it May Concern BR I have recently > downloaded Python 2.4.3 on Windows XP. The program does not recongnize when > I type in python " name 'python' is not defined". Please tell me how to > correct this./FONT BR /P DIV /DIV FONT color=#00 /DIV > DIV /DIV /FONT /div br clear=allhrExpress yourself instantly with > MSN Messenger! a href="http://g.msn.com/8HMAEN/2731??PS=47575"; > target="_top"MSN Messenger/a Download today it's FREE! /html Hi there. Seems like you're opening a python interpreter by running python, then typing "python" into that. Whatever you're trying to do, this probably isn't the way to go about it. :-) You seem to be successfully running python. Maybe if you let us know what you're trying to achieve other than that, it would be possible to help. Regards, Ten. PS: If you could manage it, sending plain text messages instead of html ones would be great. You'll notice html messages are virtually unheard of on most lists/groups. They make an awful unreadable mess for many of us and are kind of the newsgroup equivalent of breaking wind in an elevator. :-) -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: Getting output from external programs...
On Sunday 18 June 2006 21:28, ph0b0s wrote: > Hi, > > i'm making an mp3 conversion program in Python, but am kind of stuck now. > The conversion routines work, using LAME, but now a i'm building a GUI > with GLADE around it, and would like to be able to show LAME's output > to the user in a status window in my gui.. but don't know where to > start... > > The command i use to invoke LAME is this : >command = ("lame -b " + str(bitrate) + " " + infile + " \"" + > dir_outpath + separator + outfile + "\"") > > You can do this in various ways, ranging from the very simple and not very good from commands import getoutput x=getoutput(command) - to your more common and better popens. ie: import popen2 (stdOut, stdIn) = popen2.popen4(command) x=stdOut.readlines() - asynchronously if appropriate. How are you running the command at the moment? -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: Getting output from external programs...
On Monday 19 June 2006 03:44, Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Ten <[EMAIL PROTECTED]> wrote: > > >You can do this in various ways, ranging from the very simple and not very > > good > > > >from commands import getoutput > > > >x=getoutput(command) > > > > > >- to your more common and better popens. > > > >ie: > > > >import popen2 > > > >(stdOut, stdIn) = popen2.popen4(command) > > > >x=stdOut.readlines() > > > >- asynchronously if appropriate. > > > >How are you running the command at the moment? > > . > . > . > Why deprecate commands.getoutput()? Are you merely > observing that it's applicable in fewer circumstances? Absolutely so. Commands.getoutput is simple, quick and useful, just less versatile. Maybe "not very good" is a pretty vague, almost emotive-sounding way of putting it. My bad. :-) Cheers, Ten -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: Calling every method of an object from __init__
On Monday 19 June 2006 20:55, Rob Cowie wrote: > Hi all, > > Is there a simple way to call every method of an object from its > __init__()? > > For example, given the following class, what would I replace the > comment line in __init__() with to result in both methods being called? > I understand that I could just call each method by name but I'm looking > for a mechanism to avoid this. > > class Foo(object): > def __init__(self): > #call all methods here > def test(self): > print 'The test method' > def hello(self): > print 'Hello user' > > Thanks, > > Rob C May I ask what the intended application is? Calling *everything* callable in an instance is pretty much guaranteed to cause a problem, and a reusable external function might be better in any case. The code posted kinda-sorta implies that you're looking to call only *your created* methods, is that what you mean? If so, you probably need to bite the bullet and stick to a naming convention which excludes __class__, __init__, __call__ and so on, ie: no leading underscores a la public methods, as well as making sure your methods actually support being called with no args. Assuming all that, let me be the first in this thread to pointlessly use a list comprehension: class bork(object): def __init__(self): #in __init__ method as requested... [self.__getattribute__(i)() for i in dir(self) if not i.startswith('__') and callable(self.__getattribute__(i))] def hello(self): print 'hello' def testyflops(self): print 'breasts' x=bork() hello breasts or, nicer, you could have: def callall(x): [x.__getattribute__(i)() for i in dir(x) if not i.startswith('__') and callable(x.__getattribute__(i))] then use: class bink(object): def __init__(self): callall(self) def hatstand(self): print 'Argh!' def jackbenimble(self): print 'Freud!' y=bink() Argh! Freud! as well as being able to callall(anInstanceOfSomeOtherClass) ...with other objects if you're just so wild and rebellious that you don't care about errors, and laugh in the face of arguments. :) HTH, Ten PS: Just out of curiosity, would you mind saying what this is for? -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: a good programming text editor (not IDE)
folding. All the stuff you guys are talking about: line numbers, > syntax highlighting, custom tools (running the interpreter), regexp > search and replace, keeping your environment the same between sessions, > soft word wrap, tab-vs-spaces, auto-indent, braces-matching, bla bla... > it does it all in an appropriately gui manner without making you feel > like a moron for not psychically knowing the command ahead of time, or > for not having someone to copy a dot whatever file from, or not Reading > TFM (which of course never tells you what you want to know anyway -- > it's either a patronizingly simple-minded 3rd grade tutorial, or it > tells you what a command does if you already know its f***king name!). > And of course all these editplus things are accessible via the keyboard > without necessarily hitting alt to go to the menu. And no, it doesn't > read email or newsgroups, run custom scripts to beautify your code, or > have 20MB of stuff to download and 20 years of history to catch up on. > I've rarely needed anything more than straightforward editing, so I > guess I'm not worthy to have an opinion of how shitty *nix is for > pretending to have guis. If you (meaning y'all) like to feel superior > by memorizing commands how to change the word wrapping mode, > braces-indenting mode, background color, foreground color, > braces-matching, apropos-me-this, then by all means make things > difficult for the rest of us lowly non-professional programmers (I'm a > hardware designer by trade, but like to fuck around python for fun). > For me, when I just have something quick and dirty, I use editplus and > that makes me sooo happpy. If there were something like this for > Linux I might even consider switching long term. Speaking as a user of emacs, imo EditPlus is a very sound little product - I did some work with it a while back and it stands out in my memory as a fairly pleasant experience. In the same sort of vein on other platforms, BlueFish is a nice basic GUI-based editor, and whilst touted as a web editor, it has enough features (piping output or files through other apps, a configurable dialog for each code snippet, etc.) that it's perfectly usable as a programming editor of the sort you're referring to. Still, before you decide to tell all the unix/vim/emacs/whatever users that they're a bunch of elitist swine, it might be nice to remember that some aren't, and might not deserve to be branded as such for no reason other than that you, personally, can't stand to use program X! Incidentally, x-emacs, kde and gnome are not the same as windows, neither is os x, therefore they may be unfamiliar in some ways. To me that's not really a legitimate technical or HCI-based criticism of software people have written, it's a statement of the obvious. Is your grill deficient because it doesn't work in the same way as your toaster? Something to ponder. Good luck to you. Cheers, Ten. -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython GUI designer
On Monday 19 June 2006 15:23, DarkBlue wrote: > prepare to shed lots of tears before > overcoming the initial disbelieve, that there is nothing > better available for python. Ahem - not strictly true - that should read "there is nothing better for wxPython". Not being pedantic, it's just not true to say nothing better is available for python. Qtdesigner seems about on a par with the GUI design in Microsoft's Visual Studio software to me. Cheers, Ten -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: better Python IDE? Mimics Maya's script editor?
On Friday 09 June 2006 00:40, warpcat wrote: > I've been scripting in Maya, via mel for years now. Recently learning > to Python, love it. Thing that's driving me nuts it the IDE. I'm > using PythonWin right now and trying to find something better, mainly > with this functionality: > > In Maya's mel script editor window, it's split into two sections. > Bottom window you can enter commands (where your script lives), top > window gives results. The thing I'm really used to is highlighting X# > of lines in the bottom window (little snippits from my script), and > executing that selection, with instant feedback of the results on top. > This really speeds my workflow. > It seems completely missing (so far) in Python's IDE. I have to copy > and paste from a script to the ide window to execute and see the > results, or I have to make a bunch of "buffer scripts" with just the > code snippetsI want to test in. Seems *really* clunky. > > Does anyone know of a scripting enviroment for Python that mimics what > Maya's script editor has? Much appreciated. It may not be much of an answer as many people don't want to learn emacs (or vi for that matter), but emacs does this, specifically the separate buffers and the ability to highlight and execute parts of your code to test it. If you get into emacs, it's worth the time invested. The learning curve's alleged to be steep, but it isn't that bad, I use it and I'm as dumb as a stump. It's a very good IDE for everyday use. :-) Good luck, Ten -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: New to Python: Do we have the concept of Hash in Python?
On Friday 02 June 2006 13:07, Piet van Oostrum wrote: > > "A.M" <[EMAIL PROTECTED]> (AM) wrote: > > > >AM> This is my 1st day that I am seriously diving into Python and I have > >AM> to finish this application by the end of today. > > Are you serious? > -- > Piet van Oostrum <[EMAIL PROTECTED]> > URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] > Private email: [EMAIL PROTECTED] It's not that unfeasible - I can think of a few instances off the top of my head where management have read something in a magazine or heard something in conversation, then come in full of vim and vigour the next day - telling people to create item X using buzzword technology Y by the end of the day, the week or whatever, despite the devs having never seen it, despite the timescale being insufficient, and despite there being *real* work to do. Even if it's just because they want to see it, or to impress other management types with their use of the latest "trend", I believe the best response is to just get on with it. Self-preservation and all that. Even so, the idea of using python across the company is actually a very sensible one, so I expect it's programmer's enthusiasm fuelling things in this case. -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: Swaying A Coder Away From Python
On Thursday 04 May 2006 12:57, Tim Williams wrote: > > (and why do you > > seem to think that this matters, btw ?) > > I actually think it is complete twaddle For my part, I have to agree with you on this one. In terms of any subjective to-and-fro'ing regarding the languages themselves I did some small research projects using C# and realised I couldn't find any reason to favour it over other more suitable languages in most contexts. *As a language* it's not bad (even though python it ain't), but considering the number of hoops to be jumped through to adopt it, I'll be wanting my alpha waves parsed as I sleep into well-commented colloquial English and run by an English Language JITc with assembly-like speed before I'll consider using it over python, or php, or C++. In essence, not a big fan. >I usually refer to it as "VILE!". As in what Vile thing do I have >before me. > >Emacs all the way baby! ^IAWTP^ Couldn't agree more. -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: which windows python to use?
On Thursday 11 May 2006 13:38, Brian Blais wrote: > Hello, > > Are there any recommendations for which Windows python version to use? I'd > like to see a pros-and-cons description of each, given that different uses > might dictate different versions. The versions I know (and there are > surely more) are: > > 1) download from www.python.org > 2) enthought > 3) activepython > > Are there advantages/disadvantages? I have used enthought before, but it > seems as if they are not at 2.4, and may lag behind in versions (which may > not be a bad thing). > > Any other recommendations? > As mentioned elsewhere, it depends what your criteria are. Will it be deployed to end users? Your servers? Is python itself being bundled with the program? Is the target a cross-platform or single-platform app? Etc.? If you want "general" advice, here it is: I'd stick with python python and install what extras you need yourself. I've always used the python from python.org and added stuff I need, and I have to be honest, I haven't come across a single comparative disadvantage of doing so yet. Besides, I think installing modules yourself and knowing what's *extra* for an average python-enabled machine is a Good Thing. -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: Time to bundle PythonWin
On Thursday 11 May 2006 23:09, Dave Benjamin wrote: > Hey folks, > > Why is PythonWin (win32all) still a separate download from a third party? > Is it legal, technical, or what? I think it's about time it be part of the > standard distribution. > > There are many useful things that you ought to be able to do without > downloading third-party libraries. Terminating a process, for example. > Communicating with other applications via a standard, common protocol > (COM). We demand these things from our UNIX environments--why do we > tolerate their omission on the Windows platform? > There's a lot of omission on the windows platform, and that ain't python or win32all's fault. > Mac libraries are bundled with Python's *standard library*. I'm not even > advocating merging the win32 extensions with the standard library. All I'm > saying is that when you install Python on Windows, it should ask you if > you want to install PythonWin too, and that this option be selected by > default. > > I write applications that use COM and Tkinter to automate basic office > tasks. My users are thankfully benevolent enough to download and install > Python on their own. They don't know what PythonWin is, they aren't > remembering it, and frankly, I don't think it should be their concern. > Respectfully, that sounds like a reason for *you* to bundle pythonwin (and python, to be honest :) ), not a reason for everyone else to have to download an extra 40-50% of potentially superfluous cruft with their standard python setup. In more general terms I can see why it would be useful to some windows people to have more winapi stuff available. I can still think of quite a few things I'd rather be spending that extra download time on myself, though, like a sexed-up tkinter or maybe even a new gui toolkit. Still, it's not an either/or choice, I suppose. -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: send an email with picture/rich text format in the body
On Sunday 14 May 2006 12:24, anya wrote: > Hey, > I have a certain problem and till now I didnt find an answer on the > web. > > I want to send an email message with picture in it. I dont want to put > it as > attachment but make it in the body of the mail, so every one who open > the email will see the picture.. (it is possible that the solution will > be in any other format that will be opened i.e pdf, doc and I will put > this in the body ) > > Neither in MimeWriter nor using the definition of MymeTypes I was able > to do it .. > > Does anyone have a solution? > > Thanks The problem with doing this, programmatically or otherwise, is that however you implement it, it's not going to work everywhere. You can easily send it, but if you do include binary data in the message body, then however you do it most people will be seeing a garbled (and offensive to the the eye) message body. I think it's not the right thing to do, either, if you ever managed to do this it would be by working around how email is supposed to work. Eventually, unless you have a userbase that is happy to open things in a particular way for you, you'll have to bite the bullet and use more orthodox techniques, methinks. (he says with an image in his headers) Ten -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: copying files into one
On Sunday 14 May 2006 05:09, Gary Wessle wrote: > Hi > > I am looping through a directory and appending all the files in one > huge file, the codes below should give the same end results but are > not, I don't understand why the first code is not doing it. > > thanks > Hi there - I think you might need to give a more whole code sample when asking this question, as it's all a bit ambiguous - for instance "file" is a type, like "string" or "list" but... > > combined = open(outputFile, 'wb') > > for name in flist: > if os.path.isdir(file): continue ^If you can successfully get past this line, you must have reused "file" to describe a string (which is probably quite a *BAD* idea ;) ) and just not included some of the code... BUT > > infile = open(os.path.join(file), 'rb') > This line suggests it's a list, so I don't know. Argh. Anyway, I'm not being pernickety, just pointing out that it's a little too ambiguous - the code sample you gave alone would not work at all.. > # CODE 1 this does not work > tx = infile.read(1000) > if tx == "": break<<<<< > combined.write(tx) > infile.close()<<<<<<<<< > > # CODE 2 but this works fine > for line in infile: > combined.write(line) > infile.close() > > combined.close() Hope to help when you post back, Cheers, Ten -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: do/while structure needed
On Sunday 14 May 2006 06:17, John Salerno wrote: > 1 random.shuffle(letters) > 2 trans_letters = ''.join(letters)[:len(original_set)] > 3 trans_table = string.maketrans(original_set, trans_letters) > > So what I'd like to do is have lines 1 and 2 run once, then I want to do > some comparison between original_set and trans_letters before running > line 3. If the comparison passes, line 3 runs; otherwise, lines 1 and 2 > run again. > > A do/while would be good for this, but perhaps I'm looking at it in the > wrong way? Or is there some kind of do/while type of idiom that I could > use? > > Thanks. while not comparison(original_set, trans_letters): random.shuffle(letters) trans_letters = ''.join(letters)[:len(original_set)] trans_table = string.maketrans(original_set, trans_letters) HTH, Ten -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list