why is it that my python webview code does not work
import webview
webview.create_window("Ridola Web View", "www.google.com")
webview.start()
Giving me this error
Traceback (most recent call last):
File "C:\Users\user\Desktop\LiveViewer\webview.py", line 81, in <module>
import webview
File "C:\Users\user\Desktop\LiveViewer\webview.py", line 82, in <module>
webview.create_window("Ridola Web View", "www.google.com")
AttributeError: partially initialized module 'webview' has no attribute 'create_window' (most likely due to a circular import)
When importing a module or a library, Python looks for it from sys.path
. If there is a module or a script, which share the same filename as your library, listed before the library in sys.path
, Python would import the module or the script. In this case, there would be never-ending importing becaue the module or the script is importing itself repeatedly. To avoid such situation, you should avoid naming scripts and modules identical to libraries you wish to import.
If your script or any imported script has the identical filename to webview
, such as webview.py
, please rename it to avoid any conflict.
Rename
webview.py
to something likemy_webview.py
or any other of your choice.