[IronPython] Spurious warning when executing modules with -m
fuzzyman at voidspace.org.uk
Fri Aug 21 16:16:56 PDT 2009
As quick as ever Dino. :-)
Dino Viehland wrote:
> runpy is setting __package__ to an empty string. Looks like CPython doesn't
> warn when the string is empty because if I do:
> import runpy
> x = runpy.run_module('foo', run_name = '__main__', alter_sys=True)
> CPython doesn't warn. So the fix is easy enough.
> But it's interesting CPython no longer calls runpy.run_module anymore. I
> guess it's calling runpy._run_module_as_main as there's a big comment saying
> should we make this public.
>> -----Original Message-----
>> From: users-bounces at lists.ironpython.com [mailto:users-
>> bounces at lists.ironpython.com] On Behalf Of Michael Foord
>> Sent: Friday, August 21, 2009 3:40 PM
>> To: Discussion of IronPython
>> Subject: [IronPython] Spurious warning when executing modules with -m
>> Create a Python file called foo.py containing nothing but "import os".
>> Execute it with "python -m foo" and "ipy.exe -m foo" (Python 2.6 and
>> IronPython 2.6 B2).
>> C:\compile\testing>python -m foo
>> C:\compile\testing>ipy.exe -m foo
>> <string>:1: RuntimeWarning: Parent module '' not found while handling
>> absolute import
>> Users mailing list
>> Users at lists.ironpython.com
> Users mailing list
> Users at lists.ironpython.com
More information about the Users