You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a function called 'open' in napi.py, which is included in the 'all' list. That means that doing 'from nxs import *' prevents use of the standard Python open function. Of course, wildcard imports are frowned because of just this issue but, for interactive use of the tree API, they are highly desirable, and not likely to cause problems. It would be good if people are not forced to type 'nxs.NXentry' etc. and 'open' and perhaps 'load' in tree.py, are the only problems.
There are a couple of possible solutions. One is to rename 'open' to 'nxopen', or make 'nxopen = open' and add only nxopen to the all list. The other is to put 'import napi as nx' in the package init.py so that 'from nxs import *', will still require calling 'nx.open'. The latter, however, would require people to type 'nxs.nx.open' if they just did 'import nxs'.
Comments on this are welcome.
The text was updated successfully, but these errors were encountered:
Original reporter: rayosborn
There is a function called 'open' in napi.py, which is included in the 'all' list. That means that doing 'from nxs import *' prevents use of the standard Python open function. Of course, wildcard imports are frowned because of just this issue but, for interactive use of the tree API, they are highly desirable, and not likely to cause problems. It would be good if people are not forced to type 'nxs.NXentry' etc. and 'open' and perhaps 'load' in tree.py, are the only problems.
There are a couple of possible solutions. One is to rename 'open' to 'nxopen', or make 'nxopen = open' and add only nxopen to the all list. The other is to put 'import napi as nx' in the package init.py so that 'from nxs import *', will still require calling 'nx.open'. The latter, however, would require people to type 'nxs.nx.open' if they just did 'import nxs'.
Comments on this are welcome.
The text was updated successfully, but these errors were encountered: