This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: ntpath.py Error in Windows
Type: behavior Stage: resolved
Components: Windows Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: ben.kummer, paul.moore, serhiy.storchaka, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2016-02-15 13:25 by ben.kummer, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python_bug_reproduce.py ben.kummer, 2016-02-15 13:25 Code to reproduce the bug
Messages (2)
msg260310 - (view) Author: Ben Kummer (ben.kummer) Date: 2016-02-15 13:25
ntpath.py throws an error in Python2.7.11 Windows

Code snippet:
product_dir ="/zope/eggs43"
my_tuple= os.path.split(product_dir)[:-1]
roduct_prefix = os.path.join(my_tuple )

The same code works in python 2.7.11 under Linux

Traceback:
C:\zope\selenium_test>c:\Python27\python.exe python_bug_reproduce.py
Traceback (most recent call last):
  File "python_bug_reproduce.py", line 10, in <module>
    main()
  File "python_bug_reproduce.py", line 7, in main
    product_prefix = os.path.join(my_tuple )
  File "c:\Python27\lib\ntpath.py", line 90, in join
    return result_drive + result_path
TypeError: cannot concatenate 'str' and 'tuple' objects


code to reproduce:

#!/usr/bin/python
import os

def main():
    product_dir ="/zope/eggs43"
    my_tuple= os.path.split(product_dir)[:-1]
    product_prefix = os.path.join(my_tuple )
    
if __name__ == "__main__":
    main()
msg260311 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-02-15 13:54
The first argument of os.path.join() (as well as all other) in Python 2.7 must be str or unicode. You pass a tuple.
History
Date User Action Args
2022-04-11 14:58:27adminsetgithub: 70553
2016-02-15 13:54:14serhiy.storchakasetstatus: open -> closed

nosy: + serhiy.storchaka
messages: + msg260311

resolution: not a bug
stage: resolved
2016-02-15 13:25:05ben.kummercreate