Skip to content

st2 python3 interpreter is falling back to importing a python2 lib that is incompatible with python3 #4658

@mjtice

Description

@mjtice
SUMMARY

One of my libraries is trying to import cassandra.cluster. That library is trying to import from concurrent.futures import ThreadPoolExecutor, FIRST_COMPLETED, wait as wait_futures - which, as I understand, is built into python3 (and a separate library for compatibility with python3)

ISSUE TYPE
  • Bug Report
STACKSTORM VERSION
# st2 --version
st2 3.0.0, on Python 2.7.6
OS / ENVIRONMENT / INSTALL METHOD

Docker container running Ubuntu 14.04

STEPS TO REPRODUCE

Create a python runner in your python3-specific pack. Inside the runner import cassandra libs and just create an object.

from cassandra.cluster import Cluster
        cluster = Cluster()
EXPECTED RESULTS

I expect the library to import and the object to initialize

ACTUAL RESULTS

st2 python3 falls back to python2 to import the lib and it throws an exception similar to

  File \"/opt/stackstorm/packs/ostk_common/actions/lib/ostkdbs.py\", line 2, in <module>
    from cassandra.cluster import Cluster
  File \"/opt/stackstorm/virtualenvs/ostk_common/lib/python3.5/site-packages/cassandra/cluster.py\", line 23, in <module>
    from concurrent.futures import ThreadPoolExecutor, FIRST_COMPLETED, wait as wait_futures
  File \"/opt/stackstorm/st2/lib/python2.7/site-packages/concurrent/futures/__init__.py\", line 8, in <module>
    from concurrent.futures._base import (FIRST_COMPLETED,
  File \"/opt/stackstorm/st2/lib/python2.7/site-packages/concurrent/futures/_base.py\", line 414
    raise exception_type, self._exception, self._traceback
                        ^
SyntaxError: invalid syntax

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions