最近我使用AWSEC2来部署我的python代码。但是,它总是报告由于以下权限问题而无法读取.csv数据
Traceback (most recent call last):
File "program.py", line 381, in <module>
trcaData = np.asmatrix(pd.read_csv(datadir + "trca.csv").values)
File "/usr/local/lib64/python3.7/site-packages/pandas/io/parsers.py", line 605, in read_csv
return _read(filepath_or_buffer, kwds)
File "/usr/local/lib64/python3.7/site-packages/pandas/io/parsers.py", line 457, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
File "/usr/local/lib64/python3.7/site-packages/pandas/io/parsers.py", line 814, in __init__
self._engine = self._make_engine(self.engine)
File "/usr/local/lib64/python3.7/site-packages/pandas/io/parsers.py", line 1045, in _make_engine
return mapping[engine](self.f, **self.options) # type: ignore[call-arg]
File "/usr/local/lib64/python3.7/site-packages/pandas/io/parsers.py", line 1862, in __init__
self._open_handles(src, kwds)
File "/usr/local/lib64/python3.7/site-packages/pandas/io/parsers.py", line 1363, in _open_handles
storage_options=kwds.get("storage_options", None),
File "/usr/local/lib64/python3.7/site-packages/pandas/io/common.py", line 647, in get_handle
newline="",
PermissionError: [Errno 13] Permission denied: '/home/ec2-user/KFSGPS2/input/real/trca.csv'
我尝试在网站上使用任何可能的方法,但还是失败了。当我检查每个目录的权限时,结果看起来不错
[ec2-user@ip-XXX KFSGPS2]$ ls -ld /home/
drwxr-xr-x 3 ec2-user root 22 Oct 26 15:35 /home/
[ec2-user@ip-XXX KFSGPS2]$ ls -ld /home/ec2-user
drwx------ 7 ec2-user ec2-user 153 Feb 2 00:34 /home/ec2-user
[ec2-user@ip-XXX KFSGPS2]$ ls -ld /home/ec2-user/KFSGPS2/
drwxrwxr-x 5 ec2-user ec2-user 196 Feb 1 23:35 /home/ec2-user/KFSGPS2/
[ec2-user@ip-XXX KFSGPS2]$ ls -ld /home/ec2-user/KFSGPS2/input/
drwxrwxr-x 5 ec2-user ec2-user 51 Feb 1 22:13 /home/ec2-user/KFSGPS2/input/
[ec2-user@ip-XXX KFSGPS2]$ ls -ld /home/ec2-user/KFSGPS2/input/real/
drwxrwxr-x 2 ec2-user ec2-user 55 Feb 1 22:13 /home/ec2-user/KFSGPS2/input/real/
有什么办法可以解决这个问题吗?非常感谢
目前没有回答
相关问题 更多 >
编程相关推荐