r0x0r / pywebview

Build GUI for your Python program with JavaScript, HTML, and CSS
https://pywebview.flowrl.com
BSD 3-Clause "New" or "Revised" License
4.67k stars 544 forks source link

Partially initialized module 'webview' has no attribute 'create_window' (most likely due to a circular import) error on Linux #1445

Closed MyroslavMay closed 2 weeks ago

MyroslavMay commented 1 month ago

Specification

Description

Describe your issue in details. Provide a stand-alone code example that would demonstrate the problem. When I try to run example code, it shows me this error:

Traceback (most recent call last): File "/usr/lib/python3.10/idlelib/run.py", line 578, in runcode exec(code, self.locals) File "/home/myroslav/webview.py", line 1, in import webview File "/home/myroslav/webview.py", line 7, in window = webview.create_window('Woah dude!', htm='Woah dude!') AttributeError: partially initialized module 'webview' has no attribute 'create_window' (most likely due to a circular import)

My code: import webview

def custom_logic(window): window.toggle_fullscreen() window.evaluate_js('alert("Nice one brother")')

window = webview.create_window('Woah dude!', htm='Woah dude!') webview.start(custom_logic, window)

(comment) anything below this line will be executed after program is finished executing

pass

Practicalities

r0x0r commented 1 month ago

https://pywebview.flowrl.com/guide/faq.html#webview-has-no-attribute-create-window

github-actions[bot] commented 3 weeks ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 2 weeks ago

The message to post on the issue when closing it. If none provided, will not comment when closing an issue.