1

What i have

  • running aerospike, test sql go okay
  • installed client lib on same machine via pip3 install aerospike

  • python version default for centos 7

            Python 3.4.9
    
  • Sample for this page is not working

           https://www.aerospike.com/docs/client/python/index.html
    

After i removed try/except block, i get following error:

Traceback (most recent call last):
  File "/tmp/aerospike.py", line 4, in <module>
    import aerospike
  File "/tmp/aerospike.py", line 12, in <module>
    client = aerospike.client(config).connect()
AttributeError: 'module' object has no attribute 'client'

I not see source code of connector(cpython used?) and have no any clue where to go from this point.

pip3 list
Package                Version 
---------------------- --------
aerospike              3.5.0   
asn1crypto             0.24.0  
atomicwrites           1.2.1   
attrs                  18.2.0  
cassandra-driver       3.15.1  
cffi                   1.11.5  
cryptography           2.3.1   
diff-match-patch       20121119
Django                 2.0.9   
django-chunked-upload  1.1.3   
django-compat          1.0.15  
django-crispy-forms    1.7.2   
django-datatable-view  0.9.0   
django-datatables-view 1.17.0  
django-hijack          2.1.10  
django-import-export   1.1.0   
django-queryset-csv    1.0.1   
django-simple-menu     1.2.1   
django-tables2         2.0.2   
django-tracking2       0.4.1   
et-xmlfile             1.0.1   
future                 0.17.1  
GeoIP                  1.3.2   
idna                   2.7     
importlib-metadata     0.6     
jdcal                  1.4     
more-itertools         4.3.0   
mysqlclient            1.3.13  
odfpy                  1.3.6   
openpyxl               2.5.9   
path.py                11.5.0  
pathlib2               2.3.2   
pidfile                0.1.1   
pika                   0.12.0  
pip                    18.1    
pluggy                 0.8.0   
py                     1.7.0   
pycall                 2.3.2   
pycparser              2.19    
PyMySQL                0.9.2   
pytest                 4.0.1   
python-dateutil        2.7.5   
python-http-client     3.1.0   
pytz                   2018.7  
PyYAML                 3.13    
scandir                1.9.0   
sendgrid               5.6.0   
setuptools             19.6.2  
six                    1.11.0  
tablib                 0.12.1  
unicodecsv             0.14.1  
xlrd                   1.1.0   
xlwt                   1.3.0 
arheops
  • 15,544
  • 1
  • 21
  • 27
  • 1
    Please show your `pip list` and the actual code snippet you're trying. You want to try the code in the doc? https://aerospike-python-client.readthedocs.io/en/latest/client.html – Ronen Botzer Nov 26 '18 at 19:00
  • I have tried exact code from page. – arheops Nov 27 '18 at 00:21

1 Answers1

3

You have a namespace collision. The Aerospike client module is called aerospike. Your local script is called aerospike.py. The way imports work is that Python will first look locally, then in repos like pip. Locally it sees your script, and tries to load it again.

Try to rename the script to aerospike-test.py

Ronen Botzer
  • 6,951
  • 22
  • 41