-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python3 compatibility #18
Comments
Not sure how it was closed, I did not intend to do that. Sorry. |
I've just tested v1.1.1 and definitely works on Splunk 8.0.5 |
Thank you for attempting to test. Was your test system configured for Python3? I apologize if I should have included this information up front. Splunk included the Python3 libraries in version 8, but they did not yet make Python3 the default (though that will come in some future release). To change the default version of Splunk, you must add the 'python.version' attribute to the server.conf:
To prevent overriding this at the app level, you can force it:
You can override
If you add |
I'm sure everyone knows this too, but this is the document that explains how to control the python version: |
I thought I might mention another way to reproduce the error. If you have command-line access to Splunk, you can also run the script with python2 or python3: |
Thanks very much @s-m-p. I mistakenly thought that Splunk 8.0 used Python 3 as the default and so my tests were invalid. Although the app works fine in Splunk 8.0 by default, I've now removed the Splunk 8.0 compatibility on Splunkbase for this app so it cannot be misconstrued as working with Python 3. I will endeavour to make both this and my other apps using Python compatible with version 3 in the near future. |
You're most welcome. Thank you very much for developing, sharing and supporting the TA! And I'm happy to see my first Github interaction was a positive contribution.
This answered another question I have been asking myself - how in the world did this TA get marked as compatible with 8.0? It sounds like this is a flag that you can set when you publish the app to Splunkbase. So I'm happy to hear you plan to remove that flag because it definitely confused me. I'll be happy to give your updated TA a test if you need a beta tester! |
The changes in pull request #19 make it work in both, python2 and python3 environments. |
Thanks for the work on that. |
I wanted to bring awareness that v1.1.1 of the TA doesn't seem to run with Python3 on Splunk version 8.0.5. I'm not a programmer, but it appears there's an incompatibilty in one of the libraries.
> splunk cmd python3 asngen.py
Traceback (most recent call last):
File "asngen.py", line 3, in
from splunklib.searchcommands import dispatch, GeneratingCommand, Configuration, Option, validators
File "/opt/splunk/etc/apps/TA-asngen/bin/splunklib/searchcommands/init.py", line 145, in
from .environment import *
File "/opt/splunk/etc/apps/TA-asngen/bin/splunklib/searchcommands/environment.py", line 21, in
from os import chdir, environ, getcwdu, path
ImportError: cannot import name 'getcwdu' from 'os' (/opt/splunk/lib/python3.7/os.py)
The text was updated successfully, but these errors were encountered: