getting appdata TypeError: string indices must be integers
See original GitHub issueI was trying to pull back data for my apps and I kept getting:
Traceback (most recent call last):
File "./samsung-test.py", line 17, in <module>
for app in remote.applications:
File "/usr/lib/python2.7/site-packages/samsungctl-0.8.0b-py2.7.egg/samsungctl/remote_websocket.py", line 227, in applications
if app_1['appId'] == app_2['appId']:
TypeError: string indices must be integers
So I updated the code to resolve that issue:
for app_1 in app_data[1]['data']:
for app_2 in app_data[0]:
if str(app_1['appId']) == str(app_2['appId']):
app_1.update(app_2)
res = []
for app in app_data[1]:
res += [application.Application(self, **app)]
but now I am getting this error:
Traceback (most recent call last):
File "./samsung-test.py", line 17, in <module>
for app in remote.applications:
File "/usr/lib/python2.7/site-packages/samsungctl-0.8.0b-py2.7.egg/samsungctl/remote_websocket.py", line 232, in applications
res += [application.Application(self, **app)]
TypeError: type object argument after ** must be a mapping, not unicode
NOTE: The line number is wrong in my error message because I added so many print statements to troubleshoot this.
I will admit that I am a bit of a hack when it comes to code, so I am not sure what the last error means or how to correct it. Any advice?
Issue Analytics
- State:
- Created 5 years ago
- Comments:22 (15 by maintainers)
Top Results From Across the Web
Python typeerror: string indices must be integers Solution
String indices must be integers. This means that when you're accessing an iterable object like a string, you must do it using a...
Read more >why am I getting a "TypeError: String indices Must be integer ...
I'm following along with a Udemy course for Python & Finance, unfortunately hit a wall whilst trying to call stock data from yahoo...
Read more >Typeerror: string indices must be integers – How to Fix in Python
We get the "TypeError: string indices must be integers" error when we try to access a character using its string value rather the...
Read more >Strange "TypeError: string indices must be integers" when ...
When you pass your procString variable, you are giving the parameters argument as a string which is incorrect. My guess is that when...
Read more >TypeError: string indices must be integers · Issue #73 - GitHub
I only recently started working with this package, and am excited about the prospects for it. However all of a sudden I can't...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
When I ran the script it pulled back and reported the information I expected to see. Here is the data before the change. In order for the loop to work I had to start the loop with data under the “data” key so it new where to get the “data”.
Here is what it returns:
Oh man… Your killing me… I’m playin.
It cool I will leave it open. Tho I think a lot of the information in this issue are going to be irreverent. I had someone else test pulling of application data along with the running of an application and it checked out OK. I finally broke down and set up unittests to mimic the communications between TV and library… and i worked out most of the kinks that way.