miketeo / pysmb

pysmb is an experimental SMB/CIFS library written in Python. It implements the client-side SMB/CIFS protocol (SMB1 and SMB2) which allows your Python application to access and transfer files to/from SMB/CIFS shared folders like your Windows file sharing and Samba folders.
Other
341 stars 94 forks source link

urllib.request getters removed in Python 3.4 #3

Closed JariInc closed 10 years ago

JariInc commented 10 years ago

When trying examples in https://pythonhosted.org/pysmb/api/smb_SMBHandler.html using Python 3.4, got error:

  File "/usr/local/lib/python3.4/urllib/request.py", line 455, in open
    response = self._open(req, data)
  File "/usr/local/lib/python3.4/urllib/request.py", line 473, in _open
    '_open', req)
  File "/usr/local/lib/python3.4/urllib/request.py", line 433, in _call_chain
    result = func(*args)
  File "/share/private/jari/fb-local/ENV/lib/python3.4/site-packages/smb/SMBHandler.py", line 20, in smb_open
    host = req.get_host()
AttributeError: 'Request' object has no attribute 'get_host'

urllib.request.get_host() was deprecated in 3.3 and removed in 3.4, see: https://docs.python.org/3.3/library/urllib.request.html#urllib.request.Request.get_host

JariInc commented 10 years ago

Fix for SMBHandler is pretty trivial: https://github.com/JariInc/pysmb/commit/dbf67b87174007c849b6b5b1f6ab030bf2b4866c

I'm not sure if I have time to go through the whole code base and fix these, but here's a start.

miketeo commented 10 years ago

Hi, Jari. Thank you for your patch. I'd already merged it into the master branch and will test it over this weekend.