1
votes

I have a whole project folder where Pycharm returns error whenever I try to run a file. If I run them from terminal they all work.

/usr/bin/python /Users/Casper/PycharmProjects/Mayer/Mayer5.py Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 550, in main() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 532, in main known_paths = addusersitepackages(known_paths) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 266, in addusersitepackages user_site = getusersitepackages() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 241, in getusersitepackages user_base = getuserbase() # this will also set USER_BASE File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 230, in getuserbase from sysconfig import get_config_var File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 104, in _PROJECT_BASE = os.path.dirname(_safe_realpath(sys.executable)) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 99, in _safe_realpath return realpath(path) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 375, in realpath path, ok = _joinrealpath('', filename, {}) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 400, in _joinrealpath if not islink(newpath): File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 138, in islink return stat.S_ISLNK(st.st_mode) AttributeError: 'module' object has no attribute 'S_ISLNK'

1

1 Answers

2
votes

From this post, it can be two possible reasons:

  1. Circular dependencies:

    If in the first a.py file you import b and in b.py you import a,then you might see this happen. Python will decide by itself which module will be load first.

  2. Module named in your .py is the same as one in Python standard files:

    In this case you have to change your module name.

You need to provide more info about your codes so we can figure out which one is the root cause.