{"action":"created","issue":{"url":"https://api.github.com/repos/sympy/sympy/issues/11934","repository_url":"https://api.github.com/repos/sympy/sympy","labels_url":"https://api.github.com/repos/sympy/sympy/issues/11934/labels{/name}","comments_url":"https://api.github.com/repos/sympy/sympy/issues/11934/comments","events_url":"https://api.github.com/repos/sympy/sympy/issues/11934/events","html_url":"https://github.com/sympy/sympy/issues/11934","id":195054427,"number":11934,"title":"Unicode issue with sympy.stats.FiniteRV","user":{"login":"Erotemic","id":3186211,"avatar_url":"https://avatars.githubusercontent.com/u/3186211?v=3","gravatar_id":"","url":"https://api.github.com/users/Erotemic","html_url":"https://github.com/Erotemic","followers_url":"https://api.github.com/users/Erotemic/followers","following_url":"https://api.github.com/users/Erotemic/following{/other_user}","gists_url":"https://api.github.com/users/Erotemic/gists{/gist_id}","starred_url":"https://api.github.com/users/Erotemic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Erotemic/subscriptions","organizations_url":"https://api.github.com/users/Erotemic/orgs","repos_url":"https://api.github.com/users/Erotemic/repos","events_url":"https://api.github.com/users/Erotemic/events{/privacy}","received_events_url":"https://api.github.com/users/Erotemic/received_events","type":"User","site_admin":false},"labels":[{"id":75782144,"url":"https://api.github.com/repos/sympy/sympy/labels/Easy%20to%20Fix","name":"Easy to Fix","color":"009800","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-12-12T18:52:15Z","updated_at":"2016-12-15T16:52:24Z","closed_at":null,"body":"This is an issue with a quick fix. \r\n\r\nIn python 2.7 I kept getting an error \r\n`TypeError: s should have been string or Symbol`\r\n\r\nwhen executing the following code \r\n\r\n```\r\nimport sympy\r\nsympy.stats.FiniteRV('X', {0: .5, 1: .5})\r\n```\r\nit failed on my machine, but I checked and it worked on the live sympy terminal. \r\n\r\nTurns out the issue is that in `sympy/stats/rv.py` there is a check for `isinstance(s, str)`. \r\nOn my machine I use unicode_literals and my 'X' is evaulated as a unicode character. \r\nBy changing my code to use `sympy.stats.FiniteRV(str('X'), {0: .5, 1: .5})`, everything works. \r\n\r\nIt would be nice to fix this in sympy by using `six` and changing all instances of  \r\n`isinstance(s, str)` to `isinstance(s, six.text_type)`. It you don't want to add six as a dependency then \r\nsix.text_type can easilly be defined somewhere as \r\n`text_type = (str, unicode) if sys.version_info.major == 2 else str`"},"comment":{"url":"https://api.github.com/repos/sympy/sympy/issues/comments/267379395","html_url":"https://github.com/sympy/sympy/issues/11934#issuecomment-267379395","issue_url":"https://api.github.com/repos/sympy/sympy/issues/11934","id":267379395,"user":{"login":"mamakancha","id":19153609,"avatar_url":"https://avatars.githubusercontent.com/u/19153609?v=3","gravatar_id":"","url":"https://api.github.com/users/mamakancha","html_url":"https://github.com/mamakancha","followers_url":"https://api.github.com/users/mamakancha/followers","following_url":"https://api.github.com/users/mamakancha/following{/other_user}","gists_url":"https://api.github.com/users/mamakancha/gists{/gist_id}","starred_url":"https://api.github.com/users/mamakancha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mamakancha/subscriptions","organizations_url":"https://api.github.com/users/mamakancha/orgs","repos_url":"https://api.github.com/users/mamakancha/repos","events_url":"https://api.github.com/users/mamakancha/events{/privacy}","received_events_url":"https://api.github.com/users/mamakancha/received_events","type":"User","site_admin":false},"created_at":"2016-12-15T16:52:24Z","updated_at":"2016-12-15T16:52:24Z","body":"@rmagesh148 Sorry. Did not check. Yes you have merged your repo with the original one [here](https://github.com/sympy/sympy/pull/11945). However since I am working on it I would suggest you to close your pull request.\r\nI hope you understand that it was allotted to me first :)"}}
{"actor":{"display_login":"mamakancha"}}