Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71819
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; '21,': 0.07; 'string': 0.09; 'lines.': 0.09; 'subject:files': 0.09; 'subject:modules': 0.09; 'runs': 0.10; 'cc:addr:python-list': 0.11; '__builtin__': 0.16; 'dictionary.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'normally,': 0.16; 'renamed': 0.16; 'sense,': 0.16; 'should.': 0.16; 'do,': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'wed,': 0.18; 'module': 0.19; 'properly': 0.19; '>>>': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; '(or': 0.24; 'cc:2**0': 0.24; 'script': 0.25; 'switch': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'that.': 0.31; 'too.': 0.31; 'though.': 0.31; 'there.': 0.32; 'guess': 0.33; 'comment': 0.34; 'skip:_ 10': 0.34; 'there,': 0.34; 'subject:from': 0.34; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'adjust': 0.36; 'c++': 0.36; 'should': 0.36; 'virtual': 0.37; 'two': 0.37; 'little': 0.38; 'expect': 0.39; 'does': 0.39; '(from': 0.39; 'how': 0.40; 'even': 0.60; 'simple': 0.61; 'tossing': 0.84; 'to:none': 0.92; 'serious': 0.97 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type:content-transfer-encoding; bh=USPq47Mi6CAv9Nem5rhhVRDX9GmEHGeiSTtAQjbKx7g=; b=Bc45vfLRKqYIi4QsKTS8EzIbPTcLaR+/vsJD/rJxdwFm6lmRDiMskeG1Tjjm7hSm3L Z9ESLnZEkBV+bS0QaHmJVd87QDnG+QwTzfzBwz5O0uxGx8TqL/wHakUaR7sZS9Q6YBgS 9+3a0UC1HdhC1eimmXf9RDgDkPERft8tem9ni2hehj/s1ucZXggaWDzMSyIewmsnti67 OjoIAuRi6T8ba3lJ5lKDKXntkOeTdgRQWx7DBw3Ak4KikXpaRrR+HFHU6C37rKkFIG95 HdaXsDwt0pdDc7O+/2EHzT7frDHZFdb+KukDHnY12a2XpWKODhVUM8PZLtOerxuSiYgP evYQ== |
| MIME-Version | 1.0 |
| X-Received | by 10.58.74.164 with SMTP id u4mr32313vev.81.1400608558939; Tue, 20 May 2014 10:55:58 -0700 (PDT) |
| In-Reply-To | <537B8E31.7000607@rptd.ch> |
| References | <5376ACE7.8030706@rptd.ch> <ll7iu1$oge$1@ger.gmane.org> <53775D68.2010009@rptd.ch> <ll7o30$pc3$1@ger.gmane.org> <537768FB.7060303@rptd.ch> <ll7q3m$idv$1@ger.gmane.org> <53778005.8030105@rptd.ch> <ll80dl$bov$1@ger.gmane.org> <53778E22.3040701@rptd.ch> <ll84s5$5bd$1@ger.gmane.org> <53790CCF.1070905@rptd.ch> <CAPTjJmrOeSsmoxqk8iCL2tKEX9Qa1yHBLzfbfvNr_7Ap+AP6pg@mail.gmail.com> <537B8E31.7000607@rptd.ch> |
| Date | Wed, 21 May 2014 03:55:58 +1000 |
| Subject | Re: Loading modules from files through C++ |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| 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.10164.1400608567.18130.python-list@python.org> (permalink) |
| Lines | 30 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1400608567 news.xs4all.nl 2887 [2001:888:2000:d::a6]:60960 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:71819 |
Show key headers only | View raw
On Wed, May 21, 2014 at 3:17 AM, Roland Plüss <roland@rptd.ch> wrote: > The important part are the last two lines. An important module is > lacking the __builtins__ dictionary member so I had to add it. > > Hopefully this works also in Py3 should I switch some time later. But I > guess it should seeing how simple the import now became. An interesting omission, I'm a little surprised at that. But if your switch to Py3 is a serious (or even half-serious) possibility, I recommend tossing a quick comment against that line of code. Check to see if you actually need it, and if you still do, see if there's a change there. The module has been renamed (from __builtin__ to builtins, although the global reference to it is still __builtins__), so you may need to adjust something there, too. But mainly, see if you can drop that line of code in Py3. > Furthermore I had to call the string runner with moduleDict both as > global and local dictionary. With that change the virtual script is > properly loaded and working as it should. This part does make sense, though. Normally, module-level code runs with the same locals and globals: >>> locals() is globals() True And that doesn't change in Py3, so I would expect that your C++ code also won't change. ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Loading modules from files through C++ Chris Angelico <rosuav@gmail.com> - 2014-05-21 03:55 +1000
csiph-web