mozes / smpp.twisted

SMPP 3.4 client built on Twisted
Other
46 stars 29 forks source link

Unable to import from smpp.twisted.client #11

Open sbilly-qmedic opened 7 years ago

sbilly-qmedic commented 7 years ago

Hello,

For some reason, I can't get past the third line (import from smpp.twisted.client). Here is the stacktrace:

Traceback (most recent call last):
  File "test.py", line 3, in <module>
    from smpp.twisted.client import SMPPClientTransceiver, SMPPClientService
  File "/usr/local/lib/python2.7/site-packages/smpp/twisted/client.py", line 21, in <module>
    from smpp.twisted.protocol import SMPPClientProtocol, DataHandlerResponse
  File "/usr/local/lib/python2.7/site-packages/smpp/twisted/protocol.py", line 21, in <module>
    from smpp.pdu.operations import *
  File "/usr/local/lib/python2.7/site-packages/smpp/pdu/operations.py", line 16, in <module>
    from smpp.pdu.pdu_types import CommandId, PDU, PDURequest, PDUResponse, PDUDataRequest
  File "/usr/local/lib/python2.7/site-packages/smpp/pdu/pdu_types.py", line 20, in <module>
    CommandId = Enum(*constants.command_id_name_map.keys())
TypeError: __call__() takes at most 6 arguments (28 given)

I think the issue may come from the enum module? I have pyOpenSSL (v0.13), enum (v0.4.6), Twisted (v16.6.0), smpp.pdu (v0.3), and smpp.twisted (v0.4) installed.

Not sure why it would fail, though?

prem-narain commented 7 years ago

Are you using virtual environment ?

sbilly-qmedic commented 7 years ago

Yes, actually - I tried to set it up on an Amazon EC2 instance. Is this a known issue with the Enum module and virtual environments, by any chance?

gagandce commented 7 years ago

I am having the same issue. Is there a fix for this ? Actually I am surprised that using virtual environment will break Enum ???

davidjmorris commented 6 years ago

I have the same issue using python 2.7.12 I think this happens because smpp.twisted required enum PyOpenSSL requires enum34 and this clashes with enum smpp.twisted requires PyOpenSSL so then we have a clash between enum and enum34

mexicarne commented 6 years ago

I tried to remove enum34 and leave enum alone. Getting the following error

Traceback (most recent call last):
  File "tw-smpp.py", line 2, in <module>
    from twisted.internet import reactor, defer
  File "/somedir/smpp2/lib/python2.7/site-packages/twisted/internet/reactor.py", line 38, in <module>
    from twisted.internet import default
  File "/somedir/smpp2/lib/python2.7/site-packages/twisted/internet/default.py", line 56, in <module>
    install = _getInstallFunction(platform)
  File "/somedir/smpp2/lib/python2.7/site-packages/twisted/internet/default.py", line 48, in _getInstallFunction
    from twisted.internet.pollreactor import install
  File "/somedir/smpp2/lib/python2.7/site-packages/twisted/internet/pollreactor.py", line 25, in <module>
    from twisted.internet import posixbase
  File "/somedir/smpp2/lib/python2.7/site-packages/twisted/internet/posixbase.py", line 18, in <module>
    from twisted.internet import error, udp, tcp
  File "/somedir/smpp2/lib/python2.7/site-packages/twisted/internet/tcp.py", line 28, in <module>
    from twisted.internet._newtls import (
  File "/somedir/smpp2/lib/python2.7/site-packages/twisted/internet/_newtls.py", line 21, in <module>
    from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
  File "/somedir/smpp2/lib/python2.7/site-packages/twisted/protocols/tls.py", line 41, in <module>
    from OpenSSL.SSL import Error, ZeroReturnError, WantReadError
  File "/somedir/smpp2/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/somedir/smpp2/lib/python2.7/site-packages/OpenSSL/crypto.py", line 12, in <module>
    from cryptography import x509
  File "/somedir/smpp2/lib/python2.7/site-packages/cryptography/x509/__init__.py", line 8, in <module>
    from cryptography.x509.base import (
  File "/somedir/smpp2/lib/python2.7/site-packages/cryptography/x509/base.py", line 16, in <module>
    from cryptography.x509.extensions import Extension, ExtensionType
  File "/somedir/smpp2/lib/python2.7/site-packages/cryptography/x509/extensions.py", line 24, in <module>
    from cryptography.x509.general_name import GeneralName, IPAddress, OtherName
  File "/somedir/smpp2/lib/python2.7/site-packages/cryptography/x509/general_name.py", line 18, in <module>
    from cryptography.x509.name import Name
  File "/somedir/smpp2/lib/python2.7/site-packages/cryptography/x509/name.py", line 28, in <module>
    _ASN1_TYPE_TO_ENUM = dict((i.value, i) for i in _ASN1Type)
TypeError: 'type' object is not iterable

Python version is 2.7.14, pip freeze is

asn1crypto==0.24.0
attrs==17.4.0
Automat==0.6.0
cffi==1.11.4
constantly==15.1.0
cryptography==2.1.4
enum==0.4.6
hyperlink==18.0.0
idna==2.6
incremental==17.5.0
ipaddress==1.0.19
pycparser==2.18
pyOpenSSL==17.5.0
six==1.11.0
smpp.pdu==0.3
smpp.twisted==0.4
sqlite3==0.0.0
Tkinter==0.0.0
Twisted==17.9.0
zope.interface==4.4.3
georgiana-gligor commented 6 years ago

I'm getting the same error. Removed enum34 with no success. Has anyone been past this point?