What I want to do.
I want to access share folder of remote Windows10 computer using smb module but I could not do it.
Environment
- Windows10
- Python v3.10.2
- pysmb v1.2.7
What I confirmed and my question.
Firstly I installed pysmb module as following:
python -m pip install pysmb
In the command line:
Collecting pysmb
using cached pysmb-1.2.7.zip(1.3MB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: pyasn1 in c:\----\lib\site-packages( from pysmb) (0.4.8)
Using legacy 'setup.py install' for pysmb, since package 'wheel' is not installed.
Installing collected packages: pysmb
Running setup.py install for pysmb ... done
Successfully installed pysmb-1.2.7
So I thought pysmb module was installed on my environment. So I made a python code as follows:
import platform
from smb.SMBConnection import SMBConnection
conn = SMBConnection(userID = "myname",
password = "hoge",
my_name = platform.uname().node,
remote_name = "192.168.0.3",
domain = "",
use_ntlm_v2 = True)
conn.connect("192.168.0.3",139)
items = conn.listPath("data","/")
for item in items:
print(item)
When I run the code, following error was emerged.
*File test.py, line 2, in <module>
from smb.SMBConnection import SMBConnection
builtin.ModuleNotFoundError: No module named 'smb.SMBConnection'; 'smb' is not a package.
I don't understand why the error come up. I also tried:
from smb.SMBConnection import *
But the result was same. Which part is invalid to run this code ? Please let me know what I should correct to make it work. Thank you.