2

I reinstalled my computer, Shady used to work before (I was barely getting to grips with how it works tbh, but it worked). Now I can't seem to even start anything.

I am a novice

This is what I get, when I try to run the demo. I assume its not to do with shady, but something is amiss with my setup. I did a fresh install of anaconda, python 3.7.4

$ python -m Shady demo showcase

In [1]:                                                                         


Let's set up the "World" in which our Stimuli will reside.  Since we
don't know you well enough yet to know how you're arranging your
windows and screens, let's take the unusual step of making the World
a framed, draggable window.



        world = Shady.World( width=1200, height=700, top=50, frame=True )

        world.MakeCanvas( gamma=2.2 )  # you can also have this step done
                                       # automatically by including canvas=True
                                       # in the World constructor line (along
                                       # with any other physical properties
                                       # like gamma)


(press ctrl-D to run)

In [1]:   




SyntaxError                               Traceback (most recent call last)
//anaconda3/lib/python3.7/runpy.py in _run_module_as_main(mod_name, alter_argv)
    191         sys.argv[0] = mod_spec.origin
    192     return _run_code(code, main_globals, None,
--> 193                      "__main__", mod_spec)
    194 
    195 def run_module(mod_name, init_globals=None,

//anaconda3/lib/python3.7/runpy.py in _run_code(code, run_globals, init_globals, mod_name, mod_spec, pkg_name, script_name)
     83                        __package__ = pkg_name,
     84                        __spec__ = mod_spec)
---> 85     exec(code, run_globals)
     86     return run_globals
     87 

//anaconda3/lib/python3.7/site-packages/Shady/__main__.py in <module>
    264 if main in [ 'unrecognized', 'absent' ]: main = subcommands[ 'run' ]
    265 else: sys.argv.pop( 1 )
--> 266 main()

//anaconda3/lib/python3.7/site-packages/Shady/__main__.py in <lambda>()
    244 subcommands = dict(
    245         list = ListDemos,
--> 246         demo = lambda: Shady.Utilities.RunShadyScript( *sys.argv[ 1: ] ) if sys.argv[ 1: ] else ListDemos(),
    247         run = lambda: Shady.Utilities.RunShadyScript( '--console=None', *sys.argv[ 1: ] ),
    248         shell = lambda: Shady.Utilities.RunShadyScript( '--skipShadyInteractionUntilTheEnd', *sys.argv[ 1: ] ),

//anaconda3/lib/python3.7/site-packages/Shady/Utilities.py in RunShadyScript(*argv, **kwargs)
   1762                                 time.sleep( 0.010 )
   1763                 ei = user_ns.pop( '_SHADY_CONSOLE_EXCEPTION_INFO', None )
-> 1764                 if ei: reraise( *ei )
   1765         except CommandLineError as exc:
   1766                 print( exc )

//anaconda3/lib/python3.7/site-packages/Shady/Utilities.py in reraise(cls, instance, tb)
     67 import threading
     68 
---> 69 def reraise( cls, instance, tb=None ): raise ( cls() if instance is None else instance ).with_traceback( tb )
     70 try: Exception().with_traceback
     71 except: exec( 'def reraise( cls, instance, tb=None ): raise cls, instance, tb' ) # has to be wrapped in exec because this would be a syntax error in Python 3.0

//anaconda3/lib/python3.7/site-packages/Shady/Console.py in RunScript(script, on_close, user_ns, color, threaded, interactive, prefer_ipython)
    546         compiled = compile( code, script, 'exec' )
    547         einfo = []
--> 548         try: _exec( compiled, user_ns )
    549         except AbortInteraction: pass
    550         except: einfo = sys.exc_info()

//anaconda3/lib/python3.7/site-packages/Shady/Console.py in _exec(compiled, user_ns)
    481         if pause: sys.stdout.write( '\n(press %s to %s)\n' % ( 'ctrl-D' if isIPython else 'enter', 'run' if code else 'continue' ) )
    482 
--> 483 def _exec( compiled, user_ns ): exec( compiled, user_ns, user_ns )
    484 def RunScript( script, on_close=None, user_ns=None, color=True, threaded=True, interactive=False, prefer_ipython=True ):
    485         global SCRIPT_THREAD, SHELL_THREAD

/anaconda3/lib/python3.7/site-packages/Shady/examples/showcase.py in <module>
     54                 a framed, draggable window.
     55         """#:
---> 56                 world = Shady.World( width=1200, height=700, top=50, frame=True )
     57                 world.MakeCanvas( gamma=2.2 )  # you can also have this step done
     58                                                # automatically by including canvas=True

//anaconda3/lib/python3.7/site-packages/Shady/Rendering.py in __init__(self, width, height, left, top, screen, threaded, canvas, frame, fullScreenMode, visible, openglContextVersion, legacy, backend, acceleration, debugTiming, profile, syncType, logfile, reportVersions, window, **kwargs)
   1486                         if self._fatal: reraise( *self._fatal )
   1487                 elif hijacker:
-> 1488                         hijacker.WaitFor( self._Construct, **kwargs )
   1489                         hijacker.Queue( self.Run )
   1490                         while self.__state != 'running' and hijacker.running: time.sleep( 0.1 )

//anaconda3/lib/python3.7/site-packages/Shady/Console.py in WaitFor(self, func, *pargs, **kwargs)
    243                 container = self.Queue( func, *pargs, **kwargs )
    244                 while not container: time.sleep( 0.001 )
--> 245                 if len( container ) > 1: reraise( *container )
    246                 return container[ 0 ]
    247         def Run( self ):

//anaconda3/lib/python3.7/site-packages/Shady/Console.py in reraise(cls, instance, tb)
     44 if sys.version < '3': bytes = str
     45 else: unicode = str; basestring = ( unicode, bytes )
---> 46 def reraise( cls, instance, tb=None ): raise ( cls() if instance is None else instance ).with_traceback( tb )
     47 try: Exception().with_traceback
     48 except: exec( 'def reraise( cls, instance, tb=None ): raise cls, instance, tb' ) # has to be wrapped in exec because this would be a syntax error in Python 3.0

//anaconda3/lib/python3.7/site-packages/Shady/Console.py in Run(self)
    257                                 else:
    258                                         if func is self.__stop: break
--> 259                                         try: container.append( func( *pargs, **kwargs ) )
    260                                         except: container.extend( sys.exc_info() )
    261                         except KeyboardInterrupt:

//anaconda3/lib/python3.7/site-packages/Shady/Rendering.py in _Construct(self, width, height, window, left, top, screen, canvas, frame, fullScreenMode, visible, openglContextVersion, legacy, debugTiming, profile, syncType, reportVersions, **kwargs)
   1531 
   1532                         if hasattr( window, 'TabulaRasa' ): window.TabulaRasa()
-> 1533                         window = window( **window_kwargs )
   1534                 self.window = window
   1535                 self.window.excepthook = ExceptionHook

//anaconda3/lib/python3.7/site-packages/Shady/ShaDyLibWindowing.py in __init__(self, width, height, left, top, screen, frame, fullScreenMode, visible, openglContextVersion, legacy, glslDirectory, substitutions)
     90                 try:
     91                         adjusted = dict( left=left, top=top, width=width, height=height )
---> 92                         pixelScaling = DPI.CheckRetinaScaling( screen=screen, raiseException=True, adjust=adjusted )
     93                         #left, top, width, height = [ adjusted[ field ] for field in 'left top width height'.split() ]  # TODO: would like to uncomment this so that you get the resolution you ask for, but then the coordinates would be inconsistent with Shady.Screens() outputs...
     94                 except OSError as err:

//anaconda3/lib/python3.7/site-packages/Shady/DPI.py in CheckRetinaScaling(screen, raiseException, adjust)
    171         out, err = [ x if x is str else x.decode( 'ascii', errors='ignore' ) for x in sp.communicate( applescript.encode( 'utf-8' ) ) ]
    172         if err or sp.returncode: raise OSError( 'Applescript returned error code ' + str( sp.returncode ) + ( ': ' if err else '' ) + err  )
--> 173         screenInfo = ast.literal_eval( out )
    174         if 'error' in screenInfo: raise ValueError( screenInfo[ 'error' ] )
    175 

//anaconda3/lib/python3.7/ast.py in literal_eval(node_or_string)
     44     """
     45     if isinstance(node_or_string, str):
---> 46         node_or_string = parse(node_or_string, mode='eval')
     47     if isinstance(node_or_string, Expression):
     48         node_or_string = node_or_string.body

//anaconda3/lib/python3.7/ast.py in parse(source, filename, mode)
     33     Equivalent to compile(source, filename, mode, PyCF_ONLY_AST).
     34     """
---> 35     return compile(source, filename, mode, PyCF_ONLY_AST)
     36 
     37 

SyntaxError: invalid syntax (<unknown>, line 1)

Thanks for the help!

jez
  • 14,867
  • 5
  • 37
  • 64

1 Answers1

1

This is almost certainly not your fault. Rather, it looks like Shady's failure to interpret some new way in which your operating system is delivering information (when queried via AppleScript) about the system screen resolution. Why is your Mac delivering that information in a new, unexpected way? That's impossible to tell because the actual AppleScript output isn't being printed. It could be happening if you have updated to a new version of macOS on which Shady has never been tested before. Currently it has been tested on 10.14 (Mojave) but not 10.15 (the Catalina preview)—was an upgrade to 10.15 entailed in the "reinstallation" you mention?

This is best regarded as a bug, so the place to proceed from here is https://bitbucket.org/snapproject/shady-gitrepo/issues . Can you resubmit your report there, using the "Create Issue" button? As stated in the intro text there, it would be valuable to paste the output of Shady.ReportVersions() in your bug report, in addition to the error backtrace you included above. That will show the macOS version, among other things.

jez
  • 14,867
  • 5
  • 37
  • 64
  • Thank you for the answer! Not quite sure why this was an issue. I do have Mojave installed, but it seems to work just fine now. – Gergely Szarka Aug 13 '19 at 20:54