PlexConnect n00b questions

Hi all,

I couldn’t find the answer on the wiki and I know it’s intuitive to many but for us newbies -


If I CLOSE the terminal on my MacBook running plex connect, will the atv be able to still access the content on my plex media server?


If not, what terminal command line do I use to re-open plex connect? Do I simply type this every time I open terminal - sudo “/Applications/PlexConnect-master/PlexConnect.py” and leave it open?


Thanks

Yeah, if you don't install PlexConnect as a service - you need to start plexconnect every time your terminal opens.

The plexconnect process needs to be running all the time - which with the basic setup is only when the temrminal window is running.

How would I make it a service?

You can manually install the bash plist or let OpenPlex do it for you. Here is the manual way:

cd /PlexConnect_base_dir/support/OSX
sudo ./install.bash

I closed the terminal and pressed cntrl-c 

Just to make sure that I can start plex connect again, i typed in the sudo command in the terminal and got this:

Edward-Lees-MacBook-Pro:~ edward$ sudo "/Applications/PlexConnect-master/PlexConnect.py"

20:21:00 PILBackgrounds: No PIL/Pillow installation found.

20:21:00 PlexConnect: ***

20:21:00 PlexConnect: PlexConnect

20:21:00 PlexConnect: Press CTRL-C to shut down.

20:21:00 PlexConnect: ***

20:21:00 PlexConnect: started: 20:21:00

20:21:00 PlexConnect: Version: 0.4-dev

20:21:00 PlexConnect: Python: 2.7.5 (default, Mar  9 2014, 22:15:05) 

[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]

20:21:00 PlexConnect: Host OS: darwin

20:21:00 PlexConnect: PILBackgrounds: Is PIL installed? False

20:21:00 PlexConnect: IP_self: 192.168.1.6

20:21:00 DNSServer: started: 20:21:00

20:21:00 DNSServer: Failed to create socket on UDP port 53: [Errno 48] Address already in use

20:21:00 PlexConnect: DNSServer not alive. Shutting down.

20:21:00 PlexConnect: Shutting down.

20:21:01 PlexConnect: shutdown

 
Can someone help me with what's happening here?

You probably have plexconnect running in the background. Reboot your machine and try again or open activity monitor app and kill all the running python processes. What files are in this folder:

/Library/LaunchDaemons?

Like I said earlier OpenPlex will run PlexConnect as a service for you. If you decide to use OpenPlex reboot your mac first then install it.

wahlman - please dial down your ads for OpenPlex a notch. You don't necessarily need it for running PlexConnect. Not as a service, not as anything else.

edwardle - you can easily do a "ps -ef | grep PlexConnect" to check if PlexConnect is already running. If setup as daemon, you can also "sudo launchctl list | grep plexconnect" to check the service's state (see WIKI, Install-Guide-Mac).

wahlman - please dial down your ads for OpenPlex a notch. You don't necessarily need it for running PlexConnect. Not as a service, not as anything else.

I was not trying to advertise but instead just trying to assist since he asked how to install the daemon (plexconnect as a service). You don't need OpenPlex to run PlexConnect you can do everything manually as I informed him earlier. OpenPlex will install PlexConnect as a service in launchctl using the bash.plist.

>>OpenPlex will install PlexConnect as a service in launchctl using the bash.plist.

So does the ./support/OSX/install.bash script. :-D

(On a unrelated note) True but mine works on 10.6 & hackintosh ;)

PlexConnect.bash

*Python 2.7.9 required for it to work on 10.6:

Download Python 2.7.9
 

# Add support for 10.6 and python 2.7.x if installed otherwise defaults to system python
export PATH=/usr/local/bin:$PATH

What a simple fix but so difficult to find the solution to get it to work on 10.6. Any chance this could be added to your github (the 10.6 fix) so it would work better for that version of OS X? If a user doesn't have 2.7.9 installed the bash plist defaults to the system installed python version for all OS X versions. I just solved it yesterday. Hope this helps your plist for better 10.6 support of desired ;)

Well, it really depends WHERE you installed python 2.7.9. From my point of view, this is everything but obvious.

The problem is that 10.6 ships with 2.6.x so in order for the plist to work it needs 2.7.x to be installed otherwise it won’t start on 10.6. Even if the user installs Python 2.7.x the plist won’t run unless the export PATH for Python is in the plist. Typical users wouldn’t know this on 10.6 and having the export PATH in there doesn’t affect other installed Python versions in 10.7-10.10. If a user runs plexconnect manually on 10.6 with 2.7.x installed it will use the 2.7.x version. This only affects the bash daemon plist.

I think, this is more like a correct way to update... http://wolfpaulus.com/jounal/mac/installing_python_osx/

I will try that once I find some time in the next days.

You probably have plexconnect running in the background. Reboot your machine and try again or open activity monitor app and kill all the running python processes. What files are in this folder:
 
/Library/LaunchDaemons?
 
Like I said earlier OpenPlex will run PlexConnect as a service for you. If you decide to use OpenPlex reboot your mac first then install it.


You're right, plex connect still running. Will shut down and restart plex connect to make sure I can fire it back up again. Thanks for the support.

I think, this is more like a correct way to update... http://wolfpaulus.com/jounal/mac/installing_python_osx/

I will try that once I find some time in the next days.

Ok, I followed the shows doc for updating python to 2.7.9.

Did steps 1..3. (4 was fine, as 2.7.5 was running previously; 5 was good for some reason; 6 - I had no .back_profile, so why updating; 7 - no IDE as well).

The only issue I stumbled over: OSX's firewall now asked for confirmation to "allow incoming calls" on python over and over again, even when added to firewall rules. Turns out to be a missing "code signature", which was solved as described here: http://stackoverflow.com/questions/15936801/how-can-i-permanently-accept-osx-firewall-allow-deny-confirmation-when-running-p. Or in short...

sudo codesign -f -s - /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app

Make sure to not neglect the single "-" in that line... it forces "ad hoc signing" - as far as I understand - no need for a valid certificate.

So when you run the default bash plist it says 2.7.9 now in the PlexConnect.log without exporting the path in the plist?

Yep, everything is fine with 2.7.9 (on OSX 10.9).

Could there be a script wrote for OS X? I would love to automate the process of installing python 2.7.9 systemwide using a tool I use ;)

Edit - Nevermind, I think I got it covered....awesome job :)

I'm gonna fire up OS X 10.6-10.10 in virtualbox and see if I can get the script to install the updated Python and allow it to pass through a users firewall (if enabled).

I made a simple app to update python systemwide based on your findings. I need to test it yet on all OS X versions, I assume it works on 10.7-10.10:

Python updater

Anyone can open it in automator to look at the code if desired.

Edit - The path still needs to be exported in 10.6 in order for the default bash to work. On 10.7-10.10 this is not an issue.

Edit 2 - I lied. I found a way on 10.6 :) steps 4 and 5 are required for it to work on 10.6

Edit 3 - On Step two the guy should not of moved the folder, doing so he broke easy_install pip and I assume much more. Here would be a better solution step 2 after deleting the old 2.7.x python so you don't destroy all the symbolic links from /usr/bin by simply just copying it instead:

sudo rm -R /System/Library/Frameworks/Python.framework/Versions/2.7
sudo mkdir /System/Library/Frameworks/Python.framework/Versions/2.7
sudo cp -r /Library/Frameworks/Python.framework/Versions/2.7/* System/Library/Frameworks/Python.framework/Versions/2.7

You can test what he broke by typing this in terminal:

sudo easy_install pip

This makes pillow not very easy to install on a fresh install of OS X ;)

So to sum everything up, systemwide python is a go and pillow is a go on fresh installs of OS X on 2.7.9. Hopefully this helps when it comes time for Python 3.x.

edit 4 - This is the correct way (path) to codesign for python.app since the guy had the incorrect path to being with:

sudo codesign -f -s - /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app

>>edit 3

copying here is somewhat stupid, as then you have python lying around twice...

>>edit 4

if you don't like it in /System/... you can't blame that other guy to choose the wrong path, can you?

Edit:

from https://pip.pypa.io/en/latest/installing.html#pip-included-with-python:

pip included with Python

Python 2.7.9 and later (on the python2 series), and Python 3.4 and later include pip by default [1], so you may have pip already.

Edit:

How about removing the "old" easy_install scripts from /usr/bin as well and adding symlinks to /System/Library/Frameworks/Python.framework/Versions/2.7/bin/easy_install and /easy_install-2.7? The same could be done for pip/pip2.7, I guess. Compare step 5.2.

At least easy_install seems to work after that.

Edit:

The real reason seems to be the following:

All those UNIX scripts in /System/Library/Frameworks/Python.framework/Versions/2.7/bin/ like easy_install, pip, 2to3 link to the now removed python interpreter: /Library/Frameworks/...

Adding the missing /System to their first line, fixes the issue. But then, this really seems to be a bad design, doesn't it? Why don't they look for /usr/bin/env/ or something?

Edit:

Hm. Looks like we went somewhat off-topic. :-D

I hear ya just a bit off topic, but its going make it easy if/when 3.x comes out. Systemwide python 2.7.9, pillow and the python were properly allowed thru the firewall so there was some very good things that came out of this ;)

I was pulling my hair out trying to figure out why everything wouldn't work then it dawned on me. Everything is missing from /Library/........ which broke all the symbolic links. You could fix all the links somehow but I found it easier to just keep both (one in /System and one in /Library). I guess maybe I should test if everything works in the /Library folder on a fresh OS X install. I tried removing the old easy_install easy_install-2.7 and installing pip (took me hours to debug) but just keeping it in /Library seemed to work the best (plus its only 120mb or so extra). Im just not sure what else was broken not having it in /Library/........ which was my main concern. Either way I'm glad you got me started on this so I could get it to work (being in two places unfortunately) and I will update you if I can find a way to have python in /System or /Library only or if I can find out how to fix all the broken links if you don't beat me to it ;)


Edit:

The real reason seems to be the following:

All those UNIX scripts in /System/Library/Frameworks/Python.framework/Versions/2.7/bin/ like easy_install, pip, 2to3 link to the now removed python interpreter: /Library/Frameworks/...

Adding the missing /System to their first line, fixes the issue. But then, this really seems to be a bad design, doesn't it? Why don't they look for /usr/bin/env/ or something?

 
I couldn't agree with you more ;)