Toga Tutorial Log

From OpenCircuits
Jump to: navigation, search

What

This page is a log of running the Toga Tutorial at: https://toga.readthedocs.io/en/latest/tutorial/tutorial-1.html see: Setup Toga with Spyder

The Console Log


>================== run tutorial inside of spyder with adjusted sys.path =====================

running in spyter, the toga_2.py gets its own  interpreter, start fresh each time 


added code for sys.path ( does not run without this, some may have more than absolutely necessary )

print( "--- modify sys.path if necessary add until it works ---" )
import sys
for_sys_path     = []
for_sys_path.append( "/home/russ/python03" )
for_sys_path.append( "/home/russ/toga/src" )
for_sys_path.append( "/home/russ/toga/src/core" )
for_sys_path.append( "/home/russ/toga/src/gtk" )
for_sys_path.append( '/home/russ/anaconda3/lib/python3.6/site-packages' )
test_path_add = for_sys_path  [0]

if sys.path[ 0 ] != test_path_add:
    print( "adding to sys.path" )
    sys.path   = for_sys_path + sys.path 
    pass
else:
    print( " sys.path already modified" )

    ...... rest of file  taken from:   https://toga.readthedocs.io/en/latest/tutorial/tutorial-1.html

---------------- here is spyder ipython console output ------------------


runfile('/home/russ/python03/toga_proj/toga_2.py', wdir='/home/russ/python03/toga_proj')
--- modify sys.path if necessary add until it works ---
adding to sys.path
sys.path = ['/home/russ/python03', '/home/russ/toga/src', '/home/russ/toga/src/core', '/home/russ/toga/src/gtk', '/home/russ/anaconda3/lib/python3.6/site-packages', '', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/russ/.local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3/dist-packages/IPython/extensions', '/home/russ/.ipython']
[GTK+] Not implemented: Widget.set_hidden()
[GTK+] Not implemented: Widget.set_hidden()
[GTK+] Not implemented: Widget.set_hidden()
[GTK+] Not implemented: TextInput.set_alignment()
[GTK+] Not implemented: TextInput.set_font()
[GTK+] Not implemented: TextInput.set_font()
[GTK+] Not implemented: TextInput.set_font()
[GTK+] Not implemented: TextInput.set_font()
[GTK+] Not implemented: TextInput.set_font()
[GTK+] Not implemented: Widget.set_hidden()
[GTK+] Not implemented: TextInput.set_alignment()
[GTK+] Not implemented: TextInput.set_font()
[GTK+] Not implemented: TextInput.set_font()
[GTK+] Not implemented: TextInput.set_font()
[GTK+] Not implemented: TextInput.set_font()
[GTK+] Not implemented: TextInput.set_font()
[GTK+] Not implemented: Widget.set_hidden()
[GTK+] Not implemented: Widget.set_hidden()
[GTK+] Not implemented: Widget.set_hidden()
[GTK+] Not implemented: Widget.set_hidden()
[GTK+] Not implemented: Button.set_background_color()
[GTK+] Not implemented: Widget.set_hidden()

======================= in terminal following ipython fails ===================


russ@ubuntu-18-base:~$ python /home/russ/python03/toga_proj/toga_2.py
--- modify sys.path if necessary ---
adding to sys.path
sys.path = ['/home/russ/python03', '/home/russ/toga/src', '/home/russ/toga/src/core', '/home/russ/toga/src/gtk', '/home/russ/anaconda3/lib/python3.6/site-packages', '', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/russ/.local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3/dist-packages/IPython/extensions', '/home/russ/.ipython']
Traceback (most recent call last):
  File "/usr/lib/python3.6/asyncio/__init__.py", line 9, in <module>
    from . import selectors
ImportError: cannot import name 'selectors'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/russ/python03/toga_proj/toga_2.py", line 43, in <module>
    import toga
  File "/home/russ/toga/src/core/toga/__init__.py", line 1, in <module>
    from .app import *
  File "/home/russ/toga/src/core/toga/app.py", line 6, in <module>
    from toga.command import CommandSet
  File "/home/russ/toga/src/core/toga/command.py", line 1, in <module>
    from toga.handlers import wrapped_handler
  File "/home/russ/toga/src/core/toga/handlers.py", line 1, in <module>
    import asyncio
  File "/usr/lib/python3.6/asyncio/__init__.py", line 11, in <module>
    import selectors  # Will also be exported.
  File "/usr/lib/python3.6/selectors.py", line 10, in <module>
    import math
ModuleNotFoundError: No module named 'math'
russ@ubuntu-18-base:~$ 

------------------------ similiar failure in straight ahead python ..... ---------------------

----- no output shown 

------------------------- also works in ipython from terminal if path setting is changed to: ---------------

# brute force 
print( " sys.path set from literal" )   
sys.path = ['/home/russ/python03', '/home/russ/toga/src', '/home/russ/toga/src/core', '/home/russ/toga/src/gtk', '/home/russ/anaconda3/lib/python3.6/site-packages',
 '', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/russ/.local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/dist-packages', 
 '/usr/lib/python3/dist-packages', '/usr/lib/python3/dist-packages/IPython/extensions', '/home/russ/.ipython']    

 ----------- 
 
rest of ouptut similar to the Spyder console above.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox