A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-October/049156.html below:

[Python-Dev] Running a module as a script

[Python-Dev] Running a module as a script [Python-Dev] Running a module as a scriptNick Coghlan ncoghlan at email.com
Fri Oct 1 03:09:02 CEST 2004
Quoting "Phillip J. Eby" <pje at telecommunity.com>:

> Using the C equivalent of 'imp.find_module()' should cover all these cases, 
> and any new forms of PY_SOURCE or PY_COMPILED that come up in future.

That's essentially what the patch does. PyRun_SimpleModuleFlags uses
_PyImport_FindModule to obtain the absolute file location, then uses
PyRun_SimpleFileExFlags to actually run the script.

_PyImport_FindModule is a trivial wrapper around import.c's find_module()
(which, I believe, is what imp.find_module() invokes)

When multiple versions exist, the patch operates on what find_module() returns
(which ends up using the preference order '.py', '.pyw', '.py[co]')

Cheers,
Nick.

-- 
Nick Coghlan
Brisbane, Australia
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4