<div dir="ltr">my bad, bit too much from the hip i guess..</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Nov 5, 2013 at 6:43 PM, Christian Tismer <span dir="ltr"><<a 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">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>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.<div><div class="h5"><br>
      <br>
      On 04/11/13 11:59, lars van Gemerden wrote:<br>
    </div></div></div><div><div class="h5">
    <blockquote 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 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><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 href="http://logger.info" target="_blank">logger.info</a>("fixing Wing's import
            hook")
            <div><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>
              <div><br>
                #------------------------------------------------------------------<br>
                <br>
                -- <br>
                Christian Tismer             :^)   <mailto:<a 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 href="http://starship.python.net/" target="_blank">http://starship.python.net/</a><br>
                14482 Potsdam                :     PGP key -> <a href="http://pgp.uni-mainz.de" target="_blank">http://pgp.uni-mainz.de</a><br>
                phone <a href="tel:%2B49%20173%2024%2018%20776" value="+491732418776" target="_blank">+49 173 24 18
                  776</a>  fax <a 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 href="http://www.stackless.com/" target="_blank">http://www.stackless.com/</a><br>
                <br>
                <br>
                _______________________________________________<br>
                Stackless mailing list<br>
                <a href="mailto:Stackless@stackless.com" target="_blank">Stackless@stackless.com</a><br>
                <a 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 href="mailto:lars@rational-it.com" target="_blank">lars@rational-it.com</a><br>
        <a href="tel:%2B31%206%2026%2088%2055%2039" value="+31626885539" target="_blank">+31 6 26 88 55 39</a><br>
        ====================================
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
Stackless mailing list
<a href="mailto:Stackless@stackless.com" target="_blank">Stackless@stackless.com</a>
<a href="http://www.stackless.com/mailman/listinfo/stackless" target="_blank">http://www.stackless.com/mailman/listinfo/stackless</a></pre>
    </blockquote>
    <br>
    <br>
    <pre cols="72">-- 
Christian Tismer             :^)   <a href="mailto:tismer@stackless.com" target="_blank"><mailto:tismer@stackless.com></a>
Software Consulting          :     Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121     :    *Starship* <a href="http://starship.python.net/" target="_blank">http://starship.python.net/</a>
14482 Potsdam                :     PGP key -> <a href="http://pgp.uni-mainz.de" target="_blank">http://pgp.uni-mainz.de</a>
phone <a href="tel:%2B49%20173%2024%2018%20776" value="+491732418776" target="_blank">+49 173 24 18 776</a>  fax <a href="tel:%2B49%20%2830%29%20700143-0023" value="+49307001430023" target="_blank">+49 (30) 700143-0023</a>
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   <a href="http://www.stackless.com/" target="_blank">http://www.stackless.com/</a></pre>
  </div></div></div>

<br>_______________________________________________<br>
Stackless mailing list<br>
<a href="mailto:Stackless@stackless.com">Stackless@stackless.com</a><br>
<a href="http://www.stackless.com/mailman/listinfo/stackless" target="_blank">http://www.stackless.com/mailman/listinfo/stackless</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br>====================================<br>
Lars van Gemerden<br><a href="mailto:lars@rational-it.com">lars@rational-it.com</a><br>+31 6 26 88 55 39<br>====================================
</div>