zhuminjie / OpenSeesPyDoc

OpenSeesPy Documentation
http://openseespydoc.readthedocs.io
Other
141 stars 105 forks source link

Import Style Issues in the Examples #212

Closed bariserkus closed 3 years ago

bariserkus commented 3 years ago

I was testing some of the examples and I am having issue with the current format of the OpenSees import which is

from openseespy.opensees import *

which is then used in the example like this:

op.wipe()

This gives an error on my Win10 Anaconda/Spyder system or on my Jupyter notebook. I am not sure about the earlier Python versions though.

I have tried the following, which I have been using for my other Python codes:

from openseespy import opensees as op

and the error is gone.

If the second import style is acceptable for "general use", I can maybe fix all the examples and request a pull from you.

bariserkus commented 3 years ago

I have also observed that some examples are not using the op.*function* format. Maybe these can all be fixed?

u-anurag commented 3 years ago

Both import styles are acceptable. When using 'from openseespy.opensees import *' the wipe command should be 'wipe()'. It needs to be consistent with the way you import the library. Which example are you talking about? If you want, you can fix that 'op.wipe()' from that example in a pull request instead of changing everything.

bariserkus commented 3 years ago

I am testing randomly from the examples. The issue above was with pile.py. But I also observe similar issues in other examples. For example RCFrameEarthquake.py had the opposite problem. The import statement is

from openseespy import opensees as op

but the functions are called without the op. part; hence did not work. It worked after I added the op.s to the relevant functions.

It maybe a good idea to review these examples and fixed them as necessary so that first-timers will not frustrate fast.

zhuminjie commented 3 years ago

Like @u-anurag said, it should just need a PR for correct import