<html style="direction: ltr;">
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
    <style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
  </head>
  <body style="direction: ltr;"
    bidimailui-detected-decoding-type="UTF-8" text="#000000"
    bgcolor="#FFFFFF">
    On 13/10/2011 08:10 ص, Gadget/Steve wrote:
    <blockquote cite="mid:BLU0-SMTP361D5C365846C089F8E218A9BE00@phx.gbl"
      type="cite">
      <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
      Presumably you can run it if you cd to c:\trunk\Project first.  </blockquote>
    Actually i can't run the project from c:\trunk\Project in both cases
    by IDE or from batch file<span class="moz-smiley-s2"><span> :-( </span></span><br>
    <br>
    <blockquote cite="mid:BLU0-SMTP361D5C365846C089F8E218A9BE00@phx.gbl"
      type="cite">Your batch file is wrong in that %CD% will add the
      current directory, c:\trunk to the path NOT c:\trunk\MyProject as
      can be seen from the log.  </blockquote>
    Actually I realy want to run the project from c:\trunk because I
    sucessfully run it from same path in IDE.<br>
    <br>
    <blockquote cite="mid:BLU0-SMTP361D5C365846C089F8E218A9BE00@phx.gbl"
      type="cite">You can either add to the path with an explicit line,
      that will allow you to run from anywhere but require that your
      code always lives in the same place and always be run from the
      batch file.  Better would be to add near the beginning of main.py
      something like the following:<br>
      <br>
      import sys<br>
      from os.path import split, join, abspath<br>
      main = abspath(sys.arg[0]) # get the path for main<br>
      (maindir, main0 = split(main) # split it<br>
      sys.path.insert(0, maindir) # add the main directory to the
      beginning of the path.<br>
    </blockquote>
    I got:
    <pre>AttributeError: 'module' object has no attribute 'arg'</pre>
    <br>
  </body>
</html>