Thursday, April 23, 2009

bad day programming

You know you've had a bad day programming when, at the end of the day, you find yourself manually editing the text of a file that looks like this...


The amazing thing is that the edit worked!

For potential fellow sufferers:
  • On a Mac, the urllib2.py Python module guesses about your proxy configuration by looking at the file here on the right called com.apple.internetconfig.plist (in /User/you/Library/Preference/)
  • If you are having a problem creating connections with urllib2 , try having a look at what proxies it thinks exist like this: 
>>> import urllib2
>>> urllib2.getproxies() 

  • If it comes back with something unexpected like 'http://evil.proxy.bug:8080' then you will need to get rid of that offending string in the com.apple.internetconfig.plist file.  The file will open and look a little prettier in the plist editor; however the editor has no search function and I couldn't find the string - which I knew to be there - anywhere.  In the end I just opened it in Emacs, found it, zapped it, and prayed that I hadn't hurt anything in the process.  Sometimes that works...

blog comments powered by Disqus