[PyQt] Eric3 issue: importing modules with the same name as an Eric module

Detlev Offenbach detlev at die-offenbachs.de
Sat Oct 13 10:52:29 BST 2007


Hi Sundance,

thanks for the quarantined import. I'll include it in the eric4.1 development 
line. It'll be part of the next snapshot.

Regards,
Detlev

On Dienstag, 9. Oktober 2007, Sundance wrote:
> Sundance wrote:
> > As time allows, yes, with pleasure. No promise about how successful
> > it's gonna be, though, seeing as we're talking badass advanced snake
> > charming here; we'll see how that goes.
>
> ... Ooooookay.
>
> This was even worse than I imagined, but I'm done and, crazily enough,
> it seems to work.
>
> Here's how it works.
>
> 1) Drop the attached source file in the debugger's directory;
>
> 2) Surround the imports to be quarantined with the code that loads and
> turns the quarantined import on, then off. For instance:
>
> ---[ Unquarantined imports ]-------------------------------------------
> import A
> import B
> from C import D
> -----------------------------------------------------------------------
>
> ... becomes...
>
> ---[ Quarantined imports ]---------------------------------------------
> from QuarantinedImport import quarantined_import
> quarantined_import.on()
>
> import A
> import B
> from C import D
>
> quarantined_import.off()
> -----------------------------------------------------------------------
>
> In Eric's case, that would make it:
>
> ---[ DebugClientBase.py excerpt ]--------------------------------------
> [...]
>
> from QuarantinedImport import quarantined_import
> quarantined_import.on()
>
> from DebugProtocol import *
> import DebugClientCapabilities
> from DebugBase import printerr
> from AsyncFile import *
> from Config import ConfigVarTypeStrings
> from FlexCompleter import Completer
>
> quarantined_import.off()
>
> [...]
> -----------------------------------------------------------------------
>
>
> And yeah, that's it.
>
> Warning: this tool is pure evil, it comes with no warranty whatsoever
> and may eat kittens and/or puppies. Also, if there's a module that does
> some very important things at load time that must only happen once, all
> hell will likely break loose if you import that module both inside and
> outside the quarantined zone. Consider yourself warned.
>
> Feedback very welcome!
>
> -- S.



-- 
Detlev Offenbach
detlev at die-offenbachs.de


More information about the PyQt mailing list