简体   繁体   中英

python: import error after making program executable

When I run the program as python JIRAClient.py , everything works fine. But after I make the program executable by adding #!/usr/bin/env python and giving it execute permission, I get some error when I try to run the program as ./JIRAClient.py

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()'

What does this error mean? And what is the difference between these two methods of running the program?

The lines of code that produce error are as following:

from jira.client import JIRA
import ConfigParser

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

Your program is trying to run like a bash-script, so it seems, your #!/usr/bin/env python had no effect. Make sure that this line is at the top of the program in the first row with no characters before #

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM