Skip to content

Commit 7965b65

Browse files
author
Frederick Ross
committed
Fix paths in examples so they'll run straightforwardly.
1 parent b8ca8ac commit 7965b65

34 files changed

+68
-61
lines changed

examples/analytics/bottle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
from tempfile import TemporaryFile
4242
from traceback import format_exc
4343
from urllib import urlencode, quote as urlquote, unquote as urlunquote
44-
from urlparse import urlunsplit, urljoin, SplitResult as UrlSplitResult
44+
from urlparse import urljoin, SplitResult as UrlSplitResult
4545

4646
try: from collections import MutableMapping as DictMixin
4747
except ImportError: # pragma: no cover

examples/analytics/input.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
# License for the specific language governing permissions and limitations
1515
# under the License.
1616

17-
import urllib2, sys
17+
import sys, os
18+
sys.path.insert(0, os.path.join(__file__, "../.."))
1819
from datetime import datetime
1920
import splunklib.client as client
2021

examples/analytics/output.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
# License for the specific language governing permissions and limitations
1515
# under the License.
1616

17-
import urllib2, sys
17+
import sys, os
18+
sys.path.insert(0, os.path.join(__file__, "../.."))
1819
import splunklib.client as client
1920
import splunklib.results as results
2021
try:

examples/analytics/server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
# License for the specific language governing permissions and limitations
1515
# under the License.
1616

17-
import sys, json
17+
import sys, os
18+
sys.path.insert(0, os.path.join(__file__, "../.."))
1819

1920
from bottle import route, run, debug, template, static_file, request
2021

examples/async/async.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@
2020

2121
#### Main Code
2222

23-
import sys, datetime
23+
import sys, os, datetime
2424
import urllib
25-
from time import sleep
26-
sys.path.insert(0, '../')
25+
sys.path.insert(0, os.path.join(__file__, "../.."))
2726

2827
import splunklib.binding as binding
2928
import splunklib.client as client

examples/binding1.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
binds to a sampling of endpoints showing how to access collections,
2020
entities and 'method-like' endpoints."""
2121

22-
import sys
23-
sys.path.insert(0, '../')
22+
import sys, os
23+
sys.path.insert(0, os.path.join(__file__, "../"))
2424

2525
from splunklib.binding import connect
2626

examples/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
"""Create, delete or list stanza information from/to Splunk confs."""
1818

19-
import sys
20-
sys.path.insert(0, '../')
19+
import sys, os
20+
sys.path.insert(0, os.path.join(__file__, "../"))
2121

2222
from splunklib.client import connect
2323

examples/dashboard/feed.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
# in the README.
2121

2222

23-
import sys, datetime, urllib2, json
23+
import sys, os, urllib2, json
24+
sys.path.insert(0, os.path.join(__file__, "../.."))
2425
from xml.etree import ElementTree
2526

2627
import splunklib.client as client

examples/event_types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
"""A command line utility that lists Splunk event types."""
1818

19-
import sys
20-
sys.path.insert(0, '../')
19+
import sys, os
20+
sys.path.insert(0, os.path.join(__file__, "../"))
2121

2222
from splunklib.client import connect
2323

examples/explorer/explorer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import sys
2020
import os
2121

22-
sys.path.insert(0, '../../') # Use splunklib and utils without installing
22+
sys.path.insert(0, os.path.join(__file__, "../.."))
2323

2424
try:
2525
import utils

0 commit comments

Comments
 (0)