I Can't create a window in pyglet - python-3.x

I have just installed pyglet on my machine. But I can't seem to create a window
here's what I tried
import pyglet
window = pyglet.window.Window()
pyglet.app.run()
and it gives me this error when I run
Traceback (most recent call last):
File "c:/Users/Public/Documents/vscode/python/Games/Pyglet/main.py", line 3, in <module>
window = pyglet.window.Window()
File "C:\Users\DELL\AppData\Roaming\Python\Python38\site-packages\pyglet\window\win32\__init__.py", line 132, in __init__
super(Win32Window, self).__init__(*args, **kwargs)
File "C:\Users\DELL\AppData\Roaming\Python\Python38\site-packages\pyglet\window\__init__.py", line 648, in __init__
self._create()
File "C:\Users\DELL\AppData\Roaming\Python\Python38\site-packages\pyglet\window\win32\__init__.py", line 274, in _create
self.context.attach(self.canvas)
File "C:\Users\DELL\AppData\Roaming\Python\Python38\site-packages\pyglet\gl\win32.py", line 238, in attach
raise gl.ContextException('Unable to share contexts.')
pyglet.gl.ContextException: Unable to share contexts.

Related

How to reposition electron app using pywinauto

I got this code working with calculator.exe but I can't get it to work with vscode app.
I'm trying to open a vscode workspace.
from pywinauto.application import Application
app = Application().start(r"C:\vscode\Code.exe C:\Documents\my.workspace")
dlg_spec = app.window()
dlg_spec.move_window(x=0, y=0, width=1000, height=1000, repaint=True)
And I get this error
(electron) Sending uncompressed crash reports is deprecated and will be removed in a future version of Electron. Set { compress: true } to opt-in to the new behavior. Crash reports will be uploaded gzipped, which most crash reporting servers support.
Traceback (most recent call last):
File "C:\Users\me\scoop\apps\python\current\lib\site-packages\pywinauto\application.py", line 250, in __resolve_control
ctrl = wait_until_passes(
File "C:\Users\me\scoop\apps\python\current\lib\site-packages\pywinauto\timings.py", line 458, in wait_until_passes
raise err
pywinauto.timings.TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\script.py", line 4, in <module>
dlg_spec.move_window(x=0, y=0, width=1000, height=1000, repaint=True)
File "C:\Users\me\scoop\apps\python\current\lib\site-packages\pywinauto\application.py", line 396, in __getattribute__
ctrls = self.__resolve_control(self.criteria)
File "C:\Users\me\scoop\apps\python\current\lib\site-packages\pywinauto\application.py", line 261, in __resolve_control
raise e.original_exception
File "C:\Users\me\scoop\apps\python\current\lib\site-packages\pywinauto\timings.py", line 436, in wait_until_passes
func_val = func(*args, **kwargs)
File "C:\Users\me\scoop\apps\python\current\lib\site-packages\pywinauto\application.py", line 203, in __get_ctrl
dialog = self.backend.generic_wrapper_class(findwindows.find_element(**criteria[0]))
File "C:\Users\me\scoop\apps\python\current\lib\site-packages\pywinauto\findwindows.py", line 87, in find_element
raise ElementNotFoundError(kwargs)
pywinauto.findwindows.ElementNotFoundError: {'backend': 'win32', 'process': 13116}

Whenever i tried to connect my psql through flask i got an contrib error

flask.cli.NoAppException
NoAppException: While importing "application", an ImportError was raised:
Traceback (most recent call last):
File "/home/shwet/.local/lib/python2.7/site-packages/flask/cli.py", line 240, in locate_app
__import__(module_name)
File "/home/shwet/sr/WebDevlopment/lecture3/project1/application.py", line 17, in <module>
Session(app)
File "/home/shwet/.local/lib/python2.7/site-packages/flask_session/__init__.py", line 54, in __init__
self.init_app(app)
File "/home/shwet/.local/lib/python2.7/site-packages/flask_session/__init__.py", line 61, in init_app
app.session_interface = self._get_interface(app)
File "/home/shwet/.local/lib/python2.7/site-packages/flask_session/__init__.py", line 93, in _get_interface
config['SESSION_USE_SIGNER'], config['SESSION_PERMANENT'])
File "/home/shwet/.local/lib/python2.7/site-packages/flask_session/sessions.py", line 313, in __init__
from werkzeug.contrib.cache import FileSystemCache
ImportError: No module named contrib.cache

eventlet on OS X?

I'm not sure if Eventlet works on OS X because epolls doesn't support OS X.
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inn
er
self.run()
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "scraper.py", line 44, in thread_worker
with eventlet.Timeout(60, False):
File "/usr/local/lib/python3.7/site-packages/eventlet/timeout.py", line 55, in __init__
self.start()
File "/usr/local/lib/python3.7/site-packages/eventlet/timeout.py", line 66, in start
self.timer = get_hub().schedule_call_global(
File "/usr/local/lib/python3.7/site-packages/eventlet/hubs/__init__.py", line 117, in get_hub
use_hub()
File "/usr/local/lib/python3.7/site-packages/eventlet/hubs/__init__.py", line 71, in use_hub
mod = get_default_hub()
File "/usr/local/lib/python3.7/site-packages/eventlet/hubs/__init__.py", line 40, in get_default_hub
return eventlet.hubs.epolls
AttributeError: module 'eventlet.hubs' has no attribute 'epolls'
Eventlet is not platform-specific but its hubs can be. The epolls hub is only for Linux and it is Eventlet's default but you can change it. Check Eventlet's hubs docs to pick the right one for your situation & call eventlet.hubs.use_hub before performing any IO.
Example, using the platform-independent selects hub:
import eventlet
eventlet.hubs.use_hub("selects")

Migration error at startup for Jupyter Notebook

Installed Anaconda3 (Anaconda Navigator 1.8.7) for Mac OS X (10.13.5) as part of a JuliaPro (0.6.3) install. Every time I try to launch Jupyter Notebook (Terminal or Navigator GUI), I get this:
Prestbury:~ me$ jupyter notebook Traceback (most recent call last):
File "/anaconda3/bin/jupyter-notebook", line 11, in
sys.exit(main()) File "/anaconda3/lib/python3.6/site-packages/jupyter_core/application.py",
line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs) File
"/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py",
line 657, in launch_instance
app.initialize(argv) File "", line 2, in initialize File
"/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py",
line 87, in catch_config_error
return method(app, *args, **kwargs) File "/anaconda3/lib/python3.6/site-packages/notebook/notebookapp.py", line
1501, in initialize
super(NotebookApp, self).initialize(argv) File "", line 2, in initialize File
"/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py",
line 87, in catch_config_error
return method(app, *args, **kwargs) File "/anaconda3/lib/python3.6/site-packages/jupyter_core/application.py",
line 242, in initialize
self.migrate_config() File "/anaconda3/lib/python3.6/site-packages/jupyter_core/application.py",
line 168, in migrate_config
migrate() File "/anaconda3/lib/python3.6/site-packages/jupyter_core/migrate.py", line
247, in migrate
with open(os.path.join(env['jupyter_config'], 'migrated'), 'w') as f: PermissionError: [Errno 13] Permission denied:
'/Users/me/.jupyter/migrated'
I have completely removed Anaconda3 and performed a fresh install after also installing nodejs. The problem persists. Any recommendation please?

Cannot load jupyter-notebook from terminal in Ubuntu 14.04

After installing the latest version of Anaconda, and following post-installation steps, I am not able to load jupyter notebook on my system, Ubuntu 14.04.
I get the following error message:
Traceback (most recent call last):
File "./bin/jupyter-notebook", line 6, in <module>
sys.exit(notebook.notebookapp.main())
File "/home/carlos/anaconda3/lib/python3.5/site-packages/jupyter_core /application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/carlos/anaconda3/lib/python3.5/site-packages/traitlets/config/application.py", line 588, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/home/carlos/anaconda3/lib/python3.5/site-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/home/carlos/anaconda3/lib/python3.5/site-packages/notebook/notebookapp.py", line 1023, in initialize
self.init_webapp()
File "/home/carlos/anaconda3/lib/python3.5/site-packages/notebook/notebookapp.py", line 882, in init_webapp
xheaders=self.trust_xheaders)
File "/home/carlos/anaconda3/lib/python3.5/site-packages/tornado/util.py", line 221, in __new__
instance.initialize(*args, **init_kwargs)
File "/home/carlos/anaconda3/lib/python3.5/site-packages/tornado/httpserver.py", line 155, in initialize
read_chunk_size=chunk_size)
File "/home/carlos/anaconda3/lib/python3.5/site-packages/tornado/tcpserver.py", line 112, in __init__
self.ssl_options['certfile'])
ValueError: certfile "jupnb.pem" does not exist
The certfile actually exists, in the directory ~/.jupyter/
I haven't been lucky googling the solution. Any comments?
Thanks!
Carlos
edit ~/.jupyter/jupyter_notebook_config.py and check the correct paths,
e.g. for ~/.jupyter/jupnb.key and ~/.jupyter/jupnb.pem:
import os
c.NotebookApp.keyfile = os.path.expanduser('~') + '/.jupyter/jupnb.key'
c.NotebookApp.certfile = os.path.expanduser('~') + '/.jupyter/jupnb.pem'

Resources