hashpy icon indicating copy to clipboard operation
hashpy copied to clipboard

changes made to obspyIO.py and focalmechplotter.py for string equiva…

Open iceseismic opened this issue 10 years ago • 2 comments

Hi Mark, For some reason in order to get my hashpy to work I had to change the string equivalence checks inside obspyIO.py and focalmechplotter.py ; from "is" to "==" in 3 or 4 places. I'm running under python2.7 myself

iceseismic avatar Oct 31 '15 22:10 iceseismic

Feels like this might stem from obspy using future for simultaneous Python2+3 compatibility. Anyway, string values should be compared using == rather than with is, I think.

megies avatar Oct 31 '15 22:10 megies

For the case of comparing literals (int, string, etc) w/ variable value bindings, I'm not 100% sure what the difference is in the compiler (object id vs value equiv), but @megies is right, we are after value equiv, and if those strings ever get abstracted out as variables, this would break. Which is probably what future is doing under the hood? This was done in obspy 0.7 or 0.8, before the 2to3, so that's probably the culprit. For the record, our current production is on Ubuntu 14.04.2:

  • python: 2.7.6
  • obspy: 0.9.2
  • hashpy: v0.7.2-3-ga6e9

Anyhoo, thanks! Either pull this into dev, or I'm waiting until I merge dev into master....

markcwill avatar Jan 14 '16 22:01 markcwill