By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,996 Members | 1,498 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,996 IT Pros & Developers. It's quick & easy.

File creation, polluted name space?

P: n/a
This is a python session I had running
Python 2.3.3 (win32)

-----------------------------------------------
IDLE 1.0.2
infile = open("file1", 'w') #this works

import os
infile = open("file2", 'w') #it still works

from os import *
infile = open("file3", 'w') #fails
Traceback (most recent call last):
File "<pyshell#4>", line 1, in -toplevel-
infile = open("file3", 'w')
TypeError: an integer is required

----------------------------------------------------------
after I < from import os * > I can't seem to create a file
by the method shown above.

The error indicates that an integer is required,
however, I don't see how an integer would fit
in here.
Does anyone know what's going on?
Is the name space being polluted?

-derek
Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
> Does anyone know what's going on?
Yes
Is the name space being polluted?

Yes

Try:

help(open)
import os
help(os.open)

Note the different arguments and help output.

- Josiah
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.