Kivy Garden Filebrowser Install Error

400 views
Skip to first unread message

Yowser MaGuil

unread,
Feb 27, 2014, 3:20:32 PM2/27/14
to kivy-...@googlegroups.com
First: hello to all in the group! I am an app developer new to Kivy. I have been using python for 3 years.

Currently I am trying to install Kivy Designer based on instructions found here:: https://github.com/kivy/kivy-designer

When I attempt to install the Filebrowser via "garden install filebrowser", I am getting the following message:

Traceback (most recent call last):
  File "/usr/bin/garden", line 189, in <module>
    GardenTool().main(sys.argv[1:])
  File "/usr/bin/garden", line 71, in main
    options.func()
  File "/usr/bin/garden", line 109, in cmd_install
    fd = self.download(opts.package)
  File "/usr/bin/garden", line 170, in download
    data += buf
TypeError: Can't convert 'bytes' object to str implicitly


 Using Arch Linux, Python 3, Kivy 1.8.

Thanks

Ben Rousch

unread,
Feb 27, 2014, 3:23:53 PM2/27/14
to kivy-...@googlegroups.com
I don't think the projects in the kivy-garden have all been ported to Python3 yet, only Kivy itself. Try it with Python 2.7 and see if it works.


--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
 Ben Rousch
   bro...@gmail.com
   http://clusterbleep.net/

Aditya kapur

unread,
Dec 1, 2015, 1:21:07 PM12/1/15
to Kivy users support
This is not a problem with kivy package. It's the bytesstring to string conversion which python3 doesn't like. The code is dyning post the download and fixing it to the string using decode may not be an option. 

the data is initialized as data = '' which is a string. r represts the binary content and should be treated as bytes and not string s

        for buf in r.iter_content(1024):
            index += 1
            data += buf <== dying here 
            count += len(buf)
            print('Progression', count, animation[index % len(animation)], '\r')
            sys.stdout.flush()
        print('Download done ({} downloaded)'.format(count))


potential fix to the problem 
change your garden python script to 

  data = b''  # initialize as a byte buffer 
        for buf in r.iter_content(1024):
            index += 1
            data += buf  # the error would go away
            count += len(buf) 
            print('Progression', count, animation[index % len(animation)], '\r')
            sys.stdout.flush()
        print('Download done ({} downloaded)'.format(count))
        
        return BytesIO(data) change string io to BytesIO 

this would require  import at the top of the script 
from io import BytesIO 
Reply all
Reply to author
Forward
0 new messages