Giter VIP home page Giter VIP logo

pywinpty's Introduction

PyWinpty: Pseudoterminals for Windows in Python

Project License - MIT pypi version conda version download count Downloads PyPI status Windows tests

Copyright © 2017–2022 Spyder Project Contributors Copyright © 2022– Edgar Andrés Margffoy Tuay

Overview

PyWinpty allows creating and communicating with Windows processes that receive input and print outputs via console input and output pipes. PyWinpty supports both the native ConPTY interface and the previous, fallback winpty library.

Dependencies

To compile pywinpty sources, you must have Rust installed. Optionally, you can also have Winpty's C header and library files available on your include path.

Installation

You can install this library by using conda or pip package managers, as it follows:

Using conda (Recommended):

conda install pywinpty

Using pip:

pip install pywinpty

Building from source

To build from sources, you will require both a working stable or nightly Rust toolchain with target x86_64-pc-windows-msvc, which can be installed using rustup.

Optionally, this library can be linked against winpty library, which you can install using conda-forge:

conda install winpty -c conda-forge

If you don't want to use conda, you will need to have the winpty binaries and headers available on your PATH.

Finally, pywinpty uses Maturin as the build backend, which can be installed using pip:

pip install maturin

To test your compilation environment settings, you can build pywinpty sources locally, by executing:

maturin develop

This package depends on the following Rust crates:

  • PyO3: Library used to produce Python bindings from Rust code.
  • WinPTY-rs: Create and spawn processes inside a pseudoterminal in Windows from Rust.
  • Maturin: Build system to build and publish Rust-based Python packages.

Package usage

Pywinpty offers a single python wrapper around winpty library functions. This implies that using a single object (winpty.PTY) it is possible to access to all functionality, as it follows:

# High level usage using `spawn`
from winpty import PtyProcess

proc = PtyProcess.spawn('python')
proc.write('print("hello, world!")\r\n')
proc.write('exit()\r\n')
while proc.isalive():
	print(proc.readline())

# Low level usage using the raw `PTY` object
from winpty import PTY

# Start a new winpty-agent process of size (cols, rows)
cols, rows = 80, 25
process = PTY(cols, rows)

# Spawn a new console process, e.g., CMD
process.spawn(br'C:\windows\system32\cmd.exe')

# Read console output (Unicode)
process.read()

# Write input to console (Unicode)
process.write(b'Text')

# Resize console size
new_cols, new_rows = 90, 30
process.set_size(new_cols, new_rows)

# Know if the process is alive
alive = process.isalive()

# End winpty-agent process
del process

Running tests

We use pytest to run tests as it follows (after calling maturin develop), the test suite depends on pytest-lazy-fixture, which can be installed via pip:

pip install pytest pytest-lazy-fixture flaky

All the tests can be exceuted using the following command

python runtests.py

Changelog

Visit our CHANGELOG file to learn more about our new features and improvements.

Contribution guidelines

We follow PEP8 and PEP257 for pure python packages and Rust to compile extensions. We use MyPy type annotations for all functions and classes declared on this package. Feel free to send a PR or create an issue if you have any problem/question.

pywinpty's People

Contributors

albertopasqualetto avatar andfoy avatar blink1073 avatar cam-gerlach avatar ccordoba12 avatar cgohlke avatar dalito avatar ddddhm1234 avatar dependabot[bot] avatar goanpeca avatar joseph-roitman avatar nanoant avatar niyas-sait avatar tirkarthi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pywinpty's Issues

Python 3.6 doesn't support UR prefix

The example in the main page is incorrect:

# Low level usage using the raw `PTY` object
from winpty import PTY

# Start a new winpty-agent process of size (cols, rows)
cols, rows = 80, 25
process = PTY(cols, rows)

# Spawn a new console process, e.g., CMD
process.spawn(ur'C:\windows\system32\cmd.exe')

because Python 3.6 doesn't support UR prefix. You have to pass it as a string:
process.spawn('C:\windows\system32\cmd.exe')

For Command Prompt if you use / instead of \ in the process.spawn() it doesn't work.

Is there a way to pass complicated command using PTY instead of PtyProcess?

Thanks

OSError: [WinError 10048] on spawning of PtyProcess

This is a follow up of #85. (Pywintypes 0.5.1, Win7, Python-3.6.4-64bit)

If a socket is already in use, an OSError is raised on Windows. However, _get_address increments the port number only for socket.error but not for OSError.

Changing the code to increment the port number on OSError solves the problem 99% of the time. However, sometimes another process acquires the port between _get_address (where the port is closed at the end) and the bind operation in PtyProcess.init(...). I think it is not a good idea to separate _get_adress from the actual bind in PtyProcess.init(...).

winpty.lib missing error

Installing pywinpty with
python setup.py install

we receive this error:

LINK : fatal error LNK1181: cannot open input file 'winpty.lib'

This is due to setup script that point to winpty.lib in
C:\Python34\PCbuild

You have to create that folder and put winpty.lib inside it if you want to complete the procedure. Complete linker command is:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python34\libs /LIBPATH:C:\Python34\PCbuild winpty.lib /EXPORT:PyInit_cywinpty build\temp.win32-3.4\Release\winpty/cywinpty.obj /OUT:build\lib.win32-3.4\winpty\cywinpty.pyd /IMPLIB:build\temp.win32-3.4\Release\winpty\cywinpty.lib /MANIFESTFILE:build\temp.win32-3.4\Release\winpty\cywinpty.pyd.manifest

Is this a bug?

Release 0.1.3

After PR #44 I think we can release 0.1.3 to include winpty files inside our wheel.

@andfoy, please do that.

Access violation writing 0x0000000000000000 on Windows 7

@jxrossel commented on Wed Oct 04 2017

Description of your problem

When starting spyder, I get an error message with "Terminal server could not be located (...)" and something about starting spyder in debugging mode (which I don't know how to do).

What steps will reproduce the problem?

  1. starting spyder

What is the expected output? What do you see instead?
error message and no terminal in the consoles

Please provide any additional information below

Versions and main components

  • Terminal Version: 0.2.2
  • Spyder Version: 3.2.3
  • Python Version: python-3.6.2.amd64 (from WinPython, then I just updated spyder and spyder-terminal)
  • Operating system: Windows 7

pip list

adodbapi (2.6.0.7) alabaster (0.7.10) algopy (0.5.5) altair (1.2.0) altair-widgets (0.1.2) argh (0.26.2) asgi-redis (1.4.3) asgiref (1.1.2) astroid (1.5.3) astroML (0.3) attrs (17.2.0) autobahn (17.9.3) Automat (0.6.0) Babel (2.4.0) backports-abc (0.5) backports.weakref (1.0rc1) baresql (0.7.4) bcolz (1.1.2) beautifulsoup4 (4.6.0) bkcharts (0.2) blaze (0.10.1) bleach (2.0.0) blosc (1.5.1) bloscpack (0.11.0) bokeh (0.12.9) boto3 (1.4.1) botocore (1.4.36) Bottleneck (1.2.1) bqplot (0.9.0) brewer2mpl (1.4.1) Brotli (0.6.0) certifi (2017.7.27.1) cffi (1.10.0) channels (1.1.8) chardet (3.0.4) circus (0.14.0) click (6.7) cloudpickle (0.3.1) clrmagic (0.0.1a2) colorama (0.3.9) colorcet (0.9.1) coloredlogs (7.3) comtypes (1.1.3) constantly (15.1.0) CVXcanon (0.1.1) cvxopt (1.1.9) cvxpy (0.4.10) cx-Freeze (5.0.2) cycler (0.10.0) cyordereddict (1.0.0) Cython (0.26) cytoolz (0.8.2) daphne (1.3.0) dask (0.15.1) datashader (0.5.0) datashape (0.5.2) db.py (0.5.3) decorator (4.1.2) dill (0.2.7.1) distributed (1.18.0) Django (1.11.5) django-debug-toolbar (1.7) django-modeltranslation (0.12.1) django-redis (4.8.0) django-spaghetti-and-meatballs (0.2.2) django-su (0.5.2) docopt (0.6.2) docrepr (0.1.0) docutils (0.14) ecos (2.0.4) edward (1.3.3) emcee (2.2.1) entrypoints (0.2.3) enum34 (1.1.6) fast-histogram (0.2.1) fastcache (1.0.2) fasteners (0.14.1) fastparquet (0.1.1) feather-format (0.3.1) Flask (0.12.2) Flask-Cors (3.0.3) formlayout (1.1.0) fuzzywuzzy (0.15.0) geopy (1.11.0) gitdb2 (2.0.0) GitPython (2.1.3) gmpy2 (2.0.8) greenlet (0.4.12) guidata (1.7.6) guiqwt (3.0.3) h5py (2.7.0) HeapDict (1.0.0) holoviews (1.8.2) html5lib (1.0b10) humanfriendly (4.4.1) husl (4.0.3) hyperlink (17.3.1) idna (2.5) imageio (2.2.0) imagesize (0.7.1) incremental (17.5.0) iowait (0.2) ipykernel (4.6.1) ipyleaflet (0.3.0) ipympl (0.0.5) ipyparallel (6.0.2) ipython (6.1.0) ipython-genutils (0.2.0) ipython-sql (0.3.8) ipywidgets (6.0.0) isort (4.2.15) itsdangerous (0.24) jedi (0.10.2) Jinja2 (2.9.6) jmespath (0.9.3) joblib (0.11) jsonschema (2.6.0) julia (0.1.2) jupyter (1.0.0) jupyter-client (5.1.0) jupyter-console (5.1.0) jupyter-core (4.3.0) jupyter-sphinx (0.1.1) jupyterlab (0.26.5) jupyterlab-launcher (0.3.1) Keras (2.0.6) keras-vis (0.4.1) Lasagne (0.2.dev1) lazy-object-proxy (1.3.1) livereload (2.5.1) llvmlite (0.19.0) lmfit (0.9.7) locket (0.2.0) lxml (3.8.0) Markdown (2.6.8) MarkupSafe (1.0) matplotlib (2.0.2) mccabe (0.6.1) metakernel (0.20.4) mistune (0.7.4) mizani (0.3.2) mkl-service (1.1.2) monotonic (1.3) moviepy (0.2.3.2) mpl-scatter-density (0.2) mpld3 (0.3) mpldatacursor (0.6.2) mpmath (0.19) msgpack-python (0.4.8) multipledispatch (0.4.9) multiprocess (0.70.5) mypy (0.521) mysql-connector-python (2.0.4) nbconvert (5.2.1) nbconvert-reportlab (0.1) nbdime (0.3.0) nbformat (4.3.0) netCDF4 (1.2.9) networkx (1.11) nltk (3.2.4) notebook (5.1.0rc1) numba (0.34.0) numdifftools (0.9.20) numexpr (2.6.2) numpy (1.13.1+mkl) numpydoc (0.7.0) oct2py (4.0.6) octave-kernel (0.26.2) odo (0.5.0) olefile (0.44) palettable (3.0.0) pandas (0.20.3) pandas-datareader (0.5.0) pandocfilters (1.4.2) param (1.5.1) partd (0.3.8) pathtools (0.1.2) patsy (0.4.1) pdfrw (0.3) pep8 (1.7.0) pexpect (4.2.1) pg8000 (1.10.5) pickleshare (0.7.4) Pillow (4.2.1) pip (9.0.1) pkginfo (1.4.1) plotnine (0.2.1) ply (3.10) port-for (0.3.1) prettytable (0.7.2) prompt-toolkit (1.0.15) protobuf (3.3.0) psutil (5.2.2) ptpython (0.41) ptyprocess (0.5.2) PuLP (1.6.8) Pweave (0.30.0a1) py (1.4.34) pyarrow (0.5.0) PyAudio (0.2.11) pybars3 (0.9.3) pybind11 (2.1.1) pycodestyle (2.3.1) pycparser (2.17) pyflakes (1.6.0) pyflux (0.4.15) pygame (1.9.3) Pygments (2.2.0) pylint (1.7.2) pymc (2.3.6) pymc3 (3.1) PyMeta3 (0.5.1) pymongo (3.5.0) pyodbc (4.0.17) PyOpenGL (3.1.1) pypandoc (1.3.2) pyparsing (2.2.0) PyQt5 (5.9) pyqtgraph (0.10.0) pyreadline (2.0) pyserial (3.4) pystache (0.5.4) pytest (3.2.0) python-dateutil (2.6.1) python-hdf4 (0.9) python-Levenshtein (0.12.0) python-snappy (0.5.1) pythonnet (2.4.0.dev0) PythonQwt (0.5.5) pytz (2017.2) PyWavelets (0.5.2) pywin32 (221) pywinpty (0.2.1) pywinusb (0.4.2) PyYAML (3.12) pyzmq (16.0.2) QtAwesome (0.4.4) qtconsole (4.3.0) QtPy (1.3.0) redis (2.10.6) reportlab (3.4.0) requests (2.18.3) requests-file (1.4.2) requests-ftp (0.3.1) requests-toolbelt (0.8.0) rope (0.10.5) rpy2 (2.8.6) Rx (1.5.9) s3fs (0.1.2) s3transfer (0.1.10) scikit-fuzzy (0.3.dev0) scikit-image (0.13.0) scikit-learn (0.18.2) scikit-neuralnetwork (0.7) scikit-optimize (0.3) scilab2py (0.6) scipy (0.19.1) scs (1.2.6) seaborn (0.8.0) setuptools (36.2.7) simplegeneric (0.8.1) simplejson (3.11.1) sip (4.19.3) six (1.10.0) smmap2 (2.0.3) snakeviz (0.4.1) snowballstemmer (1.2.1) sortedcontainers (1.5.7) sounddevice (0.3.8) Sphinx (1.6.3) sphinx-autobuild (0.7.1) sphinx-rtd-theme (0.2.4) sphinxcontrib-websupport (1.0.1) spyder (3.2.3) spyder-notebook (0.2.0.dev0) spyder-reports (0.1.1) spyder-terminal (0.2.2) SQLAlchemy (1.1.13) sqlite-bro (0.8.11) sqlparse (0.2.3) statsmodels (0.8.0) supersmoother (0.4) sympy (1.1.1) tables (3.4.2) tblib (1.3.2) tensorflow (1.2.1) testpath (0.3.1) Theano (0.9.0) thriftpy (0.3.9) toolz (0.8.2) tornado (4.5.1) tqdm (4.15.0) traitlets (4.3.2) traittypes (0.0.6) tri.declarative (0.34.0) tri.form (5.0.1) tri.named-struct (0.12.0) tri.query (4.0.0) tri.struct (2.5.4) tri.table (5.0.0) twine (1.9.1) Twisted (17.9.0) twitter (1.17.1) txaio (2.8.2) typed-ast (1.0.4) urllib3 (1.21.1) vega (0.5.0) ViTables (3.0.0) watchdog (0.8.3) wcwidth (0.1.7) webencodings (0.5.1) Werkzeug (0.12.2) wheel (0.29.0) whitenoise (3.3.1) widgetsnbextension (2.0.0) winpython (1.9.20170812) wordcloud (1.3.2) wrapt (1.10.10) xarray (0.9.6) xlrd (1.0.0) XlsxWriter (0.9.8) xlwings (0.11.4) zarr (2.1.4) zict (0.1.2) zope.interface (4.4.3)

@andfoy commented on Wed Oct 04 2017

Hi @jxrossel, to start Spyder on debugging mode you must need to set the SPYDER_DEV variable, as it follows, the following commands must be executed from a system terminal, which corresponds to cmd.exe on Windows:

set SPYDER_DEV=True
spyder

After the execution, the file spyder_terminal_err.log must appear on your current working directory, which is this case must be the directory of the current terminal. Please post the contents of this file, so we can help you to trace the error.


@jxrossel commented on Thu Oct 05 2017

Hi, when starting spyder like that, I first had another error message "The Jupyter Notebook server failed to start..." and then the same message as above. The error log doesn't seem very helpful:

2017-10-05 10:15:14 ETACH-W113024 __main__[8060] INFO Server is now at: 127.0.0.1:8071
2017-10-05 10:15:14 ETACH-W113024 __main__[8060] INFO Shell: C:\Windows\system32\cmd.exe

I then tried to open a new terminal in spyder, and the error log became:

2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /?path=C:/Users/rosselj/PythonDev/satemo (127.0.0.1) 4.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/css/ubuntu.css (127.0.0.1) 133.95ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/components/xterm.js/dist/xterm.css (127.0.0.1) 6.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/components/xterm.js/dist/addons/fullscreen/fullscreen.css (127.0.0.1) 2.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/css/style.css (127.0.0.1) 3.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/components/promise-polyfill/promise.js (127.0.0.1) 6.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/components/fetch/fetch.js (127.0.0.1) 6.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/components/xterm.js/dist/addons/attach/attach.js (127.0.0.1) 5.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/components/xterm.js/dist/addons/fit/fit.js (127.0.0.1) 5.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/components/xterm.js/dist/addons/fullscreen/fullscreen.js (127.0.0.1) 4.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/components/jquery/dist/jquery.min.js (127.0.0.1) 13.99ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/js/main.js (127.0.0.1) 5.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/components/xterm.js/dist/xterm.js (127.0.0.1) 48.98ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/css/fonts/ubuntumono-regular-webfont.woff2 (127.0.0.1) 5.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/css/fonts/ubuntumono-bold-webfont.woff2 (127.0.0.1) 4.00ms
2017-10-05 10:18:05 ETACH-W113024 __main__[8060] INFO CWD: C:/Users/rosselj/PythonDev/satemo
2017-10-05 10:18:05 ETACH-W113024 __main__[8060] INFO Size: (56, 33)
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 POST /api/terminals?cols=56&rows=33 (127.0.0.1) 105.96ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] WARNING 404 GET /favicon.ico (127.0.0.1) 26.99ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 101 GET /terminals/0f5853 (127.0.0.1) 0.00ms
2017-10-05 10:18:05 ETACH-W113024 __main__[8060] INFO WebSocket opened: 0f5853
2017-10-05 10:18:05 ETACH-W113024 __main__[8060] INFO TTY On!
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 POST /api/terminals/0f5853/size?cols=67&rows=31 (127.0.0.1) 4.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 POST /api/terminals/0f5853/size?cols=61&rows=31 (127.0.0.1) 3.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 POST /api/terminals/0f5853/size?cols=67&rows=31 (127.0.0.1) 3.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 POST /api/terminals/0f5853/size?cols=61&rows=31 (127.0.0.1) 3.00ms

The prompt in the terminal doesn't respond though


@andfoy commented on Thu Oct 05 2017

@jxrossel, can you open a browser tab on the server URL, as shown on the log file? On this case, 127.0.0.1:8071? Does a terminal appears there?

Also, I invite you to open an issue on spyder-notebook if you have notebook-related issues.


@jxrossel commented on Thu Oct 05 2017

Thanks for the answer, but pywinpty v0.2.1 is the last available version on pypi and its the one I have, so I can't update it...

I've stopped doing blind upgrades (with -U) since it tends to break installations (typically when upgrading a package which depends on the upgrade of another compiled package whose compilation fails...). Usually, I do a 2-step upgrade (with -U --no-deps first, then a simple install)


@jxrossel commented on Thu Oct 05 2017

... and I've checked the 127.0.0.1:8071 in my browser after opening Spyder. Nothing is shown on that page, but the tab title "OS Web terminal" is displayed (better than nothing, I guess!)


@andfoy commented on Thu Oct 05 2017

@jxrossel Is there any message on the developer Web console?


@jxrossel commented on Thu Oct 05 2017

SCRIPT445: Object doesn't support this action
File: main.js, Line: 11, Column: 1
var promptEvent = new Event('promptReady'); 

@andfoy commented on Thu Oct 05 2017

@jxrossel Can you test if pywinpty is working as expected? Please post the output of the following commands (From a Python prompt):

from winpty import PTY

# Start a new winpty-agent process of size (cols, rows)
cols, rows = 80, 25
process = PTY(cols, rows)

# Spawn a new console process, e.g., CMD
process.spawn(r'C:\windows\system32\cmd.exe')

# Read console output (Unicode)
process.read()

@jxrossel commented on Thu Oct 05 2017

process.spawn(r'C:\windows\system32\cmd.exe') --> True

process.read()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\PortableSoftware\WinPython3-6\python-3.6.2.amd64\lib\site-packages\winpty\winpty_wrapper.py", line 55, in read
    None, None)
OSError: exception: access violation writing 0x0000000000000000

@andfoy commented on Thu Oct 05 2017

@jxrossel Finally an error! Let me check, it seems that this belongs to pywinpty rather than spyder-terminal. However, let me investigate more about it, this is the first instance of such issue.

not finding "winpty.h" while recompiling v0.1.4

message is:

python setup.py sdist bdist_wheel
....
....
Writing pywinpty-0.1.4\setup.cfg
Creating tar archive
removing 'pywinpty-0.1.4' (and everything under it)
running bdist_wheel
running build
running build_py
running build_ext
building 'winpty.cywinpty' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\WinPython\basedir36\buildSlim\winpython-32bit-3.6.x.0\python-3.6.2\include -IC:\WinPython\basedir36\buildSlim\winpython-32bit-3.6.x.0\python-3.6.2\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcwinpty/cywinpty.c /Fobuild\temp.win32-3.6\Release\winpty/cywinpty.obj
cywinpty.c
winpty/cywinpty.c(489): fatal error C1083: Cannot open include file: 'winpty.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
````

Remove experimental features

Asynchronous reading using LPOVERLAPPED_COMPLETION_ROUTINE callback signature causes compilation errors on x86 systems

from .cywinpty import Agent --> Error Python 3.6.4 and 2.7.x

It is impossible to use the library due to this error:

from .cywinpty import Agent
ImportError: DLL load failed: The specified procedure could not be found.

Executing
python setup.py install

I see this error but the procedure finishes without any problem:
winpty/cywinpty.pyx: cannot find cimported module 'winpty._winpty'

Release 0.4.1

I forgot to add instructions to pack winpty binaries alongside binary wheels

Terminal server could not be located

@jxrossel commented on Wed Oct 04 2017

Description of your problem

When starting spyder, I get an error message with "Terminal server could not be located (...)" and something about starting spyder in debugging mode (which I don't know how to do).

What steps will reproduce the problem?

  1. starting spyder

What is the expected output? What do you see instead?
error message and no terminal in the consoles

Please provide any additional information below

Versions and main components

  • Terminal Version: 0.2.2
  • Spyder Version: 3.2.3
  • Python Version: python-3.6.2.amd64 (from WinPython, then I just updated spyder and spyder-terminal)
  • Operating system: Windows 7

pip list

adodbapi (2.6.0.7)
alabaster (0.7.10)
algopy (0.5.5)
altair (1.2.0)
altair-widgets (0.1.2)
argh (0.26.2)
asgi-redis (1.4.3)
asgiref (1.1.2)
astroid (1.5.3)
astroML (0.3)
attrs (17.2.0)
autobahn (17.9.3)
Automat (0.6.0)
Babel (2.4.0)
backports-abc (0.5)
backports.weakref (1.0rc1)
baresql (0.7.4)
bcolz (1.1.2)
beautifulsoup4 (4.6.0)
bkcharts (0.2)
blaze (0.10.1)
bleach (2.0.0)
blosc (1.5.1)
bloscpack (0.11.0)
bokeh (0.12.9)
boto3 (1.4.1)
botocore (1.4.36)
Bottleneck (1.2.1)
bqplot (0.9.0)
brewer2mpl (1.4.1)
Brotli (0.6.0)
certifi (2017.7.27.1)
cffi (1.10.0)
channels (1.1.8)
chardet (3.0.4)
circus (0.14.0)
click (6.7)
cloudpickle (0.3.1)
clrmagic (0.0.1a2)
colorama (0.3.9)
colorcet (0.9.1)
coloredlogs (7.3)
comtypes (1.1.3)
constantly (15.1.0)
CVXcanon (0.1.1)
cvxopt (1.1.9)
cvxpy (0.4.10)
cx-Freeze (5.0.2)
cycler (0.10.0)
cyordereddict (1.0.0)
Cython (0.26)
cytoolz (0.8.2)
daphne (1.3.0)
dask (0.15.1)
datashader (0.5.0)
datashape (0.5.2)
db.py (0.5.3)
decorator (4.1.2)
dill (0.2.7.1)
distributed (1.18.0)
Django (1.11.5)
django-debug-toolbar (1.7)
django-modeltranslation (0.12.1)
django-redis (4.8.0)
django-spaghetti-and-meatballs (0.2.2)
django-su (0.5.2)
docopt (0.6.2)
docrepr (0.1.0)
docutils (0.14)
ecos (2.0.4)
edward (1.3.3)
emcee (2.2.1)
entrypoints (0.2.3)
enum34 (1.1.6)
fast-histogram (0.2.1)
fastcache (1.0.2)
fasteners (0.14.1)
fastparquet (0.1.1)
feather-format (0.3.1)
Flask (0.12.2)
Flask-Cors (3.0.3)
formlayout (1.1.0)
fuzzywuzzy (0.15.0)
geopy (1.11.0)
gitdb2 (2.0.0)
GitPython (2.1.3)
gmpy2 (2.0.8)
greenlet (0.4.12)
guidata (1.7.6)
guiqwt (3.0.3)
h5py (2.7.0)
HeapDict (1.0.0)
holoviews (1.8.2)
html5lib (1.0b10)
humanfriendly (4.4.1)
husl (4.0.3)
hyperlink (17.3.1)
idna (2.5)
imageio (2.2.0)
imagesize (0.7.1)
incremental (17.5.0)
iowait (0.2)
ipykernel (4.6.1)
ipyleaflet (0.3.0)
ipympl (0.0.5)
ipyparallel (6.0.2)
ipython (6.1.0)
ipython-genutils (0.2.0)
ipython-sql (0.3.8)
ipywidgets (6.0.0)
isort (4.2.15)
itsdangerous (0.24)
jedi (0.10.2)
Jinja2 (2.9.6)
jmespath (0.9.3)
joblib (0.11)
jsonschema (2.6.0)
julia (0.1.2)
jupyter (1.0.0)
jupyter-client (5.1.0)
jupyter-console (5.1.0)
jupyter-core (4.3.0)
jupyter-sphinx (0.1.1)
jupyterlab (0.26.5)
jupyterlab-launcher (0.3.1)
Keras (2.0.6)
keras-vis (0.4.1)
Lasagne (0.2.dev1)
lazy-object-proxy (1.3.1)
livereload (2.5.1)
llvmlite (0.19.0)
lmfit (0.9.7)
locket (0.2.0)
lxml (3.8.0)
Markdown (2.6.8)
MarkupSafe (1.0)
matplotlib (2.0.2)
mccabe (0.6.1)
metakernel (0.20.4)
mistune (0.7.4)
mizani (0.3.2)
mkl-service (1.1.2)
monotonic (1.3)
moviepy (0.2.3.2)
mpl-scatter-density (0.2)
mpld3 (0.3)
mpldatacursor (0.6.2)
mpmath (0.19)
msgpack-python (0.4.8)
multipledispatch (0.4.9)
multiprocess (0.70.5)
mypy (0.521)
mysql-connector-python (2.0.4)
nbconvert (5.2.1)
nbconvert-reportlab (0.1)
nbdime (0.3.0)
nbformat (4.3.0)
netCDF4 (1.2.9)
networkx (1.11)
nltk (3.2.4)
notebook (5.1.0rc1)
numba (0.34.0)
numdifftools (0.9.20)
numexpr (2.6.2)
numpy (1.13.1+mkl)
numpydoc (0.7.0)
oct2py (4.0.6)
octave-kernel (0.26.2)
odo (0.5.0)
olefile (0.44)
palettable (3.0.0)
pandas (0.20.3)
pandas-datareader (0.5.0)
pandocfilters (1.4.2)
param (1.5.1)
partd (0.3.8)
pathtools (0.1.2)
patsy (0.4.1)
pdfrw (0.3)
pep8 (1.7.0)
pexpect (4.2.1)
pg8000 (1.10.5)
pickleshare (0.7.4)
Pillow (4.2.1)
pip (9.0.1)
pkginfo (1.4.1)
plotnine (0.2.1)
ply (3.10)
port-for (0.3.1)
prettytable (0.7.2)
prompt-toolkit (1.0.15)
protobuf (3.3.0)
psutil (5.2.2)
ptpython (0.41)
ptyprocess (0.5.2)
PuLP (1.6.8)
Pweave (0.30.0a1)
py (1.4.34)
pyarrow (0.5.0)
PyAudio (0.2.11)
pybars3 (0.9.3)
pybind11 (2.1.1)
pycodestyle (2.3.1)
pycparser (2.17)
pyflakes (1.6.0)
pyflux (0.4.15)
pygame (1.9.3)
Pygments (2.2.0)
pylint (1.7.2)
pymc (2.3.6)
pymc3 (3.1)
PyMeta3 (0.5.1)
pymongo (3.5.0)
pyodbc (4.0.17)
PyOpenGL (3.1.1)
pypandoc (1.3.2)
pyparsing (2.2.0)
PyQt5 (5.9)
pyqtgraph (0.10.0)
pyreadline (2.0)
pyserial (3.4)
pystache (0.5.4)
pytest (3.2.0)
python-dateutil (2.6.1)
python-hdf4 (0.9)
python-Levenshtein (0.12.0)
python-snappy (0.5.1)
pythonnet (2.4.0.dev0)
PythonQwt (0.5.5)
pytz (2017.2)
PyWavelets (0.5.2)
pywin32 (221)
pywinpty (0.2.1)
pywinusb (0.4.2)
PyYAML (3.12)
pyzmq (16.0.2)
QtAwesome (0.4.4)
qtconsole (4.3.0)
QtPy (1.3.0)
redis (2.10.6)
reportlab (3.4.0)
requests (2.18.3)
requests-file (1.4.2)
requests-ftp (0.3.1)
requests-toolbelt (0.8.0)
rope (0.10.5)
rpy2 (2.8.6)
Rx (1.5.9)
s3fs (0.1.2)
s3transfer (0.1.10)
scikit-fuzzy (0.3.dev0)
scikit-image (0.13.0)
scikit-learn (0.18.2)
scikit-neuralnetwork (0.7)
scikit-optimize (0.3)
scilab2py (0.6)
scipy (0.19.1)
scs (1.2.6)
seaborn (0.8.0)
setuptools (36.2.7)
simplegeneric (0.8.1)
simplejson (3.11.1)
sip (4.19.3)
six (1.10.0)
smmap2 (2.0.3)
snakeviz (0.4.1)
snowballstemmer (1.2.1)
sortedcontainers (1.5.7)
sounddevice (0.3.8)
Sphinx (1.6.3)
sphinx-autobuild (0.7.1)
sphinx-rtd-theme (0.2.4)
sphinxcontrib-websupport (1.0.1)
spyder (3.2.3)
spyder-notebook (0.2.0.dev0)
spyder-reports (0.1.1)
spyder-terminal (0.2.2)
SQLAlchemy (1.1.13)
sqlite-bro (0.8.11)
sqlparse (0.2.3)
statsmodels (0.8.0)
supersmoother (0.4)
sympy (1.1.1)
tables (3.4.2)
tblib (1.3.2)
tensorflow (1.2.1)
testpath (0.3.1)
Theano (0.9.0)
thriftpy (0.3.9)
toolz (0.8.2)
tornado (4.5.1)
tqdm (4.15.0)
traitlets (4.3.2)
traittypes (0.0.6)
tri.declarative (0.34.0)
tri.form (5.0.1)
tri.named-struct (0.12.0)
tri.query (4.0.0)
tri.struct (2.5.4)
tri.table (5.0.0)
twine (1.9.1)
Twisted (17.9.0)
twitter (1.17.1)
txaio (2.8.2)
typed-ast (1.0.4)
urllib3 (1.21.1)
vega (0.5.0)
ViTables (3.0.0)
watchdog (0.8.3)
wcwidth (0.1.7)
webencodings (0.5.1)
Werkzeug (0.12.2)
wheel (0.29.0)
whitenoise (3.3.1)
widgetsnbextension (2.0.0)
winpython (1.9.20170812)
wordcloud (1.3.2)
wrapt (1.10.10)
xarray (0.9.6)
xlrd (1.0.0)
XlsxWriter (0.9.8)
xlwings (0.11.4)
zarr (2.1.4)
zict (0.1.2)
zope.interface (4.4.3)


@andfoy commented on Wed Oct 04 2017

Hi @jxrossel, to start Spyder on debugging mode you must need to set the SPYDER_DEV variable, as it follows, the following commands must be executed from a system terminal, which corresponds to cmd.exe on Windows:

set SPYDER_DEV=True
spyder

After the execution, the file spyder_terminal_err.log must appear on your current working directory, which is this case must be the directory of the current terminal. Please post the contents of this file, so we can help you to trace the error.


@jxrossel commented on Thu Oct 05 2017

Hi, when starting spyder like that, I first had another error message "The Jupyter Notebook server failed to start..." and then the same message as above. The error log doesn't seem very helpful:

2017-10-05 10:15:14 ETACH-W113024 __main__[8060] INFO Server is now at: 127.0.0.1:8071
2017-10-05 10:15:14 ETACH-W113024 __main__[8060] INFO Shell: C:\Windows\system32\cmd.exe

I then tried to open a new terminal in spyder, and the error log became:

2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /?path=C:/Users/rosselj/PythonDev/satemo (127.0.0.1) 4.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/css/ubuntu.css (127.0.0.1) 133.95ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/components/xterm.js/dist/xterm.css (127.0.0.1) 6.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/components/xterm.js/dist/addons/fullscreen/fullscreen.css (127.0.0.1) 2.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/css/style.css (127.0.0.1) 3.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/components/promise-polyfill/promise.js (127.0.0.1) 6.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/components/fetch/fetch.js (127.0.0.1) 6.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/components/xterm.js/dist/addons/attach/attach.js (127.0.0.1) 5.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/components/xterm.js/dist/addons/fit/fit.js (127.0.0.1) 5.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/components/xterm.js/dist/addons/fullscreen/fullscreen.js (127.0.0.1) 4.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/components/jquery/dist/jquery.min.js (127.0.0.1) 13.99ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/js/main.js (127.0.0.1) 5.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/components/xterm.js/dist/xterm.js (127.0.0.1) 48.98ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/css/fonts/ubuntumono-regular-webfont.woff2 (127.0.0.1) 5.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 GET /static/css/fonts/ubuntumono-bold-webfont.woff2 (127.0.0.1) 4.00ms
2017-10-05 10:18:05 ETACH-W113024 __main__[8060] INFO CWD: C:/Users/rosselj/PythonDev/satemo
2017-10-05 10:18:05 ETACH-W113024 __main__[8060] INFO Size: (56, 33)
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 POST /api/terminals?cols=56&rows=33 (127.0.0.1) 105.96ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] WARNING 404 GET /favicon.ico (127.0.0.1) 26.99ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 101 GET /terminals/0f5853 (127.0.0.1) 0.00ms
2017-10-05 10:18:05 ETACH-W113024 __main__[8060] INFO WebSocket opened: 0f5853
2017-10-05 10:18:05 ETACH-W113024 __main__[8060] INFO TTY On!
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 POST /api/terminals/0f5853/size?cols=67&rows=31 (127.0.0.1) 4.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 POST /api/terminals/0f5853/size?cols=61&rows=31 (127.0.0.1) 3.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 POST /api/terminals/0f5853/size?cols=67&rows=31 (127.0.0.1) 3.00ms
2017-10-05 10:18:05 ETACH-W113024 tornado.access[8060] INFO 200 POST /api/terminals/0f5853/size?cols=61&rows=31 (127.0.0.1) 3.00ms

The prompt in the terminal doesn't respond though


@andfoy commented on Thu Oct 05 2017

@jxrossel, can you open a browser tab on the server URL, as shown on the log file? On this case, 127.0.0.1:8071? Does a terminal appears there?

Also, I invite you to open an issue on spyder-notebook if you have notebook-related issues.


@jxrossel commented on Thu Oct 05 2017

Thanks for the answer, but pywinpty v0.2.1 is the last available version on pypi and its the one I have, so I can't update it...

I've stopped doing blind upgrades (with -U) since it tends to break installations (typically when upgrading a package which depends on the upgrade of another compiled package whose compilation fails...). Usually, I do a 2-step upgrade (with -U --no-deps first, then a simple install)


@jxrossel commented on Thu Oct 05 2017

... and I've checked the 127.0.0.1:8071 in my browser after opening Spyder. Nothing is shown on that page, but the tab title "OS Web terminal" is displayed (better than nothing, I guess!)


@andfoy commented on Thu Oct 05 2017

@jxrossel Is there any message on the developer Web console?


@jxrossel commented on Thu Oct 05 2017

SCRIPT445: Object doesn't support this action
File: main.js, Line: 11, Column: 1
var promptEvent = new Event('promptReady'); 

@andfoy commented on Thu Oct 05 2017

@jxrossel Can you test if pywinpty is working as expected? Please post the output of the following commands (From a Python prompt):

from winpty import PTY

# Start a new winpty-agent process of size (cols, rows)
cols, rows = 80, 25
process = PTY(cols, rows)

# Spawn a new console process, e.g., CMD
process.spawn(r'C:\windows\system32\cmd.exe')

# Read console output (Unicode)
process.read()

@jxrossel commented on Thu Oct 05 2017

process.spawn(r'C:\windows\system32\cmd.exe') --> True

process.read()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\PortableSoftware\WinPython3-6\python-3.6.2.amd64\lib\site-packages\winpty\winpty_wrapper.py", line 55, in read
    None, None)
OSError: exception: access violation writing 0x0000000000000000

@andfoy commented on Thu Oct 05 2017

@jxrossel Finally an error! Let me check, it seems that this belongs to pywinpty rather than spyder-terminal. However, let me investigate more about it, this is the first instance of such issue.


@andfoy commented on Thu Oct 05 2017

Issue moved to spyder-ide/pywinpty #59 via ZenHub

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.