Thanos Dodd
Thanos Dodd

Reputation: 650

Attribute Error using the webbrowser module

I wrote this simple code and saved it as a .py file:

import webbrowser
webbrowser.open('https://school.bighistoryproject.com/bhplive')

However when I run it I get the following error:

AttributeError: partially initialized module 'webbrowser' has no attribute 'open' (most likely due to a circular import)

I know the code technically works because if I type each line individually in the Shell it works! What is going on?

Thanks

Upvotes: 0

Views: 2236

Answers (1)

Aron B.
Aron B.

Reputation: 281

If your file is named webbrowser.py that will cause an AttributeError because it tries to import your file, instead of the module.

Upvotes: 5

Related Questions