On Tue, Sep 16, 2014 at 2:13 PM, DJ Webre <d_we...@yahoo.com.dmarc.invalid> wrote: > I am trying to convert a program from interactive to script file. > > The program consists of the following 2 lines: > > import webbrowser > webbrowser.open_new('http://www.google') > > When I run it interactively, it works but if I run it as a scrip file, it > produces an error unless I import webbrowser interactively. > > What am I doing wrong? > > Thanks in advance for any assistance.
Notice the path for webbrowser in the traceback, you have a file named 'webbrowser.py' in the same folder as 'webbrowser00.py', and the 'import webbrowser' line in webrowser00 is importing your own webbrowser module, which doesn't have 'open_new'. You'll need to either rename 'webbroswer.py' to something else or delete it (and make sure to delete 'webbrowser.pyc' either way). By the way, it's usually best to just copy and paste your code and error messages as text in the body of the email rather than attaching an image, and embedding the image in a Word document just makes it harder to see what's going on. Just for future reference :) -- Zach _______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32