<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hi Rami, Stefan, Bruno.<br>
    <br>
    First a big thanks for your replies. <br>
    <br>
    On 07/09/2010 20:54, Rami Chowdhury wrote:
    <blockquote
      cite="mid:AANLkTinWGCUDe8R4q4yo=gPsSH1-sNs82uFnXZKZxbD7@mail.gmail.com"
      type="cite">
      <div class="gmail_quote">Hi Ian,<br>
        <br>
        <div>I think I see where you're going wrong -- this bit me too
          when I was learning Python, having come from PHP. Unlike PHP,
          when you import a module in Python it does *not* inherit the
          importing module's namespace. So the "log" function you're
          accessing in DelNotePrinter.py is not the one you defined
          above the import statement.<br>
          <br>
        </div>
      </div>
    </blockquote>
    Hmm. My php background shows that much. Huh? :)  I guess so. <br>
    <blockquote
      cite="mid:AANLkTinWGCUDe8R4q4yo=gPsSH1-sNs82uFnXZKZxbD7@mail.gmail.com"
      type="cite">
      <div class="gmail_quote"><br>
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
          0.8ex; border-left: 1px solid rgb(204, 204, 204);
          padding-left: 1ex;">
          <div bgcolor="#ffffff" text="#000000">
            <div class="im">
              <blockquote type="cite"> <br>
                <a moz-do-not-send="true"
href="http://docs.python.org/reference/executionmodel.html#naming-and-binding"
                  target="_blank">http://docs.python.org/reference/executionmodel.html#naming-and-binding</a>
                <br>
                <br>
              </blockquote>
            </div>
            Thanks for the pointer. What a truly execrable piece of
            writing - full of over-long sentences and multiple
            subordinate clauses. It routinely uses terms before
            definition, and sometimes without definition.  It is
            astonishingly bad. <br>
          </div>
        </blockquote>
        <div><br>
          Perhaps you could help rewrite it? I'm sure the maintainers
          would be very happy to get a documentation patch.<br>
           </div>
      </div>
    </blockquote>
    I would be happy to re-write it but I do need to understand the
    subject better before that can happen. Clear and wrong will not help
    anyone. :)<br>
    <br>
    <blockquote
      cite="mid:AANLkTinWGCUDe8R4q4yo=gPsSH1-sNs82uFnXZKZxbD7@mail.gmail.com"
      type="cite">
      <div class="gmail_quote">
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
          0.8ex; border-left: 1px solid rgb(204, 204, 204);
          padding-left: 1ex;">
          <div bgcolor="#ffffff" text="#000000"> <br>
             Do I really have to move a 4 line function into its own
            file and import it again and again and again? <br>
          </div>
        </blockquote>
        <div><br clear="all">
        </div>
      </div>
      The short answer is yes. If you have this and similar functions
      that you call from various modules, then it's ideal to put them in
      a utility module of their own. However, as imported modules are
      cached in Python, this isn't as expensive as you might think if
      you are more used to other languages.<br>
      <br>
    </blockquote>
    OK. Now I understand the need, the solution is easy. <br>
    <br>
    My first exploration of the wonders of writing windows services has
    had five things wrong with it:<br>
       1) Its windows - spit, crash, complicated, can't start a command
    line with elevated permissions, nash teeth, rip hair out. <br>
       2) Its services - so no stdout, or stderr,  errors not reported,
    no "current directory" - burn and crash programming all over again.
    Deep joy!<br>
       3) pythonservice.exe - so module not called __main__ and
    initialisation not performed (unseen - see 2) - More fun. <br>
       4) multi-threading   - I got really confused from this example <br>
<a class="moz-txt-link-freetext" href="http://docs.python.org/library/multiprocessing.html#exchanging-objects-between-processes">http://docs.python.org/library/multiprocessing.html#exchanging-objects-between-processes</a><br>
     becasue I got the wrong sort of Queue, so it stalled when it failed
    to call task_done()  (there isn't such a method - but no error 
    reported see 2). <br>
       5) Names pipes. The latest is that writing - yes writing - to the
    named pipe causes the reader to fail with <br>
        (232, 'ConnectNamedPipe', 'The pipe is being closed.')  if I
    write using php - yet I can write with python no trouble. <br>
    <br>
    There are down sides to "batteries included". When there are so many
    batteries, it can be hard to know if what you have is "good enough"
    or should you search for a more suitable one.  Logging would have
    helped me a lot (assuming it would work in service environment with
    the permissions it would have had - a serious assumption). If it
    failed, it would have failed and hidden the problem. <br>
    <br>
    Oh to get on to proper GUI programming with python and PyQt! The
    next project. Wey Hey!   <br>
    <br>
    Thanks again<br>
    <br>
    Ian   <br>
      <br>
    <br>
       <br>
    <br>
  </body>
</html>