Permalink
Browse files

Fixed 2 code mistakes in examples + embetterment

  • Loading branch information...
fuho committed Dec 16, 2012
1 parent 01a4d2f commit 4c3672df1fe4d624501256ae690f6bfd965e7be9
Showing with 7 additions and 7 deletions.
  1. +7 −7 worker/languages/python/index.md
@@ -64,18 +64,18 @@ parse it as JSON.
In your worker:
{% highlight python %}
-payload = None
+import sys, json
+
payload_file = None
+payload = None
+
for i in range(len(sys.argv)):
if sys.argv[i] == "-payload" and (i + 1) < len(sys.argv):
- payload_file = sys.argv[i]
+ payload_file = sys.argv[i + 1]
+ with open(payload_file,'r') as f:
+ payload = json.loads(f.read())
break
-f = open(payload_file, "r")
-contents = f.read()
-f.close()
-
-payload = json.loads(contents)
{% endhighlight %}
### Environment

0 comments on commit 4c3672d

Please sign in to comment.