[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Python noob

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 21
Thread images: 4

File: Help.png (113KB, 2560x1402px) Image search: [Google]
Help.png
113KB, 2560x1402px
So I'm trying to get a blinkstick flex (LED controller) to work with some scripts from github.

Keep getting the same errors on all scripts

I have very little experience with python/programming so any help would be appreciated.
>>
>>245138
I have no idea what you are trying to do but the error means that self.reports does not have a wValue - 1th element.

Perhaps print(self.reports) and then compare that to the expected list.
>>
>>245138
The errors preceding the bottom one are being caused by _usb_control_transfer trying to return a an invalid index.
>>
>>245138
You're calling the API right, so the problem is somewhere else.

I suspect you've got to install libUSB or a device driver for the thingy (or maybe be running as elevated administrator), because Windows just letting random Python scripts send raw USB packets to random devices would undermine the security model (for instance a script running as another user could talk to the USB keyboard while you're using it).

There's example python scripts that come with the blinkstick library; see if they work.
>>
>>245152
>>245150
That's a stack trace.

They're all the same error, that's how stack traces work.

reports() obviously holds the results of any incoming transfers (the code seems to be async on Windows and sync on Linux) and the library should be populating it (or at the very least INITIALISING it).
>>
>>245156
How about you print self.reports before the line in green and check that there is a 0x81 - 1th element.
>>
>>245156
OP says he has little experience, so it helps to make him understand what everything is in the first place.
>>
>>245158
I suspect you do too, because you're asking someone who just picked up Python to debug someone else's library.

You realise every single line of code in that screenshot is library code, right?
>>
>>245165
I'm not
>>245150
>>245157
>>
OP here,

>>245154
I have tried the example scripts and they work.

>>245158
Yep, keep it as simple as possible!
>>
>>245168
Add the line `print(self.reports)` before the line that causes the error.

Paste the output here.
>>
>>245168
What if you find an example and copy/paste it into your project?

Your code simply isn't doing enough for there to be an error in it: it's the same boilerplate as in all the rest of the examples, and it's obviously calling the library because we can see the library throwing up.
>>
File: Help2.png (135KB, 2560x1400px) Image search: [Google]
Help2.png
135KB, 2560x1400px
>>245170

Like so?
>>
>>245174
No, put it in the library code, above `return(self.reports[wValue - 1].get())`
>>
File: Help3.png (114KB, 2560x1400px) Image search: [Google]
Help3.png
114KB, 2560x1400px
>>245176
Didn't seem to do anything
>>
>>245176
>>245181
You shouldn't need to mess with the library file anyways. If the example programs work, then your should too. My assumption is that the method you're getting the led count is wrong.
>>
>>245181
What exactly are you trying to make with your script?
>>
File: Works.png (7KB, 483x238px) Image search: [Google]
Works.png
7KB, 483x238px
>>245183
That kinda makes sense.

Pic works no problem
>>
>>245184

I downloaded a repository of effects for the blinkstick flex. Each one has the same error, so I am trying to find what the problem is on the most simple script
>>
>>245189
At the very least, you can just manually use 32 (according to their website) for your LED count.
>>
>>245195

Thanks that works. Still gonna try to find out whats wrong with the get_led_count though.
Thread posts: 21
Thread images: 4


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.