Page 1 of 1

Can't start Viscosity

Posted: Tue Feb 21, 2017 3:23 am
by Narbat
I've been happily using Viscosity for many years now. Within the past few days I've been unable to even start the app. I double-click in Finder and nothing happens. Console shows me this:
Code: Select all
default	11:07:35.741337 -0500	Viscosity	*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '/Projects/viscosity-mac/viscosity/Source/main.m:92 main() PyRun_SimpleFile failed with file '/Users/sking/Applications/Viscosity.app/Contents/Resources/main.py'.  See console for errors.'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fffaa6f9e7b __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x00007fffbf2e3cad objc_exception_throw + 48
	2   CoreFoundation                      0x00007fffaa77899d +[NSException raise:format:] + 205
	3   Viscosity                           0x0000000100e94b54 main + 1200
	4   libdyld.dylib                       0x00007fffbfbc7255 start + 1
)
default	11:07:35.787669 -0500	kernel	AMFI: allowing exception handler for 'Viscosity' (860) because the process is not restricted.
I've re-installed the latest Viscosity but that hasn't fixed the issue. Any suggestions?

MacOS 10.12.3 (16D32) (upgraded from El Capitan a few weeks ago)
Viscosity 1.6.8

Re: Can't start Viscosity

Posted: Fri Feb 24, 2017 3:27 am
by James
Hi Narbat,

Please see the following article:
https://www.sparklabs.com/support/kb/ar ... -mac-os-x/

Cheers,
James

Re: Can't start Viscosity

Posted: Fri Feb 24, 2017 7:31 am
by Narbat
James wrote:
Please see the following article:
https://www.sparklabs.com/support/kb/ar ... -mac-os-x/
Sorry, no good. One, this is Sierra (10.12.3) and SIP is protecting that directory. The article itself even says,

Please note: This is no longer a problem as of OS X 10.11 (El Capitan). System Integrity Protection (SIP) protects the system frameworks from damage, including the Python framework. If you're encountering a problem starting Viscosity on OS X 10.11 or later version of macOS, and have not manually disabled SIP, please get in touch with our support staff instead.

So, here I am, contacting the support staff. :-) I'll contact directly if the forum doesn't pan out.
https://www.sparklabs.com/support/#contact

Two, I compared my /System/Library/Frameworks/Python.framework directory to an older Time Machine backup and they're byte-for-byte identical. I also compared md5sums of all the files in that directory tree against another machine running Sierra. Again, identical. Whatever the issue is, it's not a damaged Python.framework.

Hmmm... Looks like the problem is a conflict with something in ~/Library/Python/2.7. I removed that directory and Viscosity works again. Probably something I installed with pip or homebrew, perhaps before I upgraded to Sierra. When I get a chance I'll examine it more closely to see what's conflicting.

Re: Can't start Viscosity

Posted: Tue Mar 21, 2017 1:35 am
by Narbat
I isolated the issue. MacOS Sierra ships with v2.5.1 of the pyobjc framework, but at some point I had installed v3.2.1 under my home directory. I think I had a bunch of out of date modules installed so I told pip to upgrade everything. Oops. Don't do that... Anyway, I removed all the v3.2.1 versions and Viscosity is working fine and dandy again.

This might be something to add to the FAQ. In the post-SIP world you can still mess yourself up with locally installed modules, even though they're installed to your home directory instead of under /System.

Re: Can't start Viscosity

Posted: Tue Mar 21, 2017 4:04 am
by James
Thanks for the info Narbat, glad to hear you got Viscosity working.

We did look at bundling a trimmed down version of PyObjC with Viscosity to avoid these type of things (and it would also allow us to use the latest version and avoid some annoying bugs in the system-shipped version), however we ended up just biting the bullet and accelerating our plans to drop the use of Python/PyObjC in the next version (1.7). There are currently alpha versions of 1.7 in the post linked below that no longer require Python:
https://www.sparklabs.com/forum/viewtop ... 2255#p6826

Cheers,
James