[Geany-Users] Run Error

Stephen P. Molnar s.molnar at xxxxx
Wed Nov 22 15:53:52 UTC 2017


On 11/22/2017 10:13 AM, Matthew Brush wrote:
> On 2017-11-22 06:29 AM, Stephen P. Molnar wrote:
>> I am running Geny v-1.31 from Debian Stretch on my Linux platform.
>>
>> FOr unknown reasons I have started getting error messages from a 
>> Python 3..5 script I wrote to plot multiple curves frlom data 
>> generated by a FORTRAN09 program.
>>
>> Enter Molecule ID: A
>> Traceback (most recent call last):
>>    File "MolT_5IMT_w_3_2_plot.py", line 83, in <module>
>>      fig.savefig(name_plt,bbox_inches='tight')
>>    File 
>> "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 
>> 1814, in savefig
>>      self.canvas.print_figure(fname, **kwargs)
>>    File 
>> "/usr/local/lib/python3.5/dist-packages/matplotlib/backend_bases.py", 
>> line 2180, in print_figure
>>      self.figure.dpi = dpi
>>    File 
>> "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 
>> 436, in _set_dpi
>>      self.set_size_inches(w, h, forward=forward)
>>    File 
>> "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 
>> 745, in set_size_inches
>>      manager.resize(int(canvasw), int(canvash))
>>    File 
>> "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_tkagg.py", 
>> line 540, in resize
>>      self.canvas._tkcanvas.master.geometry("%dx%d" % (width, height))
>>    File "/usr/lib/python3.5/tkinter/__init__.py", line 1698, in 
>> wm_geometry
>>      return self.tk.call('wm', 'geometry', self._w, newGeometry)
>> _tkinter.TclError: can't invoke "wm" command: application has been 
>> destroyed
>>
>>
>> ------------------
>> (program exited with code: 1)
>> Press return to continue
>>
>> Unfortunately, I am an Organic Chemist and not really a Python 
>> programmer and wpuld really appreciate some help in solving this 
>> problem.
>>
>
> It's not a Geany related problem, it's something with your code, but 
> it's hard to say what since you didn't attach/pastebin the code. I 
> expect based on the error message that you are calling the 'wm' 
> command after (or before) the tk main window has been created.
>
> Regards,
> Matthew Brush
> _______________________________________________
> Users mailing list
> Users at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/users
Here's the code:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Multiple_Plots_3.py

Copyright (c) 2017 Stephen P. Molnar, Ph.D.  All rights reserved.

"""
import numpy as np
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
import matplotlib.pyplot as plt

data = []
name = input("Enter Molecule ID: ")

name_in = name+'_P'
data = np.genfromtxt(name_in)

s = data[:,0]
FTm = data[:,1]     #atomic number
FTe = data[:,2]     #atomic mass
FTc = data[:,3]     #atom electron density


fig = plt.figure(figsize=(7.6,4))

host = host_subplot(111, axes_class=AA.Axes)
plt.subplots_adjust(right=0.75)

par1 = host.twinx()
par2 = host.twinx()

offset = 60
new_fixed_axis = par2.get_grid_helper().new_fixed_axis
par2.axis["right"] = new_fixed_axis(loc="right", 
axes=par2,offset=(offset, 0))

par2.axis["right"].toggle(all=True)

host.set_xlim(0, 30)

host.set_ylim(min(FTm), max(FTm))



host.set_xlabel("Distance ($\AA$)")
host.set_ylabel("Atomic Number")
par1.set_ylabel("Atom Mass")
par2.set_ylabel("Atom Electron Density")

p1, = host.plot(data[:,0], data[:,1])#, label="Atomic Number")
p2, = par1.plot(data[:,0], data[:,2])#, label="Atom Mass")
p3, = par2.plot(data[:,0], data[:,3])#, label="Atom Electron Density")


par1.set_ylim(min(FTe), max(FTe))
par2.set_ylim(min(FTc),max(FTc))


#host.legend()

host.axis["left"].label.set_color(p1.get_color())
par1.axis["right"].label.set_color(p2.get_color())
par2.axis["right"].label.set_color(p3.get_color())

host.title.set_text('Molecule: {0} - Molecular Transforms'.format(name))
plt.draw()
plt.show()

#name_plt = name+'-fig1.png'
name_plt = name

fig.savefig(name_plt,bbox_inches='tight')


Also attached with a copy of the input file.  (I don't know if it will 
be stripped out or not)

-- 
Stephen P. Molnar, Ph.D.		Life is a fuzzy set
www.molecular-modeling.net		Stochastic and multivariate
(614)312-7528 (c)
Skype: smolnar1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: MultiplePlots_3.py
Type: application/x-chimera
Size: 1662 bytes
Desc: not available
URL: <https://lists.geany.org/pipermail/users/attachments/20171122/1d89e7a3/attachment-0001.bin>
-------------- next part --------------
       0.150000      6327.754955      3100.115315        -0.273330
       0.300000      4974.437669      2423.580149        -0.260019
       0.450000      3413.782497      1649.373697        -0.226646
       0.600000      2147.367854      1028.342687        -0.187167
       0.750000      1326.194478       631.151522        -0.155853
       0.900000       835.901348       396.527070        -0.130189
       1.050000       521.917162       247.005495        -0.110868
       1.200000       308.563248       146.262688        -0.108866
       1.350000       172.485314        83.007579        -0.117236
       1.500000        88.213222        44.070414        -0.109013
       1.650000        25.187526        14.387829        -0.079685
       1.800000       -30.012126       -12.017755        -0.058445
       1.950000       -73.172867       -32.769861        -0.061001
       2.100000      -100.304912       -46.043693        -0.065431
       2.250000      -114.697667       -53.435231        -0.052830
       2.400000      -118.104612       -55.560292        -0.038336
       2.550000      -105.332340       -49.810498        -0.039741
       2.700000       -72.819694       -34.544098        -0.043812
       2.850000       -29.772303       -14.130725        -0.028663
       3.000000         3.669097         1.958608         0.000127
       3.150000        10.821068         5.743063         0.018845
       3.300000        -9.406689        -3.527196         0.018620
       3.450000       -44.287195       -19.931307         0.009597
       3.600000       -79.307082       -36.490689         0.000075
       3.750000      -107.430024       -49.799698        -0.010608
       3.900000      -128.600825       -59.914690        -0.020417
       4.050000      -144.310370       -67.596568        -0.020784
       4.200000      -154.473618       -72.746020        -0.007487
       4.350000      -156.801724       -74.327306         0.014513
       4.500000      -145.529868       -69.862430         0.040273
       4.650000      -111.628677       -55.172712         0.069287
       4.800000       -49.329108       -27.083311         0.095657
       4.950000        33.974228        11.675601         0.104490
       5.100000       115.624909        50.767958         0.088677
       5.250000       169.634729        77.469455         0.062759
       5.400000       184.134126        85.309308         0.048441
       5.550000       168.365558        78.213371         0.049341
       5.700000       142.462227        66.035119         0.050230
       5.850000       120.122121        55.845745         0.038752
       6.000000       100.959347        47.584818         0.017725
       6.150000        78.068211        37.601525        -0.003554
       6.300000        49.546989        24.680503        -0.020955
       6.450000        20.338783        11.214185        -0.036078
       6.600000        -4.973480        -0.490625        -0.050551
       6.750000       -26.657600       -10.599693        -0.063097
       6.900000       -46.296335       -19.922785        -0.071311
       7.050000       -62.299471       -27.613691        -0.074071
       7.200000       -71.240399       -31.945776        -0.070439
       7.350000       -71.808940       -32.341336        -0.058019
       7.500000       -65.448941       -29.553877        -0.037231
       7.650000       -54.643174       -24.704324        -0.016727
       7.800000       -42.913074       -19.363088        -0.007710
       7.950000       -35.328067       -15.930235        -0.011434
       8.100000       -35.458669       -16.164385        -0.018448
       8.250000       -40.401904       -18.741903        -0.020262
       8.400000       -40.745042       -19.244242        -0.014666
       8.550000       -27.974353       -13.662551        -0.001372
       8.700000        -2.863683        -2.276877         0.017217
       8.850000        23.696028         9.976958         0.031326
       9.000000        38.626008        17.096202         0.030962
       9.150000        36.204816        16.344192         0.018633
       9.300000        21.199622         9.765159         0.005714
       9.450000         4.069540         2.110755        -0.003015
       9.600000        -6.374190        -2.538721        -0.011267
       9.750000        -6.625953        -2.586622        -0.018944
       9.900000         2.661412         1.576005        -0.018723
      10.050000        18.894748         8.728285        -0.005723
      10.200000        37.863606        17.046237         0.017523
      10.350000        53.624148        23.922523         0.045255
      10.500000        60.650742        26.835886         0.070305
      10.650000        57.132205        24.958896         0.083126
      10.800000        45.572121        19.552385         0.077380
      10.950000        29.988599        12.568715         0.057617
      11.100000        13.370460         5.302119         0.035906
      11.250000        -2.114252        -1.449096         0.019921
      11.400000       -14.200821        -6.726981         0.008092
      11.550000       -21.547910        -9.835122        -0.003799
      11.700000       -25.523446       -11.349474        -0.015778
      11.850000       -29.752867       -13.033826        -0.025015
      12.000000       -37.166437       -16.367986        -0.030877
      12.150000       -47.338426       -21.149641        -0.035894
      12.300000       -56.638240       -25.558702        -0.042134
      12.450000       -61.097138       -27.633344        -0.048430
      12.600000       -59.396782       -26.770483        -0.051793
      12.750000       -52.910680       -23.698755        -0.050786
      12.900000       -42.543465       -18.884260        -0.046567
      13.050000       -26.282824       -11.367918        -0.040237
      13.200000        -1.514840         0.060188        -0.029895
      13.350000        29.524730        14.284532        -0.012628
      13.500000        57.749622        27.043745         0.009173
      13.650000        72.376011        33.427053         0.026128
      13.800000        68.915978        31.514267         0.030275
      13.950000        52.218641        23.634943         0.023697
      14.100000        31.913359        14.222284         0.014524
      14.250000        15.178397         6.546906         0.006518
      14.400000         3.537427         1.281334        -0.001095
      14.550000        -4.597508        -2.343386        -0.005548
      14.700000        -9.672662        -4.554489        -0.001795
      14.850000        -9.847040        -4.456990         0.007086
      15.000000        -3.606245        -1.290817         0.010269
      15.150000         7.366895         4.095904         0.003510
      15.300000        18.359367         9.300748        -0.004420
      15.450000        24.450980        11.878501        -0.003318
      15.600000        23.166159        10.764650         0.006777
      15.750000        15.279702         6.571164         0.018890
      15.900000         4.176673         1.054503         0.028072
      16.050000        -5.754333        -3.712654         0.032853
      16.200000       -11.647544        -6.418179         0.032227
      16.350000       -14.191268        -7.406286         0.025950
      16.500000       -16.833102        -8.360068         0.016350
      16.650000       -22.483656       -10.757035         0.006952
      16.800000       -31.247001       -14.716277        -0.000342
      16.950000       -41.143177       -19.304410        -0.005554
      17.100000       -49.597601       -23.281461        -0.008894
      17.250000       -53.576330       -25.177034        -0.010143
      17.400000       -50.075276       -23.508521        -0.009875
      17.550000       -38.593348       -18.003749        -0.010012
      17.700000       -22.601617       -10.353745        -0.011983
      17.850000        -6.576618        -2.746393        -0.014897
      18.000000         8.479315         4.353553        -0.016710
      18.150000        24.733835        12.025132        -0.016562
      18.300000        42.327047        20.321677        -0.014630
      18.450000        56.451775        26.906925        -0.011014
      18.600000        61.233163        29.018249        -0.006781
      18.750000        55.807780        26.365211        -0.004465
      18.900000        45.107989        21.364930        -0.004918
      19.050000        34.689147        16.589420        -0.005364
      19.200000        25.921443        12.551389        -0.003479
      19.350000        16.493394         8.077024        -0.001408
      19.500000         4.488899         2.283582        -0.002338
      19.650000        -8.969264        -4.229907        -0.004932
      19.800000       -20.569049        -9.849067        -0.004959
      19.950000       -27.112471       -13.030244        -0.001249
      20.100000       -26.916336       -12.937298         0.003361
      20.250000       -20.251808        -9.675987         0.006179
      20.400000        -9.604365        -4.467667         0.006926
      20.550000         0.720591         0.555271         0.006462
      20.700000         6.505781         3.337091         0.005622
      20.850000         6.114467         3.119483         0.005208
      21.000000         1.222629         0.738566         0.005662
      21.150000        -5.131565        -2.350422         0.006599
      21.300000       -11.235737        -5.327516         0.007040
      21.450000       -17.339878        -8.279982         0.005966
      21.600000       -23.729630       -11.324398         0.002997
      21.750000       -28.626672       -13.659816        -0.000632
      21.900000       -28.680338       -13.764779        -0.002120
      22.050000       -22.117762       -10.800936         0.000525
      22.200000       -11.450973        -5.880999         0.005831
      22.350000        -2.434399        -1.660014         0.009599
      22.500000         0.459473        -0.259807         0.008981
      22.650000        -2.129396        -1.429481         0.005352
      22.800000        -5.115985        -2.807290         0.002484
      22.950000        -3.292882        -1.948856         0.002330
      23.100000         5.007607         1.950969         0.003651
      23.250000        17.579391         7.912061         0.004531
      23.400000        30.207087        14.000963         0.004652
      23.550000        38.722806        18.219516         0.004611
      23.700000        40.794191        19.373156         0.004346
      23.850000        37.058491        17.735916         0.002986
      24.000000        30.240818        14.665050        -0.000394
      24.150000        22.436655        11.182298        -0.005885
      24.300000        13.574654         7.167770        -0.011996
      24.450000         3.065692         2.256847        -0.016580
      24.600000        -7.791281        -2.904608        -0.019300
      24.750000       -16.244875        -6.947933        -0.021406
      24.900000       -20.749536        -9.174221        -0.021927
      25.050000       -22.057617       -10.023033        -0.017125
      25.200000       -21.568013       -10.133384        -0.006334
      25.350000       -19.750130        -9.577402         0.004712
      25.500000       -16.754119        -8.288748         0.009774
      25.650000       -13.604369        -6.731196         0.008721
      25.800000       -11.656015        -5.614245         0.005151
      25.950000       -11.001480        -5.073846         0.000739
      26.100000       -10.282566        -4.561067        -0.004057
      26.250000        -8.296693        -3.588559        -0.006673
      26.400000        -5.189922        -2.251948        -0.004632
      26.550000        -1.727895        -0.854245         0.000352
      26.700000         2.028706         0.685819         0.004098
      26.850000         6.489376         2.645891         0.004808
      27.000000        10.954297         4.708210         0.003759
      27.150000        13.138766         5.756019         0.002601
      27.300000        11.093002         4.833243         0.002143
      27.450000         5.563610         2.289215         0.002675
      27.600000        -0.161042        -0.312714         0.003925
      27.750000        -3.003983        -1.540918         0.005501
      27.900000        -2.346809        -1.172957         0.007876
      28.050000         0.544982         0.131601         0.011559
      28.200000         4.494502         1.843007         0.015208
      28.350000         8.922375         3.795633         0.016481
      28.500000        12.811781         5.592202         0.015134
      28.650000        14.574869         6.468851         0.013364
      28.800000        13.538042         6.054919         0.012412
      28.950000        10.735519         4.836526         0.010669
      29.100000         7.537223         3.491677         0.006242
      29.250000         4.081950         2.073071        -0.000039
      29.400000        -0.172450         0.266344        -0.005676
      29.550000        -4.851138        -1.785885        -0.009750
      29.700000        -8.677985        -3.469866        -0.013504
      29.850000       -11.104449        -4.520310        -0.017883
      30.000000       -13.041988        -5.396163        -0.021951
      30.150000       -15.620583        -6.661243        -0.023897


More information about the Users mailing list