Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nmb utils.py encode_name function TypeError with python 3.6 #130

Closed
RealCoffeeCat opened this issue Apr 1, 2019 · 3 comments
Closed

nmb utils.py encode_name function TypeError with python 3.6 #130

RealCoffeeCat opened this issue Apr 1, 2019 · 3 comments

Comments

@RealCoffeeCat
Copy link

Currently using version 1.1.27

Recently updated from python 2.7 to 3.6, on line 14 of nmb/utils.py, I am getting TypeError: can't concat str to bytes.

File "/home/user/miniconda2/envs/myenvrionment/lib/python3.6/site-packages/nmb/utils.py", line 14, in encode_name name = name.ljust(15) + chr(type) TypeError: can't concat str to bytes

My guess would be to change chr(tpye) to bytes([type]), though I am not sure if pysmb supports python3.6 yet or if this was brought up before. Any workaround for now?

@miketeo
Copy link
Owner

miketeo commented Apr 1, 2019

I am not able to reproduce your error.
Running on Ubuntu 18.04 gives me the following:

Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from nmb.nmb_constants import *
>>> from nmb.utils import encode_name
>>> encode_name('TESTMACH', TYPE_WORKSTATION)
b' FEEFFDFEENEBEDEICACACACACACACAAA\x00'

If you are using virtualenv, did you do-setup of the virtualenv when you upgrade your python?

@RealCoffeeCat
Copy link
Author

I will check on my side if I didn't forget something while doing the switch

@RealCoffeeCat
Copy link
Author

All good, error was on my side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants