Automatic OBD-II Indigo Plugin (discontinued)

Posted on
Sun Nov 26, 2017 3:30 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Automatic OBD-II Indigo Plugin

Indigo already includes requests so you shouldn't have to install that.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Nov 26, 2017 4:11 pm
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Automatic OBD-II Indigo Plugin

dgarozzo wrote:
I'm trying to embed socketIO_client, but I'm having problems. Did you copy the socketIO_client folder from GitHub, or from your Library/Python directory? Or is there some way to run the installer and have it put it directly in my plugin folder?...

I just found an easier way to embed modules with no need to edit or modify anything and no __init__.py.
  1. Create a sub-folder in the Server Plugin folder. I called it Modules. But, the name doesn't matter.
  2. Place the modules in that folder. I just copied (option+dragged) them over from where pip installed them. Drag the entire folder. But, not the folders with the name ending in dist-info. If the module is a single py file, just copy that.
  3. Add the following line in plugin.py, just after the import sys line
    Code: Select all
    sys.path.insert(1, './Modules')
    Change './Modules' to use whatever name you used for your folder. Now python will look in your plugin first to find any modules, before searching the system.
  4. Done

EDIT: BTW, for anyone considering this approach. One advantage is the modules included in the plugin will take precedence over any system or Indigo provided modules of the same name. This might be important if you require a more recent version of a module. It is also possible to append the embedded plugins to the search path. In that case you'd use
Code: Select all
sys.path.append('./Modules')
and your modules would only be used if they could not be found in the system or Indigo environments.

Posted on
Sun Nov 26, 2017 4:47 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Automatic OBD-II Indigo Plugin

You don't really have to do that - just put the module at the same directory level as plugin.py and it should work. I believe they will also be first on the PYTHONPATH so they should supercede any others (though I'm not positive on this point).

One thing you'll need to check is the module's use of compiled code. If it's all Python then you're gold. If it has compiled C code in it, then you're not. If the project is on GitHub, it should be easy to see if there are any compiled sources in it.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Nov 26, 2017 4:55 pm
DVDDave offline
Posts: 470
Joined: Feb 26, 2006
Location: San Jose, CA

Re: Automatic OBD-II Indigo Plugin

dgarozzo wrote:
Ok everybody. I think I got it working again. I promise this worked before! Please get the latest from GitHub.

I've moved everything to use Requests instead of httplib.HTTPSConnection. I also added a checkbox to simplify things while you wait for location information from Automatic.

I have not bundled in the libraries yet. I will try to work on that later. You may need to do the following:

Code: Select all
sudo -H pip install -U requests[security] --ignore-installed six
sudo -H pip install --ignore-installed pyOpenSSL --upgrade
sudo -H pip install ndg-httpsclient


Thanks everybody for helping me out with this!

Didn't work for me, even when I used pip2.7. Modules installed successfully but I got the following errors in the log when I tried to obtain the access token:

Code: Select all
 Automatic OBD-II                FYI - Exception caught _requestAccessToken: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:590)
   Automatic OBD-II                FYI - Exception caught saving access token: No JSON object could be decoded
   Automatic OBD-II                unable to save access_token
   Error (client)                  performRequestMethod() caught exception: ServerRequestError -- server request canceled

Posted on
Sun Nov 26, 2017 4:58 pm
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Automatic OBD-II Indigo Plugin

jay (support) wrote:
You don't really have to do that - just put the module at the same directory level as plugin.py and it should work. I believe they will also be first on the PYTHONPATH so they should supercede any others (though I'm not positive on this point)...
As initialized upon program startup, the first item of the path list (PYTHONPATH), path[0], is the directory containing the script that was used to invoke the Python interpreter. So, yes, any modules placed there would be found automatically. However, for reasons you note, as well as better management of modules when there are more than just a few, placing them in a sub-folder is quite convenient.

Posted on
Sun Nov 26, 2017 5:00 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Automatic OBD-II Indigo Plugin

Looks like that module also requires:

Code: Select all
    install_requires=[
        'requests>=2.7.0',
        'six',
        'websocket-client',
    ],


Indigo installs requests 2.10.0 so that should be good. macOS installs six (though that seems to be an issue as described above). Assuming you get that worked out then you'd need to include the websocket-client - who knows what that requires. This is why pip installs are useful - it deals with the dependency tree. But if you want to include the module then you'll need to make sure that all dependencies are either included with the plugin or with Indigo (if you don't want the user to have to deal with pip).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Nov 26, 2017 5:13 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Automatic OBD-II Indigo Plugin

berkinet wrote:
jay (support) wrote:
You don't really have to do that - just put the module at the same directory level as plugin.py and it should work. I believe they will also be first on the PYTHONPATH so they should supercede any others (though I'm not positive on this point)...
As initialized upon program startup, the first item of the path list (PYTHONPATH), path[0], is the directory containing the script that was used to invoke the Python interpreter. So, yes, any modules placed there would be found automatically. However, for reasons you note, as well as better management of modules when there are more than just a few, placing them in a sub-folder is quite convenient.


We don't launch plugins the same way as invoking the interpreter from the command line, so it wasn't immediately clear that your assumption was correct. It does look like we modify the path to ensure that the Server Plugin folder is the first on the path so that modules there will be found first.

I was simply relating the fact that you don't have to add the extra directory or modify the path - just dropping the module directly into Server Plugin would suffice assuming all required modules were available.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Nov 26, 2017 5:22 pm
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Automatic OBD-II Indigo Plugin

jay (support) wrote:
... it wasn't immediately clear that your assumption was correct. It does look like we modify the path to ensure that the Server Plugin folder is the first on the path so that modules there will be found first...

Well, it wasn't exactly an assumption :wink: I had actually looked at the path while I was seeing how to alter it. For those that are interested, on my system, after inserting "./Modules" at pos 0, the path is
Code: Select all
 Path=:
[
'./Modules',
u'/Library/Application Support/Perceptive Automation/Indigo 7/Plugins/Automatic OBD-II.indigoPlugin/Contents/Server Plugin',
u'/Applications/PyCharm.app/Contents/debug-eggs/pycharm-debug.egg',
u'/Library/Application Support/Perceptive Automation/Indigo 7/IndigoPluginHost.app/Contents/PlugIns',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Python/2.7/site-packages',
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC'
]

Posted on
Sun Nov 26, 2017 5:49 pm
dgarozzo offline
Posts: 132
Joined: Jan 08, 2009

Re: Automatic OBD-II Indigo Plugin

So you updated to the new code, and you ran the pip install for the four commands (both with pip and pip2.7)?

I hate to say it, but can you cycle your computer?

DVDDave wrote:
dgarozzo wrote:
Ok everybody. I think I got it working again. I promise this worked before! Please get the latest from GitHub.

I've moved everything to use Requests instead of httplib.HTTPSConnection. I also added a checkbox to simplify things while you wait for location information from Automatic.

I have not bundled in the libraries yet. I will try to work on that later. You may need to do the following:

Code: Select all
sudo -H pip install -U requests[security] --ignore-installed six
sudo -H pip install --ignore-installed pyOpenSSL --upgrade
sudo -H pip install ndg-httpsclient


Thanks everybody for helping me out with this!

Didn't work for me, even when I used pip2.7. Modules installed successfully but I got the following errors in the log when I tried to obtain the access token:

Code: Select all
 Automatic OBD-II                FYI - Exception caught _requestAccessToken: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:590)
   Automatic OBD-II                FYI - Exception caught saving access token: No JSON object could be decoded
   Automatic OBD-II                unable to save access_token
   Error (client)                  performRequestMethod() caught exception: ServerRequestError -- server request canceled

Posted on
Sun Nov 26, 2017 6:49 pm
DVDDave offline
Posts: 470
Joined: Feb 26, 2006
Location: San Jose, CA

Re: Automatic OBD-II Indigo Plugin

dgarozzo wrote:
So you updated to the new code, and you ran the pip install for the four commands (both with pip and pip2.7)?

I hate to say it, but can you cycle your computer?

Ah, I forgot to restart after using pip2.7. Works now. Thanks!

--Dave

Posted on
Sun Nov 26, 2017 7:14 pm
Dewster35 offline
Posts: 1030
Joined: Jul 06, 2010
Location: Petoskey, MI

Re: Automatic OBD-II Indigo Plugin

Sorry I wasn't more clear, I meant the iOS app for Automatic itself. Still working on getting past step one to get the plugin going :)

dgarozzo wrote:
I'm not following what your complaint is about. What app launches and takes over the entire screen? Is that related to Indigo and the plugin?


Dewster35 wrote:
Very awesome. I've been meaning to take some time to get my two vehicles more integrated and have had the automatic devices for quite some time. My only real complaint is how the app launches and takes over the entire screen when it initially connects.

Posted on
Sun Nov 26, 2017 7:36 pm
dgarozzo offline
Posts: 132
Joined: Jan 08, 2009

Re: Automatic OBD-II Indigo Plugin

Horray!


DVDDave wrote:
dgarozzo wrote:
So you updated to the new code, and you ran the pip install for the four commands (both with pip and pip2.7)?

I hate to say it, but can you cycle your computer?

Ah, I forgot to restart after using pip2.7. Works now. Thanks!

--Dave

Posted on
Sun Nov 26, 2017 7:58 pm
Dewster35 offline
Posts: 1030
Joined: Jul 06, 2010
Location: Petoskey, MI

Re: Automatic OBD-II Indigo Plugin

Perhaps I'm too early in trying out this plugin or perhaps I'm too stupid... but if someone could please help me out on where exactly I need to start here I would appreciate it!

I assume that this is the python version and that comes natively with macOS and I wouldn't be able to use indigo without it.

See below:

Code: Select all
  sudo -H pip2.7 install -U socketIO-client --ignore-installed six
File "/usr/local/bin/pip2.7", line 7, in <module>
    from pip import main
ImportError: No module named pip

Posted on
Sun Nov 26, 2017 8:28 pm
Dewster35 offline
Posts: 1030
Joined: Jul 06, 2010
Location: Petoskey, MI

Re: Automatic OBD-II Indigo Plugin

Python 2.7.10 is the version of python I am installing.

which is perhaps why I was mixing up the two. Is there a straighforward way to go about installing? I've found this: https://packaging.python.org/tutorials/ ... -packages/
but it is still giving me the No module named pip error message.

lanbrown wrote:
If you want to see what version of Python you have, issue the the following command from the terminal:
python --version

Pip is not Python.

Posted on
Sun Nov 26, 2017 8:41 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Automatic OBD-II Indigo Plugin

Dewster35 wrote:
Python 2.7.10 is the version of python I am installing.

which is perhaps why I was mixing up the two. Is there a straighforward way to go about installing? I've found this: https://packaging.python.org/tutorials/ ... -packages/
but it is still giving me the No module named pip error message.


DON'T INSTALL PYTHON. It's already on your system and if you install a non-Apple version you'll almost certainly break Indigo or some plugins.

Now, what exactly makes you think you need a different version of Python.

If pip is not installed, you can install it with this command:

Code: Select all
sudo easy_install pip

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Page 5 of 11 1, 2, 3, 4, 5, 6, 7, 8 ... 11

Who is online

Users browsing this forum: No registered users and 1 guest