1. Michael Manfre
  2. django-mssql
  3. Issues

Issues

Issue #60 resolved

Python 3.4 pip install error "TypeError: can't use a string pattern on a bytes-like object"

James Anderson
created an issue
I'm getting an error using "pip install django-mssql" on Windows server 2012 x64, Python 3.4, MS-SQL 2012 (before post-installation reboot)

The stack is below and the full pip error log is attached.  At first glance it appears to be a 2 to 3 string encoding issue.

Running setup.py (path:C:\Users\u0490822\AppData\Local\Temp\pip_build_u0490822\django-mssql\setup.py) egg_info for package django-mssql
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "C:\Users\u0490822\AppData\Local\Temp\pip_build_u0490822\django-mssql\setup.py", line 115, in <module>
        version=find_version("sqlserver_ado", "__init__.py"),
      File "C:\Users\u0490822\AppData\Local\Temp\pip_build_u0490822\django-mssql\setup.py", line 17, in find_version
        version_file, re.M)
      File "C:\Python34\lib\re.py", line 166, in search
        return _compile(pattern, flags).search(string)
    TypeError: can't use a string pattern on a bytes-like object
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "C:\Users\u0490822\AppData\Local\Temp\pip_build_u0490822\django-mssql\setup.py", line 115, in <module>

    version=find_version("sqlserver_ado", "__init__.py"),

  File "C:\Users\u0490822\AppData\Local\Temp\pip_build_u0490822\django-mssql\setup.py", line 17, in find_version

    version_file, re.M)

  File "C:\Python34\lib\re.py", line 166, in search

    return _compile(pattern, flags).search(string)

TypeError: can't use a string pattern on a bytes-like object

Comments (7)

  1. Mike

    I see from the change log that this fix was introduced in version 1.6.1, however the error persists for me. I was able to install version 1.6 using Python 3.4, though.

    Figure I'd let you know.

  2. Mikhail Denisenko

    This fix didn't work for me either:

    Downloading/unpacking django-mssql
      Downloading django-mssql-1.6.1.zip (68kB): 68kB downloaded
      Running setup.py egg_info for package django-mssql
        Traceback (most recent call last):
          File "<string>", line 16, in <module>
          File "/home/denisenk/django-sqlserver/env/build/django-mssql/setup.py", line 115, in <module>
            version=find_version("sqlserver_ado", "__init__.py"),
          File "/home/denisenk/django-sqlserver/env/build/django-mssql/setup.py", line 17, in find_version
            version_file, re.M)
          File "/home/denisenk/django-sqlserver/env/lib64/python3.3/re.py", line 161, in search
            return _compile(pattern, flags).search(string)
        TypeError: can't use a bytes pattern on a string-like object
        Complete output from command python setup.py egg_info:
        Traceback (most recent call last):
    
      File "<string>", line 16, in <module>
    
      File "/home/denisenk/django-sqlserver/env/build/django-mssql/setup.py", line 115, in <module>
    
        version=find_version("sqlserver_ado", "__init__.py"),
    
      File "/home/denisenk/django-sqlserver/env/build/django-mssql/setup.py", line 17, in find_version
    
        version_file, re.M)
    
      File "/home/denisenk/django-sqlserver/env/lib64/python3.3/re.py", line 161, in search
    
        return _compile(pattern, flags).search(string)
    
    TypeError: can't use a bytes pattern on a string-like object
    

    Created a pull request with fix: https://bitbucket.org/Manfre/django-mssql/pull-request/27/fix-installation-on-python-3/diff

  3. Log in to comment