NiklasRosenstein / myo-python

Python bindings for the Myo SDK
Other
259 stars 102 forks source link

API throws runtime error due to invalid event type #25

Closed TomaszDBorusiak closed 9 years ago

TomaszDBorusiak commented 9 years ago

Hi Niklas,

Thank you for providing a Python API for the Myo. I was working with the device for some time and noticed a weird behavior while using your API.

When starting to connect to the armband I run into the problem that an invalid event type is registered causing a runtime error (as defined in the if statement in the file myo/init.py starting in line 324).

I would get this event sometimes during the initial connection procedure or shortly after connecting and using the armband.

After narrowing down the root cause for this behavior I added an additional check in the if statement that deals with invalid event types. This fixed the issue and everything runs stable.

Do you or anybody else happen to have experienced anything like this before? If you want, I can of course share the details of my modification or make a pull request?

The environment I run is the following:

Mac OS X 10.10.4 Myo Connect 0.15.0

Kind regards,

Tomek

NiklasRosenstein commented 9 years ago

Hi Tomek, thanks a lot for reporting this issue. I will have a closer look at this tomorrow. I haven't experienced this before, but it could be possible that a more recent Myo SDK version introduced a new event type.

I would welcome a pull request.

Cheers, Niklas

TomaszDBorusiak commented 9 years ago

Hi Niklas,

Thank you for your quick reply!

I just created the pull request.

Have a nice weekend!

Kind regards,

Tomek

juharris commented 9 years ago

Are you referring to https://github.com/TomaszDBorusiak/myo-python/pull/1 ? You should make it into this repo also.

NiklasRosenstein commented 9 years ago

Unfortunately I can't get my Myo to connect right now, so I can't work on this. :(

TomaszDBorusiak commented 9 years ago

Hi juharris and Niklas,

Sorry for the delay in my response! I had no access to a PC during the weekend.

@juharris: I am new to github and mixed something up when I wanted to create a pull request. That branch does not contain any modifications. You are also right about a better error handling. I just wanted to indicate the place where the misbehavior appeared. I just caught the invalid event with a "pass".

@Niklas: I will look into this and get more details this week and report my findings to you. So no worries if you cannot connect your Myo at the moment.

NiklasRosenstein commented 9 years ago

A warning is displayed now instead of an error being raised: 9335663d00df762b29e0c0f12550d8d73aa097b6

NiklasRosenstein commented 9 years ago

This issue should be updated when #26 is implemented so we can display the value of the event type that wasn't recognized.