2013-08-12 8 views
5

python JIRAClient.pyとしてプログラムを実行すると、すべて正常に動作します。しかし、私は#!/usr/bin/env pythonを追加し、それが実行権限を与えることで、プログラムを実行可能にし、私はプログラムを実行しようとすると、私は./JIRAClient.pypython:プログラムを実行可能にした後のインポートエラー

from: can't read /var/mail/jira.client 
Version: ImageMagick 6.8.6-3 2013-07-06 Q16 http://www.imagemagick.org 
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC 
Features: DPC Modules 
Delegates: bzlib freetype jng jpeg png xml zlib 

Usage: import [options ...] [ file ] 
Image Settings: 
...... 
Image Operators: 
...... 
Miscellaneous Options: 
...... 
By default, 'file' is written in the MIFF image format. To 
specify a particular image format, precede the filename with an image 
format name and a colon (i.e. ps:image) or specify the image type as 
the filename suffix (i.e. image.ps). Specify 'file' as '-' for 
standard input or output. 
import: delegate library support not built-in `' (X11) @ error/import.c/ImportImageCommand/1298. 
./JIRAClient.py: line 4: config_ini: command not found 
./JIRAClient.py: line 5: syntax error near unexpected token `(' 
./JIRAClient.py: line 5: `config = ConfigParser.ConfigParser()' 

として、いくつかのエラーを取得した後、このエラーは何を意味するのでしょうか?そして、プログラムを実行するこれら2つの方法の違いは何ですか?

from jira.client import JIRA 
import ConfigParser 

config_ini = 'config.ini' 
config = ConfigParser.ConfigParser() 
dataset = config.read(config_ini) 

答えて

8

あなたのプログラムはbashのスクリプトのように実行しようとしているので、それはそう、あなたの#!/usr/bin/env pythonは効果がなかった:エラーを生成するコードの

行は以下の通りです。この行は、最初の行のプログラムの先頭に文字がないことを確認してください。#

+0

はい、間違いなく '#'の前にスペースを追加します。今それは動作します。 – Cacheing

関連する問題