← Back to team overview

kicad-developers team mailing list archive

Re: Python functionality on Windows

 

> I am not exactly sure what pythonw is, could you refresh? Is this a
> special windows version?
>

python.exe is a console (terminal) application for launching CLI-type
scripts:
1. Unless run from an existing console window, python.exe opens a new
console window.
2. Standard streams sys.stdin, sys.stdout and sys.stderr are connected to
the console window.
3. Execution is synchronous:
3.1. If a new console window was created, it stays open until the script
terminates.
3.2. When invoked from an existing console window, the prompt is blocked
until the script terminates.

pythonw.exe is a GUI app for launching GUI/no-UI-at-all scripts:
1. NO console window is opened.
2. Execution is asynchronous:
2.1. When invoked from a console window, the script is merely launched and
the prompt returns right away, whether the script is still running or not.
3. Standard streams sys.stdin, sys.stdout and sys.stderr are NOT available.
3.1. Caution: Unless you take extra steps, this has potentially unexpected
side effects:
3.1.1. Unhandled exceptions cause the script to abort silently.
3.1.2. In Python 2.x, simply trying to use print() can cause that to happen.

Source <http://stackoverflow.com/a/30313091>


On a side note, someone have noted that the python is broken on the
> latest windows nightlies, would you try to confirm that? As in, can it
> open the python console in pcbnew?
>

On windows I'm use stable version 4.0.1 where it works. But on linux it is
realy does not work (rev 6557). When I press pyconsole button in pcbnew I
get message "Error: unable to create the Python Console" and output:

Traceback (most recent call last):
  File "<string>", line 3, in <module>
ImportError: No module named pcbnew
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named kicad_pyshell

Since I built kicad from sources, it is installed in /usr/local and python
modules installed in /usr/local/lib/python2.7/site-packages/. When I
created symlinks to /usr/lib/python2.7/site-packages pyconsole started
working.

Regards, Konstantin.

Follow ups

References