Message 145247 - Python tracker (original) (raw)

I got the problem when installing a package with resources using pysetup3. Here's the relevant part of the console session:

(venv) vinay@eta-natty:~/projects$ pysetup3 install nemo Installing from source directory: /home/vinay/projects/nemo running install_dist running build running build_py running build_scripts running install_lib creating /tmp/venv/lib/python3.3/site-packages creating /tmp/venv/lib/python3.3/site-packages/virtualenvwrapper byte-compiling /tmp/venv/lib/python3.3/site-packages/virtualenvwrapper/hook_loader.py to hook_loader.pyc byte-compiling /tmp/venv/lib/python3.3/site-packages/virtualenvwrapper/user_scripts.py to user_scripts.pyc byte-compiling /tmp/venv/lib/python3.3/site-packages/virtualenvwrapper/init.py to init.pyc byte-compiling /tmp/venv/lib/python3.3/site-packages/nemo.py to nemo.pyc running install_scripts changing mode of /tmp/venv/bin/nemo to 755 running pre_hook hooks.pre_install_data for command install_data running install_data running install_distinfo creating /tmp/venv/lib/python3.3/site-packages/nemo-0.1.dist-info creating /tmp/venv/lib/python3.3/site-packages/nemo-0.1.dist-info/METADATA creating /tmp/venv/lib/python3.3/site-packages/nemo-0.1.dist-info/INSTALLER creating /tmp/venv/lib/python3.3/site-packages/nemo-0.1.dist-info/REQUESTED creating /tmp/venv/lib/python3.3/site-packages/nemo-0.1.dist-info/RESOURCES Traceback (most recent call last): File "/tmp/venv/bin/pysetup3", line 6, in rc = packaging.run.main() # None interpreted as 0 File "/usr/local/lib/python3.3/packaging/run.py", line 653, in main return dispatcher() File "/usr/local/lib/python3.3/packaging/run.py", line 642, in call return func(self, self.args) File "/usr/local/lib/python3.3/packaging/run.py", line 91, in wrapper return f(*args, **kwargs) File "/usr/local/lib/python3.3/packaging/run.py", line 164, in _install return not install_local_project(target) File "/usr/local/lib/python3.3/packaging/install.py", line 122, in install_local_project return _run_install_from_dir(path) File "/usr/local/lib/python3.3/packaging/install.py", line 160, in _run_install_from_dir func(source_dir) File "/usr/local/lib/python3.3/packaging/install.py", line 87, in _run_packaging_install dist.run_command('install_dist') File "/usr/local/lib/python3.3/packaging/dist.py", line 709, in run_command cmd_obj.run() File "/usr/local/lib/python3.3/packaging/command/install_dist.py", line 508, in run self.run_command(cmd_name) File "/usr/local/lib/python3.3/packaging/command/cmd.py", line 330, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.3/packaging/dist.py", line 709, in run_command cmd_obj.run() File "/usr/local/lib/python3.3/packaging/command/install_distinfo.py", line 113, in run writer.writerow(row) TypeError: 'str' does not support the buffer interface

This is the relevant code in install_distinfo.run():

            resources_path = os.path.join(self.distinfo_dir,
                                          'RESOURCES')
            logger.info('creating %s', resources_path)
            if not self.dry_run:
                #with open(resources_path, 'w', encoding='utf-8') as f:
                with open(resources_path, 'wb') as f:
                    writer = csv.writer(f, delimiter=',',
                                        lineterminator='\n',
                                        quotechar='"')
                    for row in install_data.get_resources_out():
                        writer.writerow(row)

If I substitute the commented out line above which replaces 'wb' with 'w' and encoding, I get this result:

(venv) vinay@eta-natty:~/projects$ pysetup3 install nemo Installing from source directory: /home/vinay/projects/nemo running install_dist running build running build_py running build_scripts running install_lib byte-compiling /tmp/venv/lib/python3.3/site-packages/virtualenvwrapper/hook_loader.py to hook_loader.pyc byte-compiling /tmp/venv/lib/python3.3/site-packages/virtualenvwrapper/user_scripts.py to user_scripts.pyc byte-compiling /tmp/venv/lib/python3.3/site-packages/virtualenvwrapper/init.py to init.pyc byte-compiling /tmp/venv/lib/python3.3/site-packages/nemo.py to nemo.pyc running install_scripts changing mode of /tmp/venv/bin/nemo to 755 running pre_hook hooks.pre_install_data for command install_data running install_data running install_distinfo creating /tmp/venv/lib/python3.3/site-packages/nemo-0.1.dist-info creating /tmp/venv/lib/python3.3/site-packages/nemo-0.1.dist-info/METADATA creating /tmp/venv/lib/python3.3/site-packages/nemo-0.1.dist-info/INSTALLER creating /tmp/venv/lib/python3.3/site-packages/nemo-0.1.dist-info/REQUESTED creating /tmp/venv/lib/python3.3/site-packages/nemo-0.1.dist-info/RESOURCES creating /tmp/venv/lib/python3.3/site-packages/nemo-0.1.dist-info/RECORD