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


Groups > comp.lang.python > #95450

Python Import Hooks and __main__

Date 2015-08-18 00:26 +0200
From "Sven R. Kunze" <srkunze@mail.de>
Subject Python Import Hooks and __main__
Newsgroups comp.lang.python
Message-ID <mailman.66.1439850402.4764.python-list@python.org> (permalink)

Show all headers | View raw


Hi,

following up on this thread on StackOverflow 
http://stackoverflow.com/questions/16515347/python-import-hooks-and-main 
does somebody has a great idea how to manage this?

The issue at hand is, that I would like to apply a specific import hook 
right from the beginning of the interpreter run (here, a simple test 
case), i.e. also affecting the import/exec of the module __main__.

Hook: https://github.com/srkunze/fork/blob/2e7ecd4b0a/fork.py#L429
Dirty Magic to get things running: 
https://github.com/srkunze/fork/blob/2e7ecd4b0a/fork.py#L425

Best,
Sven

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


Thread

Python Import Hooks and __main__ "Sven R. Kunze" <srkunze@mail.de> - 2015-08-18 00:26 +0200

csiph-web