Giter Club home page Giter Club logo

Comments (2)

xanthospap avatar xanthospap commented on September 26, 2024

Tried to fix this via computing all quantities with bc, but that is probably not an option. Python does complicated manipulations (like print(round(${T},-1)+10)); this is not possible with bc (at least not in less than a few lines).

from straintool.

xanthospap avatar xanthospap commented on September 26, 2024

Trying a new approach:

  1. add a function in the script, to resolve system's python version (resolve_py_version())
  2. make a function alias to python; this is called pythonc. If the system Python version is 3.x.x, then
    this function just collapses to alias pythonc="python -c". Else, if the version is 2.x.x, then the alias is
    python -c "from __future__ import print_function;.

Hence, now

  1. When calling Python's print in the script, always use Python 3.x.x syntax
  2. Instead of writing
python -c "print int((${south} + ${north})/2)"

we write

pythonc "print(int((${south} + ${north})/2))"

remember that is python 3.x print is a function, hence it must have parenthesis, print 5 is invalid, print(5) is ok!
Also, never use the piped version, aka echo print ${south} + ${tmp_scrate} | python

from straintool.

Related Issues (20)

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.