Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #81522

Re: Fwd: Python Signal/Slot + QThred code analysis

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python@mrabarnett.plus.com>
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; 'example:': 0.03; 'mrab': 0.05; 'string.': 0.05; 'that?': 0.05; 'subject:Python': 0.06; 'method.': 0.07; 'subject: + ': 0.07; 'subject:code': 0.07; 'string': 0.09; "'')": 0.09; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'received:192.168.1.4': 0.16; 'statement.': 0.16; 'subject:analysis': 0.16; 'which,': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'simpler': 0.24; 'string,': 0.24; 'tue': 0.24; 'pass': 0.26; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'said,': 0.30; 'see,': 0.30; "skip:' 10": 0.31; '"",': 0.31; 'occurs': 0.31; 'file': 0.32; 'run': 0.32; '(most': 0.33; 'skip:d 20': 0.34; 'problem': 0.35; 'there': 0.35; 'skip:" 50': 0.36; 'method': 0.36; 'christian': 0.38; 'nov': 0.38; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'even': 0.60; 'expression': 0.60; 'subject:Fwd': 0.61; "'with'": 0.84; '.replace': 0.84
X-CM-Score 0.00
X-CNFS-Analysis v=2.1 cv=ZuVjKrLG c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=aoAcgTy3oA8A:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=GYND2esb1r5eJb6Ay_8A:9 a=QEXdDO2ut3YA:10
X-AUTH mrabarnett:2500
Date Tue, 25 Nov 2014 18:20:57 +0000
From MRAB <python@mrabarnett.plus.com>
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Fwd: Python Signal/Slot + QThred code analysis
References <CAAp0bGttki1B=1q5SX_C39L_dRB22YOQiTbVxdvo4jSee0srcw@mail.gmail.com> <CAAp0bGsgMTK7MS1Wvh13304et7Bb7XUyfZTU8ZmF2++BuLj7dw@mail.gmail.com> <5473E188.5020608@gmail.com> <CAAp0bGtYCEWNLV7tnR6O5N706_3AkO9XRBs1pNP8TCxfctUyow@mail.gmail.com> <5474A333.2090207@mrabarnett.plus.com> <CAAp0bGsGLsWoXQnqFYN3KLeUsmcD5ujF80sasM16wx70zQ1xUA@mail.gmail.com> <CAAp0bGvhhWcLO76UQ+nXZuhazjJr9wsjwBkuCX78O4K=em9wuQ@mail.gmail.com>
In-Reply-To <CAAp0bGvhhWcLO76UQ+nXZuhazjJr9wsjwBkuCX78O4K=em9wuQ@mail.gmail.com>
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16291.1416939659.18130.python-list@python.org> (permalink)
Lines 50
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1416939660 news.xs4all.nl 2851 [2001:888:2000:d::a6]:42084
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:81522

Show key headers only | View raw


On 2014-11-25 15:48, Juan Christian wrote:
> On Tue Nov 25 2014 at 1:42:24 PM MRAB <python@mrabarnett.plus.com
> <mailto:python@mrabarnett.plus.com>> wrote:
> I think that the problem there is that strings don't have an __exit__
> method.
>
> I don't understand what you said, what you mean by that? =/
>
The traceback says:

Traceback (most recent call last):
   File "D:\Documents\PyCharm\Trader\Trader\core\outpost.py", line 18, 
in run
     with soup.select('div.stat_box 
div.value')[0].get_text().replace(',', '') as trades, \
AttributeError: __exit__

As you can see, it does:

     soup.select('div.stat_box div.value')[0].get_text()

which, presumably, returns a string, and then it calls the .replace
method on that string, which returns a string.

That string is then bound to 'trades'.

The problem is that this occurs in the expression part of a 'with'
statement.

If you look at this simpler example:


 >>> with 'some string' as a_name:
...     pass
...
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
AttributeError: __exit__


An even simpler example:


 >>> with 'somestring':
...     pass
...
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
AttributeError: __exit__

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Fwd: Python Signal/Slot + QThred code analysis MRAB <python@mrabarnett.plus.com> - 2014-11-25 18:20 +0000

csiph-web