Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'bug.': 0.07; 'except:': 0.07; 'subject:Error': 0.07; 'try:': 0.07; 'python': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'typeerror:': 0.09; 'bug': 0.10; '"this': 0.13; '(%s)"': 0.16; 'message-id:@dough.gmane.org': 0.16; 'received:173.11': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'set,': 0.16; 'type:': 0.16; 'unhashable': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'causing': 0.20; 'issue.': 0.20; 'trying': 0.21; 'do.': 0.21; '"",': 0.22; 'fine,': 0.22; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '(most': 0.27; 'there.': 0.28; 'header:X-Complaints-To:1': 0.28; 'convert': 0.29; 'error': 0.30; 'code': 0.31; 'file': 0.32; 'running': 0.32; 'print': 0.32; 'getting': 0.33; 'says': 0.33; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'code:': 0.33; 'another': 0.33; 'thanks': 0.34; 'list': 0.35; 'so,': 0.35; 'there': 0.35; 'received:org': 0.36; 'really': 0.36; 'but': 0.36; 'does': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'group,': 0.60; 'july': 0.60; 'identify': 0.61; 'email addr:gmail.com': 0.63; 'dear': 0.66; 'answer.': 0.71 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Emile van Sebille Subject: Re: Python Error Date: Sun, 29 Jul 2012 07:42:24 -0700 References: <81818a9c-60d3-48da-9345-0c0dfd5b25e7@googlegroups.com> <86285e84-bc6e-4527-9af5-c29f8c9716c0@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 173-11-108-137-sfba.hfc.comcastbusiness.net User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 In-Reply-To: <86285e84-bc6e-4527-9af5-c29f8c9716c0@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 49 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1343572962 news.xs4all.nl 6844 [2001:888:2000:d::a6]:47780 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26193 On 7/29/2012 5:30 AM subhabangalore@gmail.com said... > On Sunday, July 29, 2012 2:57:18 PM UTC+5:30, (unknown) wrote: >> Dear Group, >> I was trying to convert the list to a set, with the following code: >> set1=set(list1) > Thanks for the answer. But my list does not contain another list that is the issue. Intriguing. Thinking what to do. Now you need to identify the type of the object that is causing python to misreport the unhashable type causing the error as the error you're getting says list and you say there isn't one. So, now we have a python bug. >>> set ([1,2,3]) set([1, 2, 3]) >>> set ([1,2,[]]) Traceback (most recent call last): File "", line 1, in TypeError: unhashable type: 'list' >>> set ([1,2,{}]) Traceback (most recent call last): File "", line 1, in TypeError: unhashable type: 'dict' > the code was running fine, but all on a sudden started to give the following error, > > > > set1=set(list1) > > TypeError: unhashable type: 'list' Try adding the following: for ii in list1: try: set([ii]) except: print "this causes an error type (val): %s (%s)" (type(ii),ii) Either it's a python bug or there really is a list in there. Emile