Impossible to download a library [Linux]

Hi,

I tried this week-end the library downloader of platformIO using :

platformio lib search <something>

and

platformio lib install <IDofsomething>

and it worked on my computed under Windows 10.

I just tried on my linux session this morning (exactly the same) but it didn’t seem to work. I get the following error when running the install command :

byran@xxx:/media/byran/Données/PlatformIOProjectsLinux/Essai3$ platformio lib install 91
Library Storage: /media/byran/Données/PlatformIOProjectsLinux/Essai3/.piolibdeps
LibraryManager: Installing id=91
Error: Traceback (most recent call last):
  File "/home/byran/.atom/packages/platformio-ide/penv/local/lib/python2.7/site-packages/platformio/__main__.py", line 108, in main
    cli(None, None, None)
  File "/home/byran/.atom/packages/platformio-ide/penv/local/lib/python2.7/site-packages/click/core.py", line 700, in __call__
    return self.main(*args, **kwargs)
  File "/home/byran/.atom/packages/platformio-ide/penv/local/lib/python2.7/site-packages/click/core.py", line 680, in main
    rv = self.invoke(ctx)
  File "/home/byran/.atom/packages/platformio-ide/penv/local/lib/python2.7/site-packages/click/core.py", line 1027, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))

  File "/home/byran/.atom/packages/platformio-ide/penv/local/lib/python2.7/site-packages/click/core.py", line 1027, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/byran/.atom/packages/platformio-ide/penv/local/lib/python2.7/site-packages/click/core.py", line 873, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/byran/.atom/packages/platformio-ide/penv/local/lib/python2.7/site-packages/click/core.py", line 508, in invoke
    return callback(*args, **kwargs)
  File "/home/byran/.atom/packages/platformio-ide/penv/local/lib/python2.7/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/home/byran/.atom/packages/platformio-ide/penv/local/lib/python2.7/site-packages/platformio/commands/lib.py", line 84, in lib_install
    lm.install(library, silent=silent, interactive=interactive)
  File "/home/byran/.atom/packages/platformio-ide/penv/local/lib/python2.7/site-packages/platformio/managers/lib.py", line 156, in install
    _requirements, silent, trigger_event)
  File "/home/byran/.atom/packages/platformio-ide/penv/local/lib/python2.7/site-packages/platformio/managers/package.py", line 451, in install
    pkg_dir = self._install_from_piorepo(name, requirements)
  File "/home/byran/.atom/packages/platformio-ide/penv/local/lib/python2.7/site-packages/platformio/managers/lib.py", line 138, in _install_from_piorepo
    requirements)
  File "/home/byran/.atom/packages/platformio-ide/penv/local/lib/python2.7/site-packages/platformio/managers/package.py", line 214, in _install_from_url
    dlpath = self.download(url, tmp_dir, sha1)
  File "/home/byran/.atom/packages/platformio-ide/penv/local/lib/python2.7/site-packages/platformio/managers/package.py", line 296, in download
    fd = FileDownloader(url, dest_dir)
  File "/home/byran/.atom/packages/platformio-ide/penv/local/lib/python2.7/site-packages/platformio/downloader.py", line 38, in __init__
    self.set_destination(join(dest_dir, self._fname))
  File "/home/byran/.atom/packages/platformio-ide/penv/lib/python2.7/posixpath.py", line 73, in join
    path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 17: ordinal not in range(128)

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  http://docs.platformio.org/en/stable/faq.html

* Report this problem to the developers
  https://github.com/platformio/platformio/issues

============================================================

Exception AttributeError: "'FileDownloader' object has no attribute '_request'" in <bound method FileDownloader.__del__ of <platformio.downloader.FileDownloader object
 at 0x7fa484e9bd50>> ignored

Does anyone have an idea about how to solve that problem ?

Cheers,

Byran

You have diacritics in path where library is expected to be installed (“Données”). I believe this should be allowed for posixpath as long as all input is consistent in operating on Python unicode type instead of str.

1 Like

I should have think about that…

Many thanks. That solved my problem.

I created issue on GH because I think there is unicode problem somewhere in the code → Can not install library in a path containing diacritics · Issue #771 · platformio/platformio-core · GitHub

Could you try this build?

pip unsintall platformio
pip install -U https://github.com/platformio/platformio/archive/develop.zip

Does it work?

Nope, same error for me.

@Byran could you repeat this steps again? It should work now. Thanks!

@ivankravets I get the same error I think (I did the steps in the terminal to be sure) :

byran@xxx:/media/byran/Données/temp/temppIO$ platformio lib install 425
Library Storage: /media/byran/Données/temp/temppIO/.piolibdeps
LibraryManager: Installing id=425
Error: Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/platformio/__main__.py", line 106, in main                          
    cli(None, None, None)                                                                                          
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 700, in __call__                               
    return self.main(*args, **kwargs)                                                                              
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 680, in main                                   
    rv = self.invoke(ctx)                                                                                          
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1027, in invoke                                
    return _process_result(sub_ctx.command.invoke(sub_ctx))                                                        
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1027, in invoke                                
    return _process_result(sub_ctx.command.invoke(sub_ctx))                                                        
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 873, in invoke                                 
    return ctx.invoke(self.callback, **ctx.params)                                                                 
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 508, in invoke                                 
    return callback(*args, **kwargs)                                                                               
  File "/usr/local/lib/python2.7/dist-packages/click/decorators.py", line 26, in new_func                          
    return f(get_current_context().obj, *args, **kwargs)                                                           
  File "/usr/local/lib/python2.7/dist-packages/platformio/commands/lib.py", line 91, in lib_install                
    lm.install(library, silent=silent, interactive=interactive)                                                    
  File "/usr/local/lib/python2.7/dist-packages/platformio/managers/lib.py", line 216, in install                   
    _requirements, silent, trigger_event)                                                                          
  File "/usr/local/lib/python2.7/dist-packages/platformio/managers/package.py", line 443, in install               
    pkg_dir = self._install_from_piorepo(name, requirements)                                                       
  File "/usr/local/lib/python2.7/dist-packages/platformio/managers/lib.py", line 202, in _install_from_piorepo     
    if app.get_setting("enable_ssl") else dl_data['url'], requirements)                                            
  File "/usr/local/lib/python2.7/dist-packages/platformio/managers/package.py", line 194, in _install_from_url     
    dlpath = self.download(url, tmp_dir, sha1)                                                                     
  File "/usr/local/lib/python2.7/dist-packages/platformio/managers/package.py", line 276, in download              
    fd = FileDownloader(url, dest_dir)                                                                             
  File "/usr/local/lib/python2.7/dist-packages/platformio/downloader.py", line 51, in __init__
    self.set_destination(join(dest_dir, self._fname))
  File "/usr/lib/python2.7/posixpath.py", line 73, in join
    path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 17: ordinal not in range(128)

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  http://docs.platformio.org/en/stable/faq.html

* Report this problem to the developers
  https://github.com/platformio/platformio/issues

============================================================

I have the developement version of PlatformIO - CLI and the normal (3.0.1 ?) version of PlatformIO - IDE.

No, it should be 3.0.0a2. See instruction how to switch to development version Redirecting...

If you have already a checked “develop”, try to uncheck it and check again.

I wasn’t sure but it was this version :

byran@xxx:~/Bureau/Test$ platformio --version
PlatformIO, version 3.0.2a2

I’m sorry I totally don’t know what you mean.

Do you mean that 3.0.2a2 doesn’t work?

@ivankravets Unfortunately yes.

I reproduced this issue. Will fix it later. Thanks.

A temporary solution is to update PlatformIO home_dir with a new path that doesn’t contain Unicode chars.

Yes. That’s what I did. Thanks anyway.