salimoha / googlecl

Automatically exported from code.google.com/p/googlecl
0 stars 0 forks source link

Support whitespace in filename (ubuntu 10.04) #196

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a file with one or more spaces in its name.
2. Try to 'google picasa create file\ name.png' and it works
3. Try to 'google picasa create $(find /path -type f -name file*|sed 's_\ _\\ 
_g') and it doesn't work.

What is the expected output? What do you see instead?
Expected to upload, instead it prints the file path up to the first whitespace 
in the filename.

Example of output from 2.:
$ google picasa create ~/Pictures/nexus\ one\ 32x32.png
Please specify title: test
Loading file /home/paal/Pictures/nexus one 32x32.png to album test

Example of output from 3.:
$ google picasa create $(find ~/Pictures/ -type f -name nexus*|sed 's_\ _\\ _g')
Please specify title: test
Loading file /home/paal/Pictures/nexus\ to album test
Traceback (most recent call last):
  File "/usr/bin/google", line 463, in <module>
    main()
  File "/usr/bin/google", line 457, in main
    run_once(options, args)
  File "/usr/bin/google", line 356, in run_once
    task.run(client, options, args)
  File "/usr/lib/pymodules/python2.6/googlecl/picasa/service.py", line 299, in _run_create
    client.InsertPhotoList(album, photo_list=args, tags=options.tags)
  File "/usr/lib/pymodules/python2.6/googlecl/picasa/service.py", line 220, in insert_photo_list
    err.args[0].reason,
AttributeError: 'int' object has no attribute 'reason'

What version of the product are you using? On what operating system? What
version of gdata-python-client (aka python-gdata)?
Ubuntu 10.04, latest python-gdata (1.2.4-0ubuntu2), googlecl_0.9.7-1_all.deb.

Please provide any additional information below.
This may be more of a general linux question, but I would like to know if you 
have any suggestion on how to handle filenames with spaces.

Original issue reported on code.google.com by paal.nil...@gmail.com on 30 Jun 2010 at 1:05

GoogleCodeExporter commented 9 years ago
Could you apply the patch in issue 86, or run the version of googlecl in the 
repository? It fixes the AttributeError you see, and you should get a 
meaningful error message.

Original comment by tom.h.mi...@gmail.com on 30 Jun 2010 at 1:26

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Same issue with WinXP and GoogleCL 0.9.8 : filenames with whitespaces don't 
work. The error dump is shown below. 

F:\manualbackups\backups\album\ellu>c:\google\googlecl\google picasa create --ti
tle "Elina Collection 3" *.jpg
Loading file *.jpg to album Elina Collection 3
Failed to upload *.jpg. (601: Found <type 'str'>, not path name or object with a
 .read() method)

Original comment by ville...@gmail.com on 5 Jul 2010 at 8:14

GoogleCodeExporter commented 9 years ago
villejus, are you using Cygwin or some other shell that will expand the '*'? 
The windows command prompt does not usually do so.

Original comment by tom.h.mi...@gmail.com on 12 Jul 2010 at 9:25

GoogleCodeExporter commented 9 years ago
Ugly workaround, if you're using a bash script:

title=$title
google picasa create --title "$title"
for i in *.jpg; do
  google picasa post --title "$title" $i
done

Original comment by asourdi...@gmail.com on 10 Aug 2010 at 3:48

GoogleCodeExporter commented 9 years ago
Below is the patch which can potentially fix both cases mentioned in this 
issue. At least it worked for me with the following command lines:
1. Issue with find reported by paal.nilsen:
google picasa create --title Test "$(find . -type f -name \*.png)"
2. Issue with expansion of '*' reported by villejus:
google picasa create --title Test '*.png'

I'd appreciate if you try it and report here if it works for you or not.

Ed

Original comment by bart...@gmail.com on 16 Oct 2010 at 8:38

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for addressing this issue, Ed.

I've committed a patch similar to Ed's that addresses the issue(s). Note that 
as mentioned, the correct syntax for the "find" expansion is "$(find /path 
-type f -name file*"

Expanding wildcards will work without putting them in quotes for both Unix and 
Windows. So for #2, Windows and Unix users have the same command: google picasa 
create "My Test Album" *.png

I've attached a patch against 0.9.11 that will fix this, and r489 in the trunk 
includes it already.

Original comment by tom.h.mi...@gmail.com on 30 Oct 2010 at 12:17

Attachments:

GoogleCodeExporter commented 9 years ago
Made a mistake in the above patch -- all that will do is print out the 
arguments that have been passed to google.py. Not terribly useful. Here's a 
fixed patch (and r490 is also fixed)

Original comment by tom.h.mi...@gmail.com on 31 Oct 2010 at 7:13

Attachments: