biggles-plot / biggles

simple, elegant python plotting
http://biggles-plot.github.io
GNU General Public License v2.0
19 stars 4 forks source link

show() cannot find xdpyinfo in python3 on Mac OS-X / Quartz installation #135

Open graik opened 6 years ago

graik commented 6 years ago

biggles 1.7.2 installed via pip in python 3.7 on Max OS-X 10.11.6; plotutils etc dependencies are all satisfied. Standard Quartz installation for X11.

The following test snippet fails in python 3.7 but works in python 2.x:

    import biggles, numpy
    x = numpy.arange(0,10,0.3)
    p = biggles.FramedPlot()
    p.add( biggles.Curve(x, numpy.cos(x)) )
    p.show()

Error:

>>> p.show()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/biggles/biggles.py", line 2527, in show
    self.show_x11(width, height)
  File "/usr/local/lib/python3.7/site-packages/biggles/biggles.py", line 2544, in show_x11
    if not X11_is_running():
  File "/usr/local/lib/python3.7/site-packages/biggles/biggles.py", line 43, in X11_is_running
    p = Popen(["xdpyinfo"], stdout=PIPE, stderr=PIPE)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 756, in __init__
    restore_signals, start_new_session)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1499, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'xdpyinfo': 'xdpyinfo'

Work around:

xdpyinfo does in fact exist on this system but it is not found in the $PATH::

~> locate xdpyinfo
/opt/X11/bin/xdpyinfo

Adding /opt/X11/bin to PATH solves the issue, at least temporarily:

export PATH=$PATH:/opt/X11/bin

Now, the same code executes, Quartz is started and the plot window is shown.

esheldon commented 6 years ago

thanks for the report.

I don't have a macintosh, can one of the other developers please verify this and put in a fix?