【问题标题】:How to correctly supply argument to the following Python script如何正确地为以下 Python 脚本提供参数
【发布时间】:2016-09-18 06:23:44
【问题描述】:

我是 Python 新手,非常想通过以下 Python 脚本运行一些文件。

https://github.com/ashutoshkpandey/Variants_call/blob/master/Filter_Pindel_del_vcf.py

我在 Linux 服务器上运行并安装了 Python。我将脚本保存在包含两个必需文件(Del.vcf 和 Output_D)的目录中。这是我在命令行上输入的内容,但由于某种原因脚本找不到文件。

$ python Filter_Pindel_del_vcf.py Del.vcf, Output_D, Outputfile

Traceback (most recent call last):
  File "Filter_Pindel_del_vcf.py", line 45, in <module>
    for row in fileinput.input([Filepath]):
  File "/usr/lib64/python2.7/fileinput.py", line 253, in next
    line = self.readline()
  File "/usr/lib64/python2.7/fileinput.py", line 345, in readline
    self._file = open(self._filename, self._mode)
IOError: [Errno 2] No such file or directory: 'Del.vcf,'

【问题讨论】:

    标签: python linux command-line arguments


    【解决方案1】:

    此脚本使用位置参数。去掉逗号就可以了:

    $ python Filter_Pindel_del_vcf.py Del.vcf Output_D Outputfile
    

    【讨论】:

      【解决方案2】:

      只需删除逗号:

      python Filter_Pindel_del_vcf.py Del.vcf Output_D Outputfile
      

      【讨论】:

        猜你喜欢
        • 2013-08-22
        • 2018-10-27
        • 2017-05-01
        • 1970-01-01
        • 2021-12-31
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-03-26
        相关资源
        最近更新 更多