我正在将一组zli文件从一个文件夹复制到另一个文件夹。现在我需要解压缩该文件夹中的每个文件。我使用Pycharm从Windows运行python,文件夹在Linux服务器上。如何才能到达当前文件夹并解压缩每个文件?在
from __future__ import with_statement
from fabric.api import *
import ConfigParser, paramiko, shutil, os, glob, zlib
def get_Connection():
config = ConfigParser.RawConfigParser()
config.read('config.cfg')
env.user = config.get('UK_CDN','db.user_name' )
env.password = config.get('UK_CDN','db.password' )
host = config.get('UK_CDN','db.ip' )
with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, host_string=host):
paramiko.util.log_to_file('ENC_Analysis.log')
files = run('ls -ltr /home/ndsuser/enc/data/dbSchema_1/catalogue_24802')
run('rm -rf /usr/rosh/ENC_Analysis/*')
run('cp /home/ndsuser/enc/data/dbSchema_1/catalogue_24802/* /usr/rosh/ENC_Analysis/')
count = run('ls -l /usr/rosh/ENC_Analysis/ | wc -l')
os.chdir('/usr/rosh/ENC_Analysis/')
for file in os.listdir('/usr/rosh/ENC_Analysis/'):
print file
如果我运行这个代码,我会得到如下问题。在
^{pr2}$我知道这个问题是因为系统无法在Windows机器中找到路径。如何从Windows机器访问Linux服务器中的路径?在
可以将PyCharm设置为自动将python脚本复制到远程服务器并在那里运行。PyCharm文档位于https://www.jetbrains.com/pycharm/help/configuring-remote-interpreters-via-ssh.html
因为您已经导入了paramiko,所以您还可以通过ssh会话将所有相关命令发送到linux服务器,同时在本地运行脚本。这看起来有点尴尬,但仍然有效。在
等等。在
相关问题 更多 >
编程相关推荐