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


Groups > comp.lang.python > #95450 > unrolled thread

Python Import Hooks and __main__

Started by"Sven R. Kunze" <srkunze@mail.de>
First post2015-08-18 00:26 +0200
Last post2015-08-18 00:26 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

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

#95450 — Python Import Hooks and __main__

From"Sven R. Kunze" <srkunze@mail.de>
Date2015-08-18 00:26 +0200
SubjectPython Import Hooks and __main__
Message-ID<mailman.66.1439850402.4764.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web