Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seeing a backtrace #7

Open
acdha opened this issue May 20, 2015 · 3 comments
Open

Seeing a backtrace #7

acdha opened this issue May 20, 2015 · 3 comments

Comments

@acdha
Copy link
Member

acdha commented May 20, 2015

From @GoogleCodeExporter on May 20, 2015 16:39

Oct  2 04:29:02 pluto org.crankd.plist[58620]: INFO: NSWorkspace Notification 
NSWorkspaceDidWakeNotification: executing /bin/echo "The system woke from 
sleep!"
Oct  2 04:29:02 pluto org.crankd.plist[58620]: Traceback (most recent call 
last):
Oct  2 04:29:02 pluto org.crankd.plist[58620]:   File 
"/usr/local/sbin/crankd.py", line 597, in <module>
Oct  2 04:29:02 pluto org.crankd.plist[58620]:     main()
Oct  2 04:29:02 pluto org.crankd.plist[58620]:   File 
"/usr/local/sbin/crankd.py", line 523, in main
Oct  2 04:29:02 pluto org.crankd.plist[58620]:     
AppHelper.runConsoleEventLoop(installInterrupt=True)
Oct  2 04:29:02 pluto org.crankd.plist[58620]:   File 
"/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/PyOb
jC/PyObjCTools/AppHelper.py", line 178, in runConsoleEventLoop
Oct  2 04:29:02 pluto org.crankd.plist[58620]:     if not 
runLoop.runMode_beforeDate_(mode, nextfire):
Oct  2 04:29:02 pluto org.crankd.plist[58620]:   File 
"/usr/local/sbin/crankd.py", line 110, in onNotification_
Oct  2 04:29:02 pluto org.crankd.plist[58620]:     
self.callable(user_info=user_info) # pylint: disable-msg=E1101
Oct  2 04:29:02 pluto org.crankd.plist[58620]:   File 
"/usr/local/sbin/crankd.py", line 558, in do_shell
Oct  2 04:29:02 pluto org.crankd.plist[58620]:     for k, v in 
kwargs['user_info'].items():
Oct  2 04:29:02 pluto org.crankd.plist[58620]: AttributeError: 'NoneType' 
object has no attribute 'items'

Original issue reported on code.google.com by [email protected] on 2 Oct 2011 at 8:36

Copied from original issue: #7

@acdha
Copy link
Member Author

acdha commented May 20, 2015

From @GoogleCodeExporter on May 20, 2015 16:39

I'm no python expert, but I inserted a line as follows and it works.


$ diff -Naur crankd.py.orig crankd.py
--- crankd.py.orig  2012-01-11 21:01:38.000000000 +0800
+++ crankd.py   2012-01-11 20:30:16.000000000 +0800
@@ -557,8 +557,9 @@
             child_env['CRANKD_%s' % k.upper()] = str(kwargs[k])

     if 'user_info' in kwargs:
-   for k, v in kwargs['user_info'].items():
-       child_env[create_env_name(k)] = str(v)
+        if kwargs['user_info'] is not None:
+       for k, v in kwargs['user_info'].items():
+           child_env[create_env_name(k)] = str(v)

     try:
         rc = call(command, shell=True, env=child_env)

Original comment by [email protected] on 11 Jan 2012 at 1:02

@acdha
Copy link
Member Author

acdha commented May 20, 2015

From @GoogleCodeExporter on May 20, 2015 16:39

in that case I think the right fix is to replace `if 'user_info' in kwargs` 
with `if kwargs.get('user_info')`.

Original comment by [email protected] on 11 Jan 2012 at 1:13

@acdha
Copy link
Member Author

acdha commented May 20, 2015

From @GoogleCodeExporter on May 20, 2015 16:39

I went with something similar to handle the case where user_info is present but 
None: 

https://github.com/acdha/pymacadmin/commit/533b6c4c4379f0632e2fdebfbe115f9880cb4
cab

Original comment by [email protected] on 11 Jan 2012 at 1:42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant