splunk-sdk-python icon indicating copy to clipboard operation
splunk-sdk-python copied to clipboard

issue while installing sdk

Open splunk47 opened this issue 11 years ago • 9 comments

File "setup.py", line 135 with closing(tarfile.open(os.path.join("build", app + ".spl"), "w")) as spl: ^ SyntaxError: invalid syntax

kinldy help

splunk47 avatar Jan 29 '15 06:01 splunk47

What version of Python are you using?

itay avatar Jan 29 '15 06:01 itay

I am doing testing where splunk 6.1 is installed so python comes with splunk is 2.7.5

splunk47 avatar Jan 29 '15 06:01 splunk47

Can you share your full command line invocation?

itay avatar Jan 29 '15 06:01 itay

$SPLUNK_HOME/bin/python --version this shows 2.7.5 for installing i am using this command python setup.py install and in .bash_profile we have given the path like PYTHONPATH=/home/splunk/ET_Deployment/splunk-sdk-python

splunk47 avatar Jan 29 '15 06:01 splunk47

So if you do:

$SPLUNK_HOME/bin/splunk cmd python setup.py install

Do you still get the error?

For reference, the error you're getting is that Python is not recognizing the with statement. That was added in Python 2.5, which is what is leading me to believe this is a Python version issue.

itay avatar Jan 29 '15 07:01 itay

[splunk@nllipidcn37110 splunk-sdk-python]$ $SPLUNK_HOME/bin/splunk cmd python setup.py install usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help

error: invalid command 'install'

splunk47 avatar Jan 29 '15 08:01 splunk47

If you do:

$SPLUNK_HOME/bin/splunk cmd python setup.py --help

what do you get?

itay avatar Jan 29 '15 17:01 itay

Common commands: (see '--help-commands' for more)

setup.py build will build the package underneath 'build/' setup.py install will install the package

Global options: --verbose (-v) run verbosely (default) --quiet (-q) run quietly (turns verbosity off) --dry-run (-n) don't actually do anything --help (-h) show detailed help message --no-user-cfg ignore pydistutils.cfg in your home directory --command-packages list of packages that provide distutils commands

Information display options (just display information, ignore any commands) --help-commands list all available commands --name print package name --version (-V) print package version --fullname print - --author print the author's name --author-email print the author's email address --maintainer print the maintainer's name --maintainer-email print the maintainer's email address --contact print the maintainer's name if known, else the author's --contact-email print the maintainer's email address if known, else the author's --url print the URL for this package --license print the license of the package --licence alias for --license --description print the package description --long-description print the long package description --platforms print the list of platforms --classifiers print the list of classifiers --keywords print the list of keywords --provides print the list of packages/modules provided --requires print the list of packages/modules required --obsoletes print the list of packages/modules made obsolete

usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help

splunk47 avatar Jan 30 '15 05:01 splunk47

Hi @splunk47 sorry about the delay on this. I was able to help someone with this a couple of weeks ago.

If you want to install from the pypi remote servers:

sudo pip install --ignore-installed --target="$SPLUNK_HOME/lib/python2.7/site-packages" splunk-sdk

If you want to install from a local directory (ie: after a git clone):

sudo pip install --ignore-installed --target="$SPLUNK_HOME/lib/python2.7/site-packages" /an/absolute/path/to/splunk-sdk-python

shakeelmohamed avatar May 28 '15 01:05 shakeelmohamed