<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Apparently, it must execute things at
      import time.<br>
      (this was noted before)<br>
      <br>
      Your comment about "after import unittest, pickle, sys" is
      misleading.<br>
      <br>
      The crucial thing is to be run ASAP after import time. I.E.
      independant from<br>
      <br>
      '__name__ == "__main__".'<br>
      <br>
      Please stop mentioning that, unless you analyzed it further.<br>
      I won't spend the time on it.<br>
      <br>
      On 04/11/13 11:59, lars van Gemerden wrote:<br>
    </div>
    <blockquote
cite="mid:CAP8kt8zo-u4tQFukWfBQQuybYr_QL5kN+CKScL04KEELe=1UMg@mail.gmail.com"
      type="cite">
      <div dir="ltr">Thank you Chris,
        <div><br>
        </div>
        <div>My (pickling) tests are working again.</div>
        <div><br>
        </div>
        <div>One note: for other using this script: the script must run
          before other imports (don't know exactly which, but as early
          as possible seems like a good idea; after 'import unittest,
          pickle, sys' did not work).</div>
        <div><br>
        </div>
        <div>Also thanks John for your integration efforts for
          stackless.</div>
        <div><br>
        </div>
        <div>Cheers, Lars</div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Sat, Nov 2, 2013 at 1:25 AM,
          Christian Tismer <span dir="ltr"><<a
              moz-do-not-send="true" href="mailto:tismer@stackless.com"
              target="_blank">tismer@stackless.com</a>></span> wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">On
            01.11.13 23:57, Christian Tismer wrote:<br>
            ...<br>
            <br>
            Ok, this one is probably better.<br>
            It is also independant from the python version.<br>
            <br>
            It will also give you a hint when it becomes obsolete at
            some later time ;-)<br>
            <br>
            #------------------------------------------------------------------<br>
            # universal pickling wrapper for WingIDE<br>
            <br>
            import os<br>
            <br>
            def wing_hack(logger):
            <div class="im"><br>
                  '''<br>
                  when wing has replaced __import__, wrap that with a
              function<br>
                  that pretends to be the original __import__<br>
                  '''<br>
            </div>
                import sys<br>
                if sys.version_info[0] >= 3:<br>
                    import builtins<br>
                else:<br>
                    import __builtin__ as builtins<br>
                imp = builtins.__import__<br>
                if imp.__name__ != '__import__':<br>
                    <a moz-do-not-send="true" href="http://logger.info"
              target="_blank">logger.info</a>("fixing Wing's import
            hook")
            <div class="im"><br>
                      def __import__(*args, **kw):<br>
                          return imp(*args, **kw)<br>
            </div>
                    __import__.__module__ = builtins.__name__<br>
                    builtins.__import__ = __import__<br>
                else:<br>
                    logger.warn("you can trash the Wing hack")<br>
            <br>
            if 'WINGDB_PYTHON' in os.environ:<br>
                import logging<br>
            <br>
                logging.basicConfig(level=logging.INFO)<br>
                wing_hack(logging.getLogger('WingIDE'))<br>
            <br>
            <br>
            if __name__ == '__main__':<br>
            <br>
                import unittest<br>
                import pickle<br>
                import sys<br>
            <br>
                @unittest.skipIf('Stackless' not in sys.version,
            'Stackless only')<br>
                class Test(unittest.TestCase):<br>
            <br>
                    def testAPickle(self):<br>
                        def test():<br>
                            pass<br>
            <br>
                        string = pickle.dumps(test)<br>
            <br>
                unittest.main()
            <div class="HOEnZb">
              <div class="h5"><br>
                #------------------------------------------------------------------<br>
                <br>
                -- <br>
                Christian Tismer             :^)   <mailto:<a
                  moz-do-not-send="true"
                  href="mailto:tismer@stackless.com" target="_blank">tismer@stackless.com</a>><br>
                Software Consulting          :     Have a break! Take a
                ride on Python's<br>
                Karl-Liebknecht-Str. 121     :    *Starship* <a
                  moz-do-not-send="true"
                  href="http://starship.python.net/" target="_blank">http://starship.python.net/</a><br>
                14482 Potsdam                :     PGP key -> <a
                  moz-do-not-send="true" href="http://pgp.uni-mainz.de"
                  target="_blank">http://pgp.uni-mainz.de</a><br>
                phone <a moz-do-not-send="true"
                  href="tel:%2B49%20173%2024%2018%20776"
                  value="+491732418776" target="_blank">+49 173 24 18
                  776</a>  fax <a moz-do-not-send="true"
                  href="tel:%2B49%20%2830%29%20700143-0023"
                  value="+49307001430023" target="_blank">+49 (30)
                  700143-0023</a><br>
                PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C
                5A3B 57F3 BF04<br>
                      whom do you want to sponsor today?   <a
                  moz-do-not-send="true"
                  href="http://www.stackless.com/" target="_blank">http://www.stackless.com/</a><br>
                <br>
                <br>
                _______________________________________________<br>
                Stackless mailing list<br>
                <a moz-do-not-send="true"
                  href="mailto:Stackless@stackless.com" target="_blank">Stackless@stackless.com</a><br>
                <a moz-do-not-send="true"
                  href="http://www.stackless.com/mailman/listinfo/stackless"
                  target="_blank">http://www.stackless.com/mailman/listinfo/stackless</a><br>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        ====================================<br>
        Lars van Gemerden<br>
        <a moz-do-not-send="true" href="mailto:lars@rational-it.com">lars@rational-it.com</a><br>
        +31 6 26 88 55 39<br>
        ====================================
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Stackless mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Stackless@stackless.com">Stackless@stackless.com</a>
<a class="moz-txt-link-freetext" href="http://www.stackless.com/mailman/listinfo/stackless">http://www.stackless.com/mailman/listinfo/stackless</a></pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Christian Tismer             :^)   <a class="moz-txt-link-rfc2396E" href="mailto:tismer@stackless.com"><mailto:tismer@stackless.com></a>
Software Consulting          :     Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121     :    *Starship* <a class="moz-txt-link-freetext" href="http://starship.python.net/">http://starship.python.net/</a>
14482 Potsdam                :     PGP key -> <a class="moz-txt-link-freetext" href="http://pgp.uni-mainz.de">http://pgp.uni-mainz.de</a>
phone +49 173 24 18 776  fax +49 (30) 700143-0023
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   <a class="moz-txt-link-freetext" href="http://www.stackless.com/">http://www.stackless.com/</a></pre>
  </body>
</html>