I'm writing a script to list all of my music files' id3 tags
to a comma delimited file. The only part I'm missing seems
like it should be the simplest. I haven't used Python for
the last couple of years. My question is this:
When I use os.open(<file_variable>,"w"), I get an error
message, TypeError: an integer is required. Has
something changed? Did I miss something???
Thanks,
-------------------> S Cook 6 10585
Stan Cook wrote: I'm writing a script to list all of my music files' id3 tags to a comma delimited file. The only part I'm missing seems like it should be the simplest. I haven't used Python for the last couple of years. My question is this:
When I use os.open(<file_variable>,"w"), I get an error message, TypeError: an integer is required. Has something changed? Did I miss something???
the function is called "open", not "os.open".
there's an open function in the os module, but that's doing something
slightly different (see the library reference documentation for details
if you're curious).
</F>
Stan Cook a écrit : I'm writing a script to list all of my music files' id3 tags to a comma delimited file. The only part I'm missing seems like it should be the simplest. I haven't used Python for the last couple of years. My question is this:
When I use os.open(<file_variable>,"w"), I get an error message, TypeError: an integer is required. Has something changed? Did I miss something???
You want open() (the builtins one), not os.open().
Also, if you want to deal with csv files, you may want to check the csv
module (if you don't use it already).
Hi,
This is what I often do:
somekindofoutput = ''
somekindofoutput += somefunk(somearg) + '\n'
# w is for writing
myfile = open('theoutfile',w)
myfile.write(somekindofoutput)
myfile.close()
also see http://www.python.org/doc/2.3.5/tut/node9.html
or some other documentation
/P9k
"per9000" <pe*****@gmail.com> wrote: # w is for writing myfile = open('theoutfile',w)
That won't work, the second argument to open needs to be a string:
myfile = open('theoutfile', 'w')
max
Max Erickson wrote: # w is for writing myfile = open('theoutfile',w)
That won't work, the second argument to open needs to be a string:
w = 'w'
</F>
Fredrik Lundh wrote: Stan Cook wrote:
I'm writing a script to list all of my music files' id3 tags to a comma delimited file. The only part I'm missing seems like it should be the simplest. I haven't used Python for the last couple of years. My question is this:
When I use os.open(<file_variable>,"w"), I get an error message, TypeError: an integer is required. Has something changed? Did I miss something???
the function is called "open", not "os.open".
there's an open function in the os module, but that's doing something slightly different (see the library reference documentation for details if you're curious).
</F>
Thanks, I found it. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Lauren Quantrell |
last post by:
Is there a way to create a text file (such as a Windows Notepad file)
by using a trigger on a table? What I want to do is to send a row of
information to a table where the table: tblFileData has...
|
by: dog |
last post by:
I've seen plenty of articles on this topic but none of them have been
able to solve my problem.
I am working with an Access 97 database on an NT4.0 machine, which has
many Access reports.
I...
|
by: Andrew Chanter |
last post by:
I am writing a little routine to perform the following operations from an
Acces 97 mdb:
1. create a fixed width text file
2. create/establish a table type link to the text file in Access
3....
|
by: Dan V. |
last post by:
How do I create a one line text file with these control codes? e.g.: 144 =
0x90 and 147 = 0x93?
I am trying to create a one line text file with these characters all one one
row with no spaces.
...
|
by: Chad Crowder |
last post by:
Getting the following error on my production server whether the file exists
or not:
"System.IO.IOException: Cannot create a file when that file already exists."
Here's the code generating the...
|
by: JenHu |
last post by:
Hi experts,
I want to create a new empty text file after I upload a file to
the desination. Then I need to read each line from the uploaded file
and write the lines which first character <>'6'...
|
by: windandwaves |
last post by:
Hi Folk
Some of my clients asked me to create "fancy emails" for them (aka html
formatted emails).
I know how to make a nice html document, but I had trouble creating a simple
way to provide...
|
by: CSharpguy |
last post by:
I have a web form that has 22 text boxes on it were the user can enter in
data, then click a button that needs to create a text file. I can create the
text file fine, but how can I create a text...
|
by: barb |
last post by:
So that the world at large benefits from our efforts, here is one fully
documented way to use Windows Irfanview freeware to create thumbnail web
galleries (http://www.irfanview.com).
STEP 1:...
|
by: lxyone |
last post by:
Using a flat file containing table names, fields, values whats the
best way of creating html pages?
I want control over the html pages ie
1. layout
2. what data to show
3. what controls to...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |