Skip to content
This repository has been archived by the owner on Jul 31, 2018. It is now read-only.

SWAPY list object has no attribute encode #78

Closed
aristotll opened this issue Dec 18, 2015 · 7 comments
Closed

SWAPY list object has no attribute encode #78

aristotll opened this issue Dec 18, 2015 · 7 comments

Comments

@aristotll
Copy link

I update the version for displaying correct Chinese.
However, SWAPY new version has bug the version before does not have.

When clicking the statureBar of a soft,
there is such error:

Traceback error:file:"C:\projects\swapy-pwvh2\build\swapy\out00-PYZ.pyz_mainframe",line
407, in _update Attribute error: 'list' object has no attribute 'encode'

Thanks.

@moden-py
Copy link
Contributor

@aristotll, I do not see relation between those two bugs, I need your help.
Could you try to reproduce list problem again. Is it easy to reproduce?
I cannot figure out how list passed through str conversion with UnicodeEncodeError in 405 in the code (even if the list was a list of unicode values).
If you manage to reproduce it again, please provide the broken field value using a stable version of SWAPY.
If no, it can be a rare problem caused by a thread synchronization issue.

Thanks a lot.

@aristotll
Copy link
Author

I managed to reproduce it with version 0.4.7.
I tries to access the field value, but the soft just broke down whenever I clicked the name.
I can only tell from the screenshot some of the field value is.
Here is my screenshot .

It seems it has an encoding problem,because I can only reproduce it when clicking something with Chinese.
https://www.flickr.com/photos/138319215@N03/23210509333
https://www.flickr.com/photos/138319215@N03/23754821341
https://www.flickr.com/photos/138319215@N03/23541598120

I tried three times with similar results.
Thanks a lot.

@moden-py
Copy link
Contributor

Hope I caught the problem.
I almost sure the Fonts property has Chinese symbols. This causes the known __repr__ problem.
https://bugs.python.org/issue5876
I have no apps with Unicode in the Fonts property, but I managed to artificially invoke the issue.

Here is the fix, please try also Copy value, Copy all and Copy Unicode value on the problem property(I almost sure it is Fonts).
https://ci.appveyor.com/project/moden-py/swapy-pwvh2/build/job/vuiyeae2b134qpj7/artifacts
https://ci.appveyor.com/project/moden-py/swapy-pwvh2/build/job/5dur7g3jtd8tjf84/artifacts

Unfortunately, Python2.X does not work well with unicode.
For example the same property would look:
Python2 Access names: [u'Notepad', u'\u5a31\u4e50 \u2014 \u0411\u043b\u043e\u043a\u043d\u043e\u0442', u'\u5a31\u4e50 \u2014 \u0411\u043b\u043e\u043a\u043d\u043e\u0442Notepad']
Python3 Access names: ['Notepad', '娱乐 — Блокнот', '娱乐 — БлокнотNotepad']

I am planning to port SWAPY on Python 3.X in future.

@aristotll
Copy link
Author

@moden-py
The problem is solved perfectly.
I think the Access names is not a big problem, as long as I can get access to the names from left columns.
Thank you very much.

@moden-py
Copy link
Contributor

Cool, this is a good news!
Will merge the latest fixes in the next release.

moden-py added a commit to moden-py/SWAPY that referenced this issue Dec 20, 2015
Clear 'encode' for object browser.
Fix pywinauto#78.
@changhyuk91
Copy link

Hi guys I just started programming(5days), so I really need help getting this problem fixed. I am getting the same error as aristotll and more.

"Traceback error:file:"C:\projects\swapy-pwvh2\build\swapy\out00-PYZ.pyz_mainframe",line
407, in _update Attribute error: 'list' object has no attribute 'encode'"

Additional errors when I press application.start and application.connect respectively:
image

image

I am using the korean language so I think I am getting the same problem. It seems like you guys found the remedy so I re-downloaded and installed SWAPY32bit.exe from the Github, but the error persists. I dont know how Aristotll got his work.

Thanks so much in advance, you guys are awesome.

I am currently using Python 3.5

@moden-py
Copy link
Contributor

moden-py commented Mar 9, 2016

Hi @changhyuk91 , thank you for the report.
It seems like a new bug, so I've opened appropriate issue
Please, track the problem there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants