Skip to content

Getting WISECONDOR to work

Roy Straver edited this page Nov 22, 2013 · 4 revisions

I'm getting this Tk-something error:

Plotting Z-Scores
Traceback (most recent call last):
File "test.py", line 562, in
plotResults(sample,markedBins,kept,kept2,outputBase,zScoresDict,zSmoothDict,blindsDict)
File "test.py", line 344, in plotResults
ax = plt.figure(2)
File "/usr/lib/pymodules/python2.6/matplotlib/pyplot.py", line 254, in figure
**kwargs)

File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_tkagg.py", line 90, in new_figure_manager
window = Tk.Tk()
File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 1646, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

This appears to show up on computers that do not have the Tcl/Tk toolkit installed, which is often the case on compute nodes (headless servers). An easy fix for this is to tell matplotlib to use another backend for its graphical work:

  • Open test.py
  • Find the list of imports, somewhere about line 25 to 35
  • Add these lines to the list:
    import matplotlib
    matplotlib.use('Agg')

As the plots seem to differ slightly using this back-end I preferred not to make it the default until everything is tested to work correctly using this. This fix was suggested by W.Y.Leung, thank you!

I specified an output, the script runs without errors but there is nothing in the output directory

When specifiying the output for test.py, it assumes you provide it a path including a filename without an extension. The plots will take this path/file combination, add a dot, and add the plot type and pdf extension to it. As a result, providing a path such as ./output/ will result in output files such as ./output/.zscores.pdf, which, in unix systems, end up being hidden because they start with a dot. Simply add a basic file name to the output path such as ./output/filename and your files will show up. If you really need to see what hidden files you created, try pressing ctrl-h in a file browser to show hidden files.

I get a nice text output in my terminal but I want to save this to a file instead

The script was written rather rapidly and this never really seemed a problem to me. If you want to save this text output, the usual Unix approach (directing the output to a file) should suffice: python test.py ./input.gcc ./output ./reference > ./output.txt