Bug 11181 - import pysmb causes python ImportError
Summary: import pysmb causes python ImportError
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Python (show other bugs)
Version: 4.1.17
Hardware: All All
: P3 normal (vote)
Target Milestone: ---
Assignee: Amitay Isaacs
QA Contact: Samba QA Contact
Depends on:
Reported: 2015-03-27 09:26 UTC by Nagendra.V.S
Modified: 2017-01-03 08:39 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Nagendra.V.S 2015-03-27 09:26:42 UTC
Check out the below console log

Python 2.7.9 (default, Mar 24 2015, 10:47:14)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pysmb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dynamic module does not define init function (initpysmb)
>>> import smb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named smb
Probable fix could be change the initsmb function name in source4/libcli/pysmb.c (line 638) to initpysmb
Comment 1 Amitay Isaacs 2015-08-19 01:34:05 UTC
The module name is supposed to be "smb".  You can try importing smb module as follows:

  from samba import smb

That's how it is used elsewhere (python/samba/netcmd/gpo.py).
Comment 2 Andrew Bartlett 2017-01-03 08:39:30 UTC
Marking as resolved per Amitay's comment.