8

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)
isherwood
  • 58,414
  • 16
  • 114
  • 157
Cacheing
  • 3,431
  • 20
  • 46
  • 65

1 Answers1

16

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 #

mingaleg
  • 2,017
  • 16
  • 28
  • Yes, you are right, I accidentally add a space before `#`. Now it works. – Cacheing Aug 13 '13 at 00:02
  • Ha, same thing happened to me. Python's `import` statement gets treated as ImageMagick's `import` executable. – JW. Mar 15 '22 at 15:24