salimoha / googlecl

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

Invalid --cal value causes NoneType #309

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Try running any of the calendar commands while using the --cal delimiter such 
as:
1. google calendar list today --cal .*
2. google calendar add "lunch tomorrow at CPK" --cal "calendar_name"

What is the expected output? What do you see instead?
List of events if trying using the "list" task, or no output if using the "add" 
task.  Output below is returned instead:

Traceback (most recent call last):
  File "/usr/local/bin/google", line 5, in <module>
    pkg_resources.run_script('googlecl==0.9.10', 'google')
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 442, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 1167, in run_script
    exec script_code in namespace, namespace
  File "/Library/Python/2.6/site-packages/googlecl-0.9.10-py2.6.egg/EGG-INFO/scripts/google", line 676, in <module>

  File "/Library/Python/2.6/site-packages/googlecl-0.9.10-py2.6.egg/EGG-INFO/scripts/google", line 662, in main

  File "/Library/Python/2.6/site-packages/googlecl-0.9.10-py2.6.egg/EGG-INFO/scripts/google", line 504, in run_once

  File "build/bdist.macosx-10.6-universal/egg/googlecl/calendar/service.py", line 490, in _run_list
  File "build/bdist.macosx-10.6-universal/egg/googlecl/calendar/service.py", line 448, in _list
  File "build/bdist.macosx-10.6-universal/egg/googlecl/calendar/service.py", line 252, in get_calendar_user_list
  File "build/bdist.macosx-10.6-universal/egg/googlecl/base.py", line 202, in get_entries
AttributeError: 'NoneType' object has no attribute 'text'

What version of the product are you using? On what operating system? What
version of gdata-python-client (aka python-gdata)?

googlecl 0.9.10
OSX 10.6.4
gdata 2.0.12 

Please provide any additional information below.

Original issue reported on code.google.com by sufian.s...@gmail.com on 5 Oct 2010 at 9:59

GoogleCodeExporter commented 9 years ago
You need quotes around the ".*" -- unfortunately, bash will expand .* before 
the python script gets a hold of that string.

On the other hand, even if that happens, the error you see shouldn't be 
occurring.

Original comment by thmil...@google.com on 5 Oct 2010 at 10:14

GoogleCodeExporter commented 9 years ago
Sorry, I forgot to add that ".*" was also attempted. Basically whenever --cal 
is specified I get the error.

Original comment by sufian.s...@gmail.com on 5 Oct 2010 at 10:18

GoogleCodeExporter commented 9 years ago
That's extremely strange. Can you apply the attached patch, and run a command 
that was failing  but add --verbose? Then post the output on here. You should 
see a couple of lines that say ==title: <something> and ==uri: <something>

(As a side note, you don't have to say "list today", just "today" for events 
today and "list" for others)

Original comment by tom.h.mi...@gmail.com on 5 Oct 2010 at 10:48

Attachments:

GoogleCodeExporter commented 9 years ago
Patch applied.  Here's the output:

$ google calendar list --date 2010-10-06 --cal ".*" --verbose
Gdata will be imported from 
/Library/Python/2.6/site-packages/gdata-2.0.10-py2.6.egg/gdata/__init__.pyc
Your pythonpath: None
Initialized googlecl.service.BaseServiceCL
Loaded token from file
Token valid!
Traceback (most recent call last):
  File "/usr/local/bin/google", line 5, in <module>
    pkg_resources.run_script('googlecl==0.9.10', 'google')
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 442, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 1167, in run_script
    exec script_code in namespace, namespace
  File "/Library/Python/2.6/site-packages/googlecl-0.9.10-py2.6.egg/EGG-INFO/scripts/google", line 676, in <module>

  File "/Library/Python/2.6/site-packages/googlecl-0.9.10-py2.6.egg/EGG-INFO/scripts/google", line 662, in main

  File "/Library/Python/2.6/site-packages/googlecl-0.9.10-py2.6.egg/EGG-INFO/scripts/google", line 504, in run_once

  File "build/bdist.macosx-10.6-universal/egg/googlecl/calendar/service.py", line 490, in _run_list
  File "build/bdist.macosx-10.6-universal/egg/googlecl/calendar/service.py", line 448, in _list
  File "build/bdist.macosx-10.6-universal/egg/googlecl/calendar/service.py", line 252, in get_calendar_user_list
  File "build/bdist.macosx-10.6-universal/egg/googlecl/base.py", line 202, in get_entries
AttributeError: 'NoneType' object has no attribute 'text'

Original comment by sufian.s...@gmail.com on 5 Oct 2010 at 11:18

GoogleCodeExporter commented 9 years ago
Mac is doing something strange with the install.

can you remove the build/ folder from wherever you installed GoogleCL? I assume 
that you downloaded the .tar folder and used setup.py?

And where did you apply the patch? Just to be sure, you should erase everything 
matching

/Library/Python/2.6/site-packages/googlecl*

then apply the patch to the src/ folder from the tarball, then run setup.py 
again (deleting build/ afterwards). If there aren't ANY debug messages starting 
with '===' you're not running the patched code.

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

GoogleCodeExporter commented 9 years ago
Yes I downloaded the .tar file and used setup.py.  Following your steps I was 
able to see the === debug messages.  Here's the output:

$ google calendar list --date 2010-10-06 --cal ".*" --verbose
Gdata will be imported from /Library/Python/2.6/site-packages/gdata/__init__.pyc
Your pythonpath: None
Initialized googlecl.service.BaseServiceCL
Loaded token from file
Token valid!
===uri: /calendar/feeds/default/allcalendars/full?max-results=10000
===title: .*
===using regex
===err: 'NoneType' object has no attribute 'text'
Traceback (most recent call last):
  File "/usr/local/bin/google", line 5, in <module>
    pkg_resources.run_script('googlecl==0.9.10', 'google')
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 442, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 1167, in run_script
    exec script_code in namespace, namespace
  File "/Library/Python/2.6/site-packages/googlecl-0.9.10-py2.6.egg/EGG-INFO/scripts/google", line 676, in <module>

  File "/Library/Python/2.6/site-packages/googlecl-0.9.10-py2.6.egg/EGG-INFO/scripts/google", line 662, in main

  File "/Library/Python/2.6/site-packages/googlecl-0.9.10-py2.6.egg/EGG-INFO/scripts/google", line 504, in run_once

  File "build/bdist.macosx-10.6-universal/egg/googlecl/calendar/service.py", line 490, in _run_list
  File "build/bdist.macosx-10.6-universal/egg/googlecl/calendar/service.py", line 448, in _list
  File "build/bdist.macosx-10.6-universal/egg/googlecl/calendar/service.py", line 252, in get_calendar_user_list
  File "build/bdist.macosx-10.6-universal/egg/googlecl/base.py", line 212, in get_entries
TypeError: cannot concatenate 'str' and 'type' objects

Original comment by sufian.s...@gmail.com on 6 Oct 2010 at 1:07

GoogleCodeExporter commented 9 years ago
You seem to have a calendar that makes Gdata violate the AtomPub protocol. 
Congrats! I didn't think that was possible.

I'll write up a patch for this soon.

Out of curiosity, what are the names of your calendars? Do you have any weird 
settings on them?

Original comment by tom.h.mi...@gmail.com on 6 Oct 2010 at 2:58

GoogleCodeExporter commented 9 years ago
Calendar names are: Personal, Work, Tasks, PAC, DCM. Nope, no weird settings, 
in fact, all calendars have the default settings applied.

Original comment by sufian.s...@gmail.com on 6 Oct 2010 at 3:13

GoogleCodeExporter commented 9 years ago
Apply debug_missing_title_full.patch to the original source code from the 
tarball, or debug_missing_title_incr.patch to the source code you patched with 
the patch attached in comment 3.

Now you should get the calendar ID of the offending calendar. If you can, 
please post the output again -- the gdata team may be interested in this issue.

Anyway, you should be able to use --cal again, albeit without the calendar that 
is causing the crash.

Original comment by thmil...@google.com on 6 Oct 2010 at 4:40

Attachments:

GoogleCodeExporter commented 9 years ago
OK, this is interesting. I applied the debug_missing_title_incr.patch, ran the 
command again and get no errors!

Original comment by sufian.s...@gmail.com on 6 Oct 2010 at 5:25

GoogleCodeExporter commented 9 years ago
Not even print statements starting with "===" or "Calendar with no title!"? The 
patch should let your operations run to completion, but spit out the calendar 
id of the calendar that was causing the crash.

Original comment by thmil...@google.com on 6 Oct 2010 at 4:59

GoogleCodeExporter commented 9 years ago
I'm getting the expected output.  When using --verbose I do get the print 
statements...I no longer get that NoneType error report or files/line numbers.

$ google calendar today --cal ".*" --verbose
Gdata will be imported from /Library/Python/2.6/site-packages/gdata/__init__.pyc
Your pythonpath: None
Initialized googlecl.service.BaseServiceCL
Loaded token from file
Token valid!
===uri: /calendar/feeds/default/allcalendars/full?max-results=10000
===title: .*
===using regex
Retrieved 5 entries, returning 5 of them

[Personal]
===uri: [redacted]
===title: None
Retrieved 1 entries, returning them all
[redacted]

[DCM]
===uri: [redacted]
===title: None
Retrieved 0 entries, returning them all

[Work]
===uri: [redacted]
===title: None
Retrieved 0 entries, returning them all

[PAC]
===uri: [redacted]
===title: None
Retrieved 2 entries, returning them all
[redacted]
[redacted]

[Tasks]
===uri: [redacted]
===title: None
Retrieved 0 entries, returning them all

Original comment by sufian.s...@gmail.com on 6 Oct 2010 at 6:20

GoogleCodeExporter commented 9 years ago
Very, very weird. They must have fixed the bug server-side.

Well, you should be alright using the non-patched version now.

Original comment by thmil...@google.com on 6 Oct 2010 at 6:23