Compile fails with setpythonpath call

2004-09-21
2013-03-15
  • babelfish25

    babelfish25 - 2004-09-21

    Eclipse version 3.0.0
    PyDev 0.5.3
    PyAntTasks from http://www.rpstechnologies.net/PyAntTasks.html

    I can run a .py file OK, I can debug it, too. But compiling gives this error:
    Buildfile: E:\Coding\Python\feedParserTest\build.xml

    compile:

    setPythonpath() Setting python path: E:\Coding\Python\feedParserTest\src

    BUILD FAILED: E:\Coding\Python\feedParserTest\build.xml:37: Error executing task

    The stated path is valid. Any ideas?

    THanks,
    /Torrmundi

     
    • Ron Smith

      Ron Smith - 2004-09-22

      This isn't really a PyDev thing - the error is coming
      from my py-compile ant task which is separate from
      PyDev.
      The problem might be in finding a python executable.
      The py-compile Ant task tries to run the python
      executable.  If you don't specify one explicitly,
      it'll try to execute 'python', depending on the executable
      to be on your system PATH.  So if it isn't already
      on your PATH, you could add python to your path,
      or you can also explicitly point py-compile and the
      other py-* tasks to your executable via the
      python attribute.  Something like the following:
      <py-compile dir="${src.dir}" optimize="0" pythonpath="${src.dir}" python="C:/Python23/python.exe"/>

       
      • babelfish25

        babelfish25 - 2004-09-22

        Yes, c:\&gt;Python fails to start python (no path).
        However, in Eclipse>Window>Preferences>Pydev>Debug I entered 'c:\bin\python\python.exe' as the interpreter.
        Still failed - I guess that only works for debugging.

        However, using <py-compile dir="${src.dir}" optimize="0" pythonpath="${src.dir}" python="C:/bin/python/python.exe"/>
        did compile properly.

        Isn't there a system variable similar to ${src.dir} that could be used?

        Thanks,
        /John

         
        • Ron Smith

          Ron Smith - 2004-09-22

          Yeah, the setting in Eclipse>Window>Preferences>Pydev>Debug is just for PyDev, which the ant tasks don't use.
          The build script and Python ant tasks can be used with other IDEs or can be invoked from the command line outside of Eclipse/PyDev.

          If you don't want to use the Python executable on the system PATH, you could set a property within Ant using something like:

          <property name="pythonexec" value="C:/bin/python/python.exe"/>

          <py-compile dir="${src.dir}" optimize="0" pythonpath="${src.dir}" python="${pythonexec}"/>

          We should probably take this discussion off this forum since it's not directly PyDev related.

           
    • babelfish25

      babelfish25 - 2004-09-23

      Add in each build.xml file:
      <property file="${ant.home}/myProperties.properties"/>

      <target name="compile">
          <py-compile dir="${src.dir}" optimize="0" pythonpath="${src.dir}" python="${pythonexec}"/>
      </target>

      And in myProperties.properties, located in the 'C:\bin\Eclipse\plugins\org.apache.ant_1.6.1' folder (my ${ant.home}):
      pythonexec=c:\\bin\\python\\python.exe

      Thanks!