Newbie pythoner, with bizzare problem

Bjorn Pettersen bjorn at roguewave.com
Sat Jul 22 15:43:48 EDT 2000


Jack wrote:
> 
> >5 gets you 7 that you have added a
> >
> >from os import *
> >
> >to your script.
> >
> >Don't do that.
> >
> 
> Thats exactly right, and is there any way i can access the os library then
> without everything going mad-whack.

Well, the point was that you were accessing the os library, in
particular the open function you are acessing is os.open which is
different from __builtin__.open which is probably what you wanted.

What you really want to do is:

  import os
  print os.getcwd()
  os.removedirs('/')
  f = open('foo.bar') # calls the global/__builtin__ open

etc.




More information about the Python-list mailing list