[Tutor] parsing Spreadsheet document

2009-12-09 Thread Christopher Spears
I want to fill a database with the contents of a spreadsheet. The spreadsheet was created by OpenOffice and is a .sxc document. What is the best way to do this? I think the best approach is to save the spreadsheet as a .csv document and then just parse the file. Am I on the right track here?

Re: [Tutor] Sound problems

2009-12-09 Thread Lie Ryan
On 12/10/2009 4:30 PM, Tim Goddard wrote: My modified code which plays music but still not sound is: from livewires import games # If I don't keep the above line, I get an error that pygame.mixer is not initialized properly I haven't inspected your code thoroughly, but did you make any call to

[Tutor] Sound problems

2009-12-09 Thread Tim Goddard
I'm still learning, and this may be better served on a pygame mailing list but I thought I'd try here first. I'm following the python programming for absolute beginners which uses livewires and pygame to do some simple games. My difficulty comes from not using the module versions used in the book

Re: [Tutor] What books do you recommend?

2009-12-09 Thread Che M
> But the reason I ask this, is because there are SO many different approaches > you could > take to a single problem, I guess that depends a lot on what sorts of problems you are thinking in terms of. At least in many cases, perhaps one of the points of the Zen of Python is useful: "Ther

Re: [Tutor] What books do you recommend?

2009-12-09 Thread Becky Mcquilling
And I did see yours which was great. But the reason I ask this, is because there are SO many different approaches you could take to a single problem, how do you know which is correct or why one is better than the other? You can dig yourself in to holes with more complex problems, and not understa

Re: [Tutor] duplication in unit tests

2009-12-09 Thread spir
Serdar Tumgoren dixit: > I'll admit, I learned the hard way on a project earlier this year. I > got that project done (again with the help of folks on this list), but > didn't do any test-writing up front. And now, as the inevitable bugs > crop up, I'm forced to patch them hoping that I don't bre

Re: [Tutor] What books do you recommend?

2009-12-09 Thread spir
"Alan Gauld" dixit: > > "Khalid Al-Ghamdi" wrote > > > I wan't to buy some books about python 3. Do you have any > > recommendations? > > There are very few Python 3 books out there. > The only one I've used and can recommend is Programming in Python3 by > Summerfield > > Other general Pyt

Re: [Tutor] What books do you recommend?

2009-12-09 Thread wesley chun
> - learning to program by gauld http://www.freenetpages.co.uk/hp/alan.gauld/ update: alan's latest tutorial lives here: http://www.alan-g.me.uk/tutor/ -- wesley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "Python Web Development with Django", Addison Wesley, (c) 2009 http://w

Re: [Tutor] What books do you recommend?

2009-12-09 Thread Alan Gauld
"Becky Mcquilling" wrote Is there a good Tutorial that you guys recommend, where you actually get a useful exercise to try and do and then you can be walked through different solutions? What an interesting question. I'm not aware of any tutorials that do this (although mine does in a few

Re: [Tutor] Fast fourier transform libraries?

2009-12-09 Thread Alan Gauld
"Joe Veldhuis" wrote My question is, can someone recommend a library that provides an FFT function that will do what I want (i.e. take samples and return a list of bins)? I'm no expert of FFT (I stuidied it at uni but can't remember a thing about it!) but a Google search suggests the fftp

Re: [Tutor] win32com and ocx with properties

2009-12-09 Thread John
On Wednesday 09 December 2009 01:45:38 pm bob gailer wrote: > John wrote: > > I realize that some may consider this an advance question. But there are > > many here that are advance. So I'm hoping some nice soul will help me. > > > > I'm attempting to use a OCX designed to talk with QuickBooks.

Re: [Tutor] More on unit testing - tests for external data...

2009-12-09 Thread Alan Gauld
"Modulok" wrote Unit testing functions and methods which rely on passed data is simple enough. However: How do I unit test something which relies on external data? You have to build a test environment. This needs to be carefully planned to enable every test condition to be tested. For ex

Re: [Tutor] Append mode dilemma

2009-12-09 Thread Alan Gauld
"Lie Ryan" wrote with open(...) as fobj: entry = '' while entry != '.' fobj.write(raw_input()) But how does entry change in this example? I think you need with open(...) as fobj: entry = '' while entry != '.' fobj.write(entry) entry = raw_input()

[Tutor] Fast fourier transform libraries?

2009-12-09 Thread Joe Veldhuis
Hello to all. I'm working on a program that will need to do some simple signal analysis (namely, find the frequency of an audio signal) as part of its operation. Something like: - samples = list() for i in range(fft_length): samples.append(readSoundCard()) fft_bins = FFT(samples, sample_ra

Re: [Tutor] What books do you recommend?

2009-12-09 Thread Tim Goddard
I just finished Michael Dawson's Python Programming for the absolute beginner. I thought it was pretty good, with only a few minor nit picks. My programming background was limited to MATLAB and some Visual Basic scripting for excel, access etc making me the target audience. I liked the examples,

[Tutor] More on unit testing - tests for external data...

2009-12-09 Thread Modulok
List, Unit testing functions and methods which rely on passed data is simple enough. However: How do I unit test something which relies on external data? For example, a function which creates a file only if it doesn't exist on disk, or a unit test for a function which makes an SQL query? If anyo

Re: [Tutor] win32com and ocx with properties

2009-12-09 Thread bob gailer
John wrote: I realize that some may consider this an advance question. But there are many here that are advance. So I'm hoping some nice soul will help me. I'm attempting to use a OCX designed to talk with QuickBooks. I'm using win32com for the first time and have discovered an issue that I

Re: [Tutor] What books do you recommend?

2009-12-09 Thread wesley chun
> I wan't to buy some books about python 3. Do you have any recommendations? > I started with no previous programming experience, and I've finished a few > tutorials  and I guess I can be considered a beginner. greetings khalid, and welcome to Python! based on your background, i would like you s

Re: [Tutor] Append mode dilemma

2009-12-09 Thread Luke Paireepinart
On Wed, Dec 9, 2009 at 2:46 PM, Lie Ryan wrote: > On 12/10/2009 6:12 AM, Luke Paireepinart wrote: > >> This won't work unless you have STDOUT redirected to your file. It >> would be better just to do >> fobj.write('\n'.join(all) + '\n') >> > > except that if you're joining a very long string, y

Re: [Tutor] Append mode dilemma

2009-12-09 Thread Lie Ryan
On 12/10/2009 6:12 AM, Luke Paireepinart wrote: This won't work unless you have STDOUT redirected to your file. It would be better just to do fobj.write('\n'.join(all) + '\n') except that if you're joining a very long string, you'll have python copy the whole string again. better to just

Re: [Tutor] duplication in unit tests

2009-12-09 Thread Serdar Tumgoren
> Yes, this is much better. Notice how much less code it is! :-) Yes, it was amazing to see how much code melted away when I gave up on the OO design. As you and others suggested, clearly this was not the correct approach for this portion of my program. > If you expect unicode input then it makes

Re: [Tutor] What books do you recommend?

2009-12-09 Thread Becky Mcquilling
Is there a good Tutorial that you guys recommend, where you actually get a useful exercise to try and do and then you can be walked through different solutions? I'm not a Programmer by trade, but I do a bit of coding for Administrator type functions and have to debug stuff and starting to do this

Re: [Tutor] Append mode dilemma

2009-12-09 Thread biboy mendz
-- Regards, bibs M. Host/Kernel/OS "cc02695" running Linux 2.6.31-5.slh.4-sidux-686 [sidux 2009-02 Αιθήρ - kde-full - (200907141427) ] www.sidux.com Albert Sweigart wrote: Your problem is on this line: fobj.write('\n'.join(all)) This puts a newline in between each line in "all", but

Re: [Tutor] What books do you recommend?

2009-12-09 Thread Serdar Tumgoren
To Alan's list, I'd also add Learning Python 4th Edition. It came out in October and covers Python 3 and 2.6, though I'm not sure if it includes the heftier code samples the OP was interested in... On Wed, Dec 9, 2009 at 2:13 PM, Alan Gauld wrote: > > "Khalid Al-Ghamdi" wrote > >> I wan't to buy

Re: [Tutor] Append mode dilemma

2009-12-09 Thread Albert Sweigart
Your problem is on this line: fobj.write('\n'.join(all)) This puts a newline in between each line in "all", but not at the end. The fix is simple: fobj.write('\n'.join(all) + '\n') This will make sure that the last line has a newline at the end of it, so that when you later append data, it will

Re: [Tutor] What books do you recommend?

2009-12-09 Thread Alan Gauld
"Khalid Al-Ghamdi" wrote I wan't to buy some books about python 3. Do you have any recommendations? There are very few Python 3 books out there. The only one I've used and can recommend is Programming in Python3 by Summerfield Other general Python books that will still be effective albeit

Re: [Tutor] Append mode dilemma

2009-12-09 Thread Luke Paireepinart
On Wed, Dec 9, 2009 at 1:02 PM, biboy mendz wrote: > > Luke Paireepinart wrote: >> That's because there is NOT a new line at the end of the file. >> It's a file you're appending to, it's up to YOU to create that new line. >> And all files should end with newlines anyway (on linux). >> So modify

Re: [Tutor] Append mode dilemma

2009-12-09 Thread biboy mendz
Luke Paireepinart wrote: That's because there is NOT a new line at the end of the file. It's a file you're appending to, it's up to YOU to create that new line. And all files should end with newlines anyway (on linux). So modify your code so that you output a new line at the end of your output

Re: [Tutor] Append mode dilemma

2009-12-09 Thread Luke Paireepinart
On Wed, Dec 9, 2009 at 12:49 PM, biboy mendz wrote: > >> Are you aware of how 'join' works? >> > Hi Luke, > > Thank you. To be honest I'm confused of the different string methods like > join(), split(), etc. Anyway I will practice them to see how they work. > > > It's very important to practice t

Re: [Tutor] Append mode dilemma

2009-12-09 Thread biboy mendz
Luke Paireepinart wrote: On Wed, Dec 9, 2009 at 12:11 PM, biboy mendz > wrote: Hello all! I'm trying to use the append mode when opening and writing to a file but i cant get it to work my way. When run in the present code, the user inputs are expect

Re: [Tutor] Append mode dilemma

2009-12-09 Thread Luke Paireepinart
On Wed, Dec 9, 2009 at 12:11 PM, biboy mendz wrote: > Hello all! > I'm trying to use the append mode when opening and writing to a file > but i cant get it to work my way. When run in the present code, > the user inputs are expectedly 'appended' but not in a newline below the > last > line of the

Re: [Tutor] What books do you recommend?

2009-12-09 Thread Albert Sweigart
I'd recommend Doug Hellman's Python Module of the Week blog (PyMOTW) at http://www.doughellmann.com/projects/PyMOTW/ He goes into each of the standard library modules and gives examples of them in use. Dive Into Python 3 by Mark Pilgrim is also good for getting up to speed on Python 3. http://div

[Tutor] Append mode dilemma

2009-12-09 Thread biboy mendz
Hello all! I'm trying to use the append mode when opening and writing to a file but i cant get it to work my way. When run in the present code, the user inputs are expectedly 'appended' but not in a newline below the last line of the existing file. Instead it starts from where the last line end.

Re: [Tutor] What books do you recommend?

2009-12-09 Thread Serdar Tumgoren
> I wan't to buy some books about python 3. Do you have any recommendations? > I started with no previous programming experience, and I've finished a few > tutorials  and I guess I can be considered a beginner. > My problem, though, is I still find it difficult to write meaningful code or > use th

Re: [Tutor] What books do you recommend?

2009-12-09 Thread Weidner, Ronald
> My problem, though, is I still find it difficult to write meaningful code or > use the built in libraries > effectively and/or correctly because I can't find example code to mimic. I > tried sifting through > ActiveState recipes page, but most of the code seems uninteresting or useful > only

[Tutor] win32com and ocx with properties

2009-12-09 Thread John
I realize that some may consider this an advance question. But there are many here that are advance. So I'm hoping some nice soul will help me. I'm attempting to use a OCX designed to talk with QuickBooks. I'm using win32com for the first time and have discovered an issue that I'm sure others

Re: [Tutor] What books do you recommend?

2009-12-09 Thread Che M
> My problem, though, is I still find it difficult to write meaningful code or > use the built in libraries > effectively and/or correctly because I can't find example code to mimic. I > tried sifting through > ActiveState recipes page, but most of the code seems uninteresting or useful >

Re: [Tutor] duplication in unit tests

2009-12-09 Thread spir
Serdar Tumgoren dixit: > Hi everyone, > I'm trying to apply some lessons from the recent list discussions on > unit testing and Test-Driven Development, but I seem to have hit a > sticking point. > > As part of my program, I'm planning to create objects that perform > some initial data clean-up

Re: [Tutor] File renaming using os.rename problem (spir)

2009-12-09 Thread spir
Roy Hinkelman dixit: > Why don't you simply print out fname? This should point you to the error. > > Denis > > > I did here: > > if fname == old_name: > > print fname # test > > and it looks correct. > > On an WinXP, should I use shutil instead? > > Roy Sorry Roy, I rea