content
stringlengths
85
101k
title
stringlengths
0
150
question
stringlengths
15
48k
answers
list
answers_scores
list
non_answers
list
non_answers_scores
list
tags
list
name
stringlengths
35
137
Q: How to use more than one condition in Python for loop? How to use more than one condition in Python for loop? for example in java: int[] n={1,2,3,4,6,7}; for(int i=0;i<n.length && i<5 ;i++){ //do sth } How dose the python for loop do this? A: The Python for loop does not, itself, have any supp...
How to use more than one condition in Python for loop?
How to use more than one condition in Python for loop? for example in java: int[] n={1,2,3,4,6,7}; for(int i=0;i<n.length && i<5 ;i++){ //do sth } How dose the python for loop do this?
[ "The Python for loop does not, itself, have any support for this. You can get the same effect using a break statement:\nn = [1, 2, 3, 4, 6, 7]\n\nfor i in n:\n if i >= 5:\n break\n # do something with i\n\nIn Python, a for is really a foreach that iterates over some \"iterator\" or some \"iterable obj...
[ 27, 13, 7, 5, 3, 2, 0 ]
[]
[]
[ "python" ]
stackoverflow_0006839542_python.txt
Q: python sockets on Mac OS X gives AttributeError: 'module' object has no attribute 'IF_INET' I am trying out some python network programming on Mac OS X 10.6. I am using Python 2.7 as installed by Homebrew, and am attempting to run a simple script from Foundations Of Python Network Programming (great book btw) that...
python sockets on Mac OS X gives AttributeError: 'module' object has no attribute 'IF_INET'
I am trying out some python network programming on Mac OS X 10.6. I am using Python 2.7 as installed by Homebrew, and am attempting to run a simple script from Foundations Of Python Network Programming (great book btw) that contains a UDP client and server, but am getting the aforementioned AttribuiteError when trying ...
[ "I took a look at the Python source. On some platforms, AF_INET is defined in SOCKET.py or IN.py, which is automatically generated from /usr/include/sys/socket.h or something similar.\nI couldn't actually see where this was defined for OSX, but it's possible something weird is going on in your version.\nBy far the ...
[ 6 ]
[]
[]
[ "homebrew", "macos", "python", "sockets", "udp" ]
stackoverflow_0006839568_homebrew_macos_python_sockets_udp.txt
Q: google app engine, python , unicode, email, mail api I'm using an open source web service python application to send email through GAE but if the name or email body contains Arabic or Hebrew characters the application throws some errors (e.g "The indicated parameters are not valid"). Therefore I need to know how t...
google app engine, python , unicode, email, mail api
I'm using an open source web service python application to send email through GAE but if the name or email body contains Arabic or Hebrew characters the application throws some errors (e.g "The indicated parameters are not valid"). Therefore I need to know how to fix this issue. I have to note that I'm a Python beginne...
[ "mail_to = str(self.request.POST.get('to'))\nmail_from = str(self.request.POST.get('from'))\nmail_subject = str(self.request.POST.get('subject'))\nmail_plain = str(self.request.POST.get('plain'))\nmail_html = str(self.request.POST.get('html'))\n\nI doubt you need to convert them to strings. Try without str(), it co...
[ 0 ]
[]
[]
[ "google_app_engine", "python", "unicode" ]
stackoverflow_0006836940_google_app_engine_python_unicode.txt
Q: Django runserver, import fails - project name capitalized? When starting up django today with run server, which worked fine so far. Traceback (most recent call last): File "manage.py", line 14, in <module> execute_manager(settings) File "/Users/cwoebker/Projects/mysite/lib/python2.7/site-packages/django/co...
Django runserver, import fails - project name capitalized?
When starting up django today with run server, which worked fine so far. Traceback (most recent call last): File "manage.py", line 14, in <module> execute_manager(settings) File "/Users/cwoebker/Projects/mysite/lib/python2.7/site-packages/django/core/management/__init__.py", line 436, in execute_manager set...
[ "what does 'pwd' tell you on the shell? mac osx is by default not case sensitive, so maybe you changed into the directory using cd MYSITE, and sometimes django simply looks at the current directory (which would be MYSITE depending on how you accessed it on the command line) and trys to import it if there is an __in...
[ 1, 1 ]
[]
[]
[ "django", "macos", "python" ]
stackoverflow_0006840119_django_macos_python.txt
Q: How do I include and link pysvn with my python script? I am working on a tool that uses pysvn. The previous writer of the tool included pysvn1.4 with it, so that it could be used on any machine that had python, without needing to download or install pysvn. I would like to update the tool to use pysvn 1.6. What I h...
How do I include and link pysvn with my python script?
I am working on a tool that uses pysvn. The previous writer of the tool included pysvn1.4 with it, so that it could be used on any machine that had python, without needing to download or install pysvn. I would like to update the tool to use pysvn 1.6. What I have done so far is installed pysvn1.6 on my machine, and mov...
[ "pysvn is definitely one of the stranger modules to build. This is how I have succesfully built and used pysvn. The environment variable TARG is set to the Python install directory.\ncd ~\nwget http://pysvn.barrys-emacs.org/source_kits/pysvn-1.7.5.tar.gz\ntar zxvf pysvn-1.7.5.tar.gz\ncd pysvn-1.7.5/Source\npython s...
[ 3 ]
[]
[]
[ "pysvn", "python", "svn" ]
stackoverflow_0006837384_pysvn_python_svn.txt
Q: Python class function default variables are class objects? I was writing some code this afternoon, and stumbled across a bug in my code. I noticed that the default values for one of my newly created objects was carrying over from another object! For example: class One(object): def __init__(self, my_list=[]): ...
Python class function default variables are class objects?
I was writing some code this afternoon, and stumbled across a bug in my code. I noticed that the default values for one of my newly created objects was carrying over from another object! For example: class One(object): def __init__(self, my_list=[]): self.my_list = my_list one1 = One() print(one1.m...
[ "This is a known behaviour of the way Python default values work, which is often surprising to the unwary. The empty array object [] is created at the time of definition of the function, rather than at the time it is called.\nTo fix it, try:\ndef __init__(self, my_list=None):\n if my_list is None:\n my_li...
[ 10, 4, 3, 3, 2, 1 ]
[]
[]
[ "python" ]
stackoverflow_0006838255_python.txt
Q: what's wrong with my python code in google app engine? [send an email] I want to send an email by using the URL query var ['f'] ['t'] ['s'] ['c']. By when i launch the code in googl app engine, i see Error: Server Error The server encountered an error and could not complete your request. If the problem persists...
what's wrong with my python code in google app engine? [send an email]
I want to send an email by using the URL query var ['f'] ['t'] ['s'] ['c']. By when i launch the code in googl app engine, i see Error: Server Error The server encountered an error and could not complete your request. If the problem persists, please report your problem and mention this error message and the query ...
[ "Log in to your admin console at appengine.google.com, click on your app, and click on 'logs'. This page shows log records for all your requests, and this is where exceptions are logged - not to the page returned to the user, for security and usability reasons. The exception log on that page ought to tell you what ...
[ 1 ]
[]
[]
[ "google_app_engine", "programming_languages", "python", "syntax" ]
stackoverflow_0006840379_google_app_engine_programming_languages_python_syntax.txt
Q: python user permissions I have a question related to user permissions in python. I have a project that uses the file system to store information about specific tasks. Of course this can be edited/deleted if user wants to. Now say a user starts the program using sudo sh start.sh. He then does some operations and da...
python user permissions
I have a question related to user permissions in python. I have a project that uses the file system to store information about specific tasks. Of course this can be edited/deleted if user wants to. Now say a user starts the program using sudo sh start.sh. He then does some operations and data is stored. Now if anyone e...
[ "Looks like you need os.fchown().\nI don't know what you mean by your second question - do you want to ask for a root password and use it to gain access to a file that the normal user wouldn't have access to?\n" ]
[ 1 ]
[]
[]
[ "python" ]
stackoverflow_0006840746_python.txt
Q: What is "\00" in Python? What does "\00" mean in Python? To learn more about this, I tried following: When I assign d="\00" and call print d, nothing displays on the screen. I also tried assigning d to a string with extra spacing between and at the end and then called d.replace("\00", ""), but no result was evide...
What is "\00" in Python?
What does "\00" mean in Python? To learn more about this, I tried following: When I assign d="\00" and call print d, nothing displays on the screen. I also tried assigning d to a string with extra spacing between and at the end and then called d.replace("\00", ""), but no result was evident. What does d.replace("\00...
[ "In Python 2, when a number starts with a leading zero, it means it's in octal (base 8). In Python 3 octal literals start with 0o instead. 00 specifically is 0. \nThe leading \\ in \\00 is a way of specifying a byte value, a number between 0-255. It's normally used to represent a character that isn't on your keyboa...
[ 21, 12 ]
[]
[]
[ "escaping", "null", "python", "syntax" ]
stackoverflow_0006840876_escaping_null_python_syntax.txt
Q: Extend python/django with c and mod_wsgi with apache I have a question about extending python with c code and mod_wsgi. I have a django app in an apache server that query a postgresql database to generate reports. In some reports the system creates a csv file with the results. To create this csv file, some times t...
Extend python/django with c and mod_wsgi with apache
I have a question about extending python with c code and mod_wsgi. I have a django app in an apache server that query a postgresql database to generate reports. In some reports the system creates a csv file with the results. To create this csv file, some times the system must process more than two hundred thousands reg...
[ "Try setting:\nWSGIApplicationGroup %{GLOBAL}\n\nand forcing the application to run in main Python interpreter.\nPossible your C extension isn't written properly to work with Python sub interpreters.\nSee:\nhttp://code.google.com/p/modwsgi/wiki/ApplicationIssues#Python_Simplified_GIL_State_API\nYour code could also...
[ 2 ]
[]
[]
[ "apache", "c", "django", "mod_wsgi", "python" ]
stackoverflow_0006840486_apache_c_django_mod_wsgi_python.txt
Q: Creating a new list from elements of an other list, referencing the elements of the latter I want to create a new list from a previous one's elements, but without copying them. That is what happens: In [23]: list = range(10) In [24]: list2 = list[0:4] In [25]: list Out[25]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] In [26...
Creating a new list from elements of an other list, referencing the elements of the latter
I want to create a new list from a previous one's elements, but without copying them. That is what happens: In [23]: list = range(10) In [24]: list2 = list[0:4] In [25]: list Out[25]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] In [26]: list2 Out[26]: [0, 1, 2, 3] Though the elements of the lists seem to have the same id, In [2...
[ "Anywhere 1 or another small number is in a variable, it will always have the same id. These numbers only exist once, and since they're immutable, it's safe for them to be referenced everywhere.\nUsing slice syntax [:] always makes a copy.\nWhen you set list1[1], you're not changing the value of what's stored in me...
[ 3, 1 ]
[]
[]
[ "list", "python" ]
stackoverflow_0006841206_list_python.txt
Q: A Java guy asks: why should I learn Python? There's a risk that this either comes across as a language-troll or a failure to do a basic Google search; rest assured it's not the former, and hopefully not the latter. Anyway, as a big-corporate Java developer (SE and EE) i'm feeling my skills go a bit stale, and i'm ...
A Java guy asks: why should I learn Python?
There's a risk that this either comes across as a language-troll or a failure to do a basic Google search; rest assured it's not the former, and hopefully not the latter. Anyway, as a big-corporate Java developer (SE and EE) i'm feeling my skills go a bit stale, and i'm aware that for many years there's been some excit...
[ "Honestly, if you don't see the reason to learn a new language, don't. If you ever get to need it, and you're a competent programmer, you can pick it up in a couple of days and be proficient in a month. Learning a new language without the intent to use it in the near future is like learning how to swordfight: fin...
[ 7, 4 ]
[]
[]
[ "python" ]
stackoverflow_0006841286_python.txt
Q: Is there a mysql unix_timestamp function in SQLAlchemy? Let me keep it simple , Is there a mysql function unix_timestamp(datetime) in SQLAlchemy ? or is there any workaround ? A: SQLAlchemy has support for arbitrary SQL functions. See http://www.sqlalchemy.org/docs/core/tutorial.html#functions. from sqlalchemy.s...
Is there a mysql unix_timestamp function in SQLAlchemy?
Let me keep it simple , Is there a mysql function unix_timestamp(datetime) in SQLAlchemy ? or is there any workaround ?
[ "SQLAlchemy has support for arbitrary SQL functions. See http://www.sqlalchemy.org/docs/core/tutorial.html#functions.\nfrom sqlalchemy.sql import func\n\nfor row in conn.execute(select([func.unix_timestamp(\"a_datetime_column\")], ...)):\n # ...\n\n" ]
[ 5 ]
[]
[]
[ "mysql", "python", "sqlalchemy" ]
stackoverflow_0006841178_mysql_python_sqlalchemy.txt
Q: How transmit python's string to js script I try to use module json for this, but js script and firebug get errors. Example. I have this line: {"fruit":{"apple":100}} i try send it to js script called jquery.ocupload-1.1.2.js for build selectors. And i get what all " become &#34; and i have an error: 'Unexpected t...
How transmit python's string to js script
I try to use module json for this, but js script and firebug get errors. Example. I have this line: {"fruit":{"apple":100}} i try send it to js script called jquery.ocupload-1.1.2.js for build selectors. And i get what all " become &#34; and i have an error: 'Unexpected token &' And then i try json.dumps its escapes ...
[ "No, this is not true. \n>>> import json\n>>> json.dumps({\"fruit\":{\"apple\":100}})\n'{\"fruit\": {\"apple\": 100}}'\n\nSo you are clearly doing something else, which you haven't stated in your question.\n" ]
[ 1 ]
[]
[]
[ "javascript", "json", "mako", "python" ]
stackoverflow_0006841704_javascript_json_mako_python.txt
Q: numerical calculations with the items in a list I am back again with another python query. I have been trying to do some calculations with the items present in a list. Here is the code: import math def Usage() : print "Usage :python beznew.py transcriptionsFile" if __name__ == "__main__" : if len(sys.ar...
numerical calculations with the items in a list
I am back again with another python query. I have been trying to do some calculations with the items present in a list. Here is the code: import math def Usage() : print "Usage :python beznew.py transcriptionsFile" if __name__ == "__main__" : if len(sys.argv) != 2 : Usage() else : tran...
[ "First, don't use list as a variable name. Every time you do that, a kitten dies.\nSecond, you should convert the strings you've extracted from your file to a number, preferably a Decimal if you value the precision. Currently you're trying to divide a string.\nThird, nanoseconds are billionths of a second, not mill...
[ 5, 1, 1, 0 ]
[]
[]
[ "python" ]
stackoverflow_0006841455_python.txt
Q: How can I make array C with the indices of non-infinite numbers of array A in Python 2.7? Array A looks like this: [1, -inf, 2, 3, inf, -60.2] Array C should look like this: [0, 2, 3, 5] How can I make array C with the indices of non-infinite numbers of array A in Python 2.7? A: inf = float('inf') a = [1, -i...
How can I make array C with the indices of non-infinite numbers of array A in Python 2.7?
Array A looks like this: [1, -inf, 2, 3, inf, -60.2] Array C should look like this: [0, 2, 3, 5] How can I make array C with the indices of non-infinite numbers of array A in Python 2.7?
[ "inf = float('inf')\na = [1, -inf, 2, 3, inf, -60.2]\nc = [i for i, v in enumerate(a) if abs(v) != inf]\n\n", "If by \"array\" you mean \"numpy array\":\nIn [12]: import numpy as np\n\nIn [13]: a = np.array([1, -np.inf, 2, 3, np.inf, -60.2])\n\nIn [14]: np.where(~np.isinf(a))[0]\nOut[14]: array([0, 2, 3, 5])\n\n"...
[ 4, 0 ]
[]
[]
[ "arrays", "find", "infinity", "python" ]
stackoverflow_0006842149_arrays_find_infinity_python.txt
Q: accessing "module scope" vars I'm currently learning Python, and I have to work on a Python 2.7 project. Accessing "module scope" variables in functions of the module itself is a bit confusing for me, and I didn't succeed in finding a satisfying way. My attempts so far: Way 1: my_module.py my_global_var = None de...
accessing "module scope" vars
I'm currently learning Python, and I have to work on a Python 2.7 project. Accessing "module scope" variables in functions of the module itself is a bit confusing for me, and I didn't succeed in finding a satisfying way. My attempts so far: Way 1: my_module.py my_global_var = None def my_func(): global my_global_v...
[ "You probably want to read up on Python's namespaces. Way 1 is correct but generally unnecessary, never use 2. An easier approach is to just use a dict (or class or some other object):\nmy_globals = {'var': None}\n\ndef my_func():\n my_globals['var'] = 'something else'\n\nAssignments always go into the innermost...
[ 26, 4, 3, 1 ]
[]
[]
[ "coding_style", "module", "python", "scope", "variables" ]
stackoverflow_0006841853_coding_style_module_python_scope_variables.txt
Q: Selecting specific array positions in Python sorry for the easy question but I'm new to Python. I have a set of points with these coordinates: x=part.points[:,0] y=part.points[:,1] z=part.points[:,2] And I'd like to select only the points with z>0.5 and z<0.6. I guess I have to use a where operator but it doesn't...
Selecting specific array positions in Python
sorry for the easy question but I'm new to Python. I have a set of points with these coordinates: x=part.points[:,0] y=part.points[:,1] z=part.points[:,2] And I'd like to select only the points with z>0.5 and z<0.6. I guess I have to use a where operator but it doesn't work. I mean when I type import numarray I get t...
[ "Here is how it can be done with numpy:\nIn [34]: import numpy as np\n\nIn [35]: points = np.random.rand(100, 3)\n\nIn [36]: points[(0.5 < points[:,2]) & (points[:,2] < 0.6)]\nOut[36]: \narray([[ 0.71524853, 0.09490989, 0.5053525 ],\n [ 0.71668105, 0.88735685, 0.52713089],\n [ 0.17376858, 0.2802436...
[ 1, 0 ]
[]
[]
[ "arrays", "python", "where" ]
stackoverflow_0006842242_arrays_python_where.txt
Q: Extracting expression I have a expression and I want to extract it in python 2.6. Here is the example: [a]+[c]*0.6/[b]-([a]-[f]*0.9) this going to: ( '[a]', '+', '[c]', '*', '0.6', '/', '[b]', '-', '(', '[a]', '-', '[f]', '*', '0.9', ')', ) I need it a list. Please give me a hand. T...
Extracting expression
I have a expression and I want to extract it in python 2.6. Here is the example: [a]+[c]*0.6/[b]-([a]-[f]*0.9) this going to: ( '[a]', '+', '[c]', '*', '0.6', '/', '[b]', '-', '(', '[a]', '-', '[f]', '*', '0.9', ')', ) I need it a list. Please give me a hand. Thanks.
[ ">>> import re\n>>> expr = '[a]+[c]*0.6/[b]-([a]-[f]*0.9)'\n>>> re.findall('(?:\\[.*?\\])|(?:\\d+\\.*\\d*)|.', expr)\n['[a]', '+', '[c]', '*', '0.6', '/', '[b]', '-', '(', '[a]', '-', '[f]', '*', '0.9', ')']\n\n", "One approach would be to create a list of regular expressions to match each token, something like:\...
[ 1, 1 ]
[]
[]
[ "expression", "extract", "python", "regex", "text_extraction" ]
stackoverflow_0006842142_expression_extract_python_regex_text_extraction.txt
Q: Twisted - send data from a server to client I am new to Twisted, and have read many related posts similar to the problem that I have. However, I am unable to extrapolate the previous answers to solve my simple problem. I did refer to the FAQ section of Twisted - I still can't figure out. My problem is that I have ...
Twisted - send data from a server to client
I am new to Twisted, and have read many related posts similar to the problem that I have. However, I am unable to extrapolate the previous answers to solve my simple problem. I did refer to the FAQ section of Twisted - I still can't figure out. My problem is that I have a server listening at one port, and when I receiv...
[ "class FakeTelnet(Protocol):\n def connectionMade(self):\n print 'local connection made'\n self.otherFact = protocol.ClientFactory()\n self.otherFact.protocol = EchoClient\n\nHere, you set self.otherFact.protocol to be the EchoClient class.\n self.factory.clients.append(self.otherFact...
[ 5 ]
[]
[]
[ "python", "twisted" ]
stackoverflow_0006793086_python_twisted.txt
Q: Generating tokens in Python Possible Duplicate: Is there a good Python library that can parse C++? I want Python to scan through a file (a .cpp file) and generate tokens from it using the in-built Python tokeniser.How can this be achieved? A: The built-in tokenizer and ast stuff is for parsing Python, not othe...
Generating tokens in Python
Possible Duplicate: Is there a good Python library that can parse C++? I want Python to scan through a file (a .cpp file) and generate tokens from it using the in-built Python tokeniser.How can this be achieved?
[ "The built-in tokenizer and ast stuff is for parsing Python, not other languages like C++.\nYou may want to look at GCC-XML.\n" ]
[ 0 ]
[]
[]
[ "python" ]
stackoverflow_0006843021_python.txt
Q: Python indentation confusion, using 4 space tabs I've got this little script: filters = [] pipes = [] check_environment() config() fix_syslog() make_fifo() def check_environment(): # check python # check for syslog # check for mknod # check for root privileges def config(): accepted_filters ...
Python indentation confusion, using 4 space tabs
I've got this little script: filters = [] pipes = [] check_environment() config() fix_syslog() make_fifo() def check_environment(): # check python # check for syslog # check for mknod # check for root privileges def config(): accepted_filters = ['auth', 'authpriv', 'daemon', 'cron', 'ftp', 'lpr',...
[ "An indented block of code is expected after a function definition:\ndef check_environment():\n # check python\n # check for syslog\n # check for mknod\n # check for root privileges\n\ndef config():\n # .. code\n\nThere are only comments and no code after the def check_environment():. This explains t...
[ 8, 3, 2 ]
[]
[]
[ "indentation", "python" ]
stackoverflow_0006843217_indentation_python.txt
Q: from php curl to python urllib (POST to Upload API Problem) I tried to convert a php api code to python: This is the php code: // Variables to Post $local_file = "/path/to/file"; $file_to_upload = array( 'file'=>'@'.$local_file, 'convert'=>'1', 'user'=>'YOUR_USERNAME', 'password'=>'YOUR_PASSWORD' ); // Do C...
from php curl to python urllib (POST to Upload API Problem)
I tried to convert a php api code to python: This is the php code: // Variables to Post $local_file = "/path/to/file"; $file_to_upload = array( 'file'=>'@'.$local_file, 'convert'=>'1', 'user'=>'YOUR_USERNAME', 'password'=>'YOUR_PASSWORD' ); // Do Curl Request $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,'htt...
[ "There is no simple way to upload a file using multipart/form-data encoding.\nThere are some snippets you can use, though:\n[http://pymotw.com/2/urllib2/index.html#module-urllib2]\n[http://code.activestate.com/recipes/146306-http-client-to-post-using-multipartform-data/]\nA simpler way would be to use a library.\nS...
[ 1, 1, 0 ]
[]
[]
[ "curl", "python", "urllib" ]
stackoverflow_0006838088_curl_python_urllib.txt
Q: Using dictionaries in Mako templates Instead of passing variables to a template like so: template.render(var1='hello', var2='world') How can I pass a dictionary to the template and have it render in the same manner vars = {'var1': 'hello', 'var2': 'world'} so in the template I can display the variables as normal...
Using dictionaries in Mako templates
Instead of passing variables to a template like so: template.render(var1='hello', var2='world') How can I pass a dictionary to the template and have it render in the same manner vars = {'var1': 'hello', 'var2': 'world'} so in the template I can display the variables as normal: ${var1} ${var2} I don't want any extra ...
[ "I don't know mako, but to use a dict as keyword arguments (or kwargs), you have to prepend two *:\ntemplate.render(**vars)\n\n" ]
[ 11 ]
[]
[]
[ "mako", "python" ]
stackoverflow_0006843428_mako_python.txt
Q: Python Tkinker events I would want to use time to enable event's callback function in Tkinter. How do I do something like this using Tkinter ftime = time() while 1: if ftime - time() > 2000: dosomething ftime = time() Note that all I wanted is being able to use time passed to call callback fu...
Python Tkinker events
I would want to use time to enable event's callback function in Tkinter. How do I do something like this using Tkinter ftime = time() while 1: if ftime - time() > 2000: dosomething ftime = time() Note that all I wanted is being able to use time passed to call callback function Janus
[ "You can use the Tkinter method after to schedule a command to run after a given number of milliseconds. That's considerably better than implementing a tight loop. Remember: the event loop is already an infinite loop, nesting a long running loop inside it causes performance problems. \nIf you want something to be c...
[ 0 ]
[]
[]
[ "python", "tkinter" ]
stackoverflow_0006840797_python_tkinter.txt
Q: Solving thread cleanup on paramiko I have an automated process using paramiko and have this error: Exception in thread Thread-1 (most likely raised during interpreter shutdown) .... .... <type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'error' I understand that is a problem in the cleanu...
Solving thread cleanup on paramiko
I have an automated process using paramiko and have this error: Exception in thread Thread-1 (most likely raised during interpreter shutdown) .... .... <type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'error' I understand that is a problem in the cleanup/threading, but I don't know how to fix...
[ "__del__ is not a deconstructor. It's called when you delete a object's last name, which doesn't nessesarily happen when you exit the interpreter. \nAnything that manages a context, such as connections, is a context manager For example there is closing:\nwith closing(make_connection()) as conn:\n dostuff()\n\n# ...
[ 7, 1, 1 ]
[]
[]
[ "paramiko", "python", "ssh" ]
stackoverflow_0001745232_paramiko_python_ssh.txt
Q: threading.py._release_save & socket.py.accept cpu time I'm creating an app of which I like to limit its resource footprint as much as possible. I noticed my app is consuming by average 4% cpu usage on a low load and although that doesn't necessarily mean a bad thing, I was wondering where exactly this comes from. ...
threading.py._release_save & socket.py.accept cpu time
I'm creating an app of which I like to limit its resource footprint as much as possible. I noticed my app is consuming by average 4% cpu usage on a low load and although that doesn't necessarily mean a bad thing, I was wondering where exactly this comes from. I started to use a profiling software (yappi) and while all ...
[ "Timings for the blocking calls in profilers are not very meaningful. When a blocking call is made that thread is suspended and other threads run, when blocking call returns back the time spent in other threads is also added to the total time of the called function. See this: Multithreaded Statistics for Yappi\nUpd...
[ 0 ]
[]
[]
[ "multithreading", "performance", "profiling", "python" ]
stackoverflow_0005541382_multithreading_performance_profiling_python.txt
Q: Python - Iteration over nested lists I'm stuck on a small but tricky problem since yesterday. What I have is a (possibly infinitely) nested list like this: [1,[2,[3,4]]] or [[1,2],[3,4]] and so on. On each level the lists consist of two sublists, (I didn't use tuples because the lists will probably get arbitrary...
Python - Iteration over nested lists
I'm stuck on a small but tricky problem since yesterday. What I have is a (possibly infinitely) nested list like this: [1,[2,[3,4]]] or [[1,2],[3,4]] and so on. On each level the lists consist of two sublists, (I didn't use tuples because the lists will probably get arbitrary length in the next step) Now I want to in...
[ "I'd use a generator:\ndef gen_trees(nwklist, newid):\n yield [newid] + [nwklist]\n if isinstance(nwklist, list):\n for i in xrange(len(nwklist)):\n for l in gen_trees(nwklist[i], newid):\n yield nwklist[:i] + [l] + nwklist[i+1:]\n yield [nwklist] + [newid]\n\nfor l in gen_trees([1,[2,[3,4]]] , 5)...
[ 2 ]
[]
[]
[ "bioinformatics", "combinatorics", "list", "nested", "python" ]
stackoverflow_0006844067_bioinformatics_combinatorics_list_nested_python.txt
Q: Python auto completion in Xcode 4 I'm using Xcode 4 to write python scripts (stackoverflow.com/questions/5276967/python-in-xcode-4) I'm wondering if there's a way to get auto completion in Xcode 4. Is there a way to set up a python path, so that I can't point xcode to my custom python modules and get those to be s...
Python auto completion in Xcode 4
I'm using Xcode 4 to write python scripts (stackoverflow.com/questions/5276967/python-in-xcode-4) I'm wondering if there's a way to get auto completion in Xcode 4. Is there a way to set up a python path, so that I can't point xcode to my custom python modules and get those to be scanned for auto completion. I don't eve...
[ "The problem with this is that XCode just was never meant to be an IDE for python.\nTherefore XCode won't have any python specific IDE features, except maybe highlighting, without external plugins and addons.\nAs seen here \nXcode -\nMacOS X -\nFree IDE and text editor. Includes Python syntax coloring. \nthose are ...
[ 0 ]
[]
[]
[ "code_completion", "python", "scripting", "xcode" ]
stackoverflow_0006844175_code_completion_python_scripting_xcode.txt
Q: I need help with a python script I am trying to adapt for a specific need I am a total newbie with Python, I normally use Perl. I have an Arduino wired up with some servos I use to control a web cam, the script in question works perfect, the servos receive the instruction and do what they should: #!/usr/bin/en...
I need help with a python script I am trying to adapt for a specific need
I am a total newbie with Python, I normally use Perl. I have an Arduino wired up with some servos I use to control a web cam, the script in question works perfect, the servos receive the instruction and do what they should: #!/usr/bin/env python import serial usbport = '/dev/ttyACM0' # Set up serial b...
[ "Beside @combatdave's answer, on this part:\ntry:\n servo = int(sys.argv[1])\n angle = int(sys.argv[2])\nexcept IndexError:\n print ('a servo and angle are required')\nsys.exit(2)\n\n# Set up serial baud rate\n\nYou should indend sys.exit(2) too. Because of this, the program exits right after g...
[ 2, 1, 0, 0 ]
[]
[]
[ "python" ]
stackoverflow_0006845026_python.txt
Q: What is a element's reationship to its list I have a list myList=[1,2,3,4] I want to access '1' (i.e the first element of myList). myList is an instance of class/type list & has its own datamembers/attributes [1,2,3,4] so some way I must be able to access '1' with reference to myList (instance) >>>EG: myList.__da...
What is a element's reationship to its list
I have a list myList=[1,2,3,4] I want to access '1' (i.e the first element of myList). myList is an instance of class/type list & has its own datamembers/attributes [1,2,3,4] so some way I must be able to access '1' with reference to myList (instance) >>>EG: myList.__datamemeber__.iteritems() Note: I know I can do >...
[ "A list is indexed by an integer. For example, to get to its first (in Python, at index 0) item:\n>> myList[0]\n1\n\nYou can use list's index method to find the index of the given value:\n>> myList.index(1)\n0\n\nAnd you can iterate a list with enumerate to get both the index and the item:\nfor index, item in enume...
[ 2, 2, 1, 0 ]
[]
[]
[ "python" ]
stackoverflow_0006844535_python.txt
Q: Python: rsync exclusions not working in script, works in bash shell Below is a script I am using to test a problem. Running an rsync command via subprocess.check_call does not work in excluding files obtained from an exclude variable. I am printing the result of the command from Python, editing it and then running...
Python: rsync exclusions not working in script, works in bash shell
Below is a script I am using to test a problem. Running an rsync command via subprocess.check_call does not work in excluding files obtained from an exclude variable. I am printing the result of the command from Python, editing it and then running it in a bash shell directly as a comparison and it fails to exclude my e...
[ "Yes the double quotes are the problem, don't escape them, just drop them.\nThey are just required on the shell to hinder the shell from expanding.\nMoreover: If you escape them the way you've shown, they are only escaped on the python level where it makes no sense, because double quotes are automatically escaped i...
[ 4 ]
[]
[]
[ "python", "quotes", "rsync", "subprocess" ]
stackoverflow_0006844876_python_quotes_rsync_subprocess.txt
Q: App Engine Backend not working I'm having a hard time getting a backend to run on the GAE servers. The following works locally, but not when deployed: counter.py: from google.appengine.api import logservice logservice.AUTOFLUSH_ENABLED = False logging.error("Backend started!") logservice.flush() No log message i...
App Engine Backend not working
I'm having a hard time getting a backend to run on the GAE servers. The following works locally, but not when deployed: counter.py: from google.appengine.api import logservice logservice.AUTOFLUSH_ENABLED = False logging.error("Backend started!") logservice.flush() No log message is seen when deployed. I've even tri...
[ "There are three ways to call a backend service: scheduled Backend, tasked Backend and browsed Backend. Try http://counter.appname.appspot.com/path.\nSources:\n\nhttp://www.pdjamez.com/2011/05/google-app-engine-backend-patterns/\nhttp://www.pdjamez.com/2011/05/google-app-engine-backends/comment-page-1/\n\n" ]
[ 0 ]
[]
[]
[ "google_app_engine", "python" ]
stackoverflow_0006844906_google_app_engine_python.txt
Q: passing polynomial coefficients generated from one function to another Since I have been writing a big python program for my project. I have another query of which I cant figure out the solution. Here is the code. poly = [[k6,3], [k5,2], [k4,1], [k0,0]] w = 5 # weight for rational bezier curve equation def tim...
passing polynomial coefficients generated from one function to another
Since I have been writing a big python program for my project. I have another query of which I cant figure out the solution. Here is the code. poly = [[k6,3], [k5,2], [k4,1], [k0,0]] w = 5 # weight for rational bezier curve equation def time() : with open(transcriptionFile, "r") as tFile : for line ...
[ "To return the calculated results of a function or method you have to use the return statement.\nIn poly_coeff():\n...\nreturn k0, k1, k2, k3, k4, k5, k6\n\nshould do just fine. The results can be saved into variables in your time() function like this:\n...\nk0, k1, k2, k3, k4, k5, k6 = poly_coeff(start_time, end_t...
[ 1, 1 ]
[]
[]
[ "python" ]
stackoverflow_0006845551_python.txt
Q: Installing PIL on Snow Leopard Hey, i have a problem installing PIL on Snow. I have a clean installation of macports after the upgrade to SL and installed from source the jpeg library following the OS specific installation instructions. Installing PIL with pip goes well but when i try to import the _imaging modu...
Installing PIL on Snow Leopard
Hey, i have a problem installing PIL on Snow. I have a clean installation of macports after the upgrade to SL and installed from source the jpeg library following the OS specific installation instructions. Installing PIL with pip goes well but when i try to import the _imaging module i get the following message: Trac...
[ "MacPorts already has a PIL port that will do all the work for you!\nsudo port install py26-pil\n\nYou should first go into the site-packages directory and elsewhere to remove the stuff you installed manually, though. MacPorts will install all the necessary dependent libraries.\n", "PIL on Mac OS X has been a pa...
[ 3, 2, 1, 0 ]
[]
[]
[ "python", "python_imaging_library" ]
stackoverflow_0002353099_python_python_imaging_library.txt
Q: Function call using import in web2py I have split the code into multiple files. I have imported all the functions from all other files into admin.py. Lets say I want to call a function XYZ. If I give path to function as admin/XYZ it gives me error as invalid function and for this I have to give the path as file_wi...
Function call using import in web2py
I have split the code into multiple files. I have imported all the functions from all other files into admin.py. Lets say I want to call a function XYZ. If I give path to function as admin/XYZ it gives me error as invalid function and for this I have to give the path as file_with_XYZ_function/XYZ. Is there a way to ove...
[ "NOTE: This might not be answering your question as I'm not sure I understand your question... \nBut if you want to put some code into a (shared) module and include it from several of your controllers I suggest that you have a look at chapter four (The Core) of the web2py book and search for local_import.\n\nFor th...
[ 2, 0 ]
[]
[]
[ "call", "function", "import", "python", "web2py" ]
stackoverflow_0006557000_call_function_import_python_web2py.txt
Q: Convert a datetime object In Python how do I convert a datetime object like datetime.datetime(2010, 12, 18, 22, 21, 45, 277000) to something like "Sun Dec 18 2010 22:21:45 GMT+0000 (UTC)"? A: You can use strftime for this purpose. Read more here. Not sure about utc offset, but seems that you can use something li...
Convert a datetime object
In Python how do I convert a datetime object like datetime.datetime(2010, 12, 18, 22, 21, 45, 277000) to something like "Sun Dec 18 2010 22:21:45 GMT+0000 (UTC)"?
[ "You can use strftime for this purpose. Read more here.\nNot sure about utc offset, but seems that you can use something like this:\nimport datetime\nd = datetime.datetime(2010, 12, 18, 22, 21, 45, 277000)\nd.strftime(\"%a %b %d %Y %H:%M:%S %z\")\n>>> Sat Dec 18 2010 22:21:45\n\nWhere using the link above:\n\n%a - ...
[ 3 ]
[]
[]
[ "datetime", "python" ]
stackoverflow_0006846168_datetime_python.txt
Q: Can I control the GROUP BY in django 1.3's orm? I think this will best be explained with an example. Here is what the data would looks like: |project | |id|name | |1 |some project | |2 |my other project| |run | |id|project_id|start_time |result | |1 |1...
Can I control the GROUP BY in django 1.3's orm?
I think this will best be explained with an example. Here is what the data would looks like: |project | |id|name | |1 |some project | |2 |my other project| |run | |id|project_id|start_time |result | |1 |1 |1305732581845|something| |2 |1 |130...
[ "tl;dr: Django does allow you to control the group by clause but it limits it to work across all flavors of SQL so I can't do what I want.\nIt has been pointed out to me that the original query I am trying to generate with the django ORM is not actually valid for all flavors of SQL. Here is a refresher of the quer...
[ 1, 0 ]
[]
[]
[ "django", "django_orm", "mysql", "orm", "python" ]
stackoverflow_0006835355_django_django_orm_mysql_orm_python.txt
Q: django problem to compare database entries with an if statement i have the following code in my emp/views.py: @ login_required def peoples(request): list_a = [] if request.user.username == People.objects.get(account=request.user.username): angestellte_list = People.objects.all() re...
django problem to compare database entries with an if statement
i have the following code in my emp/views.py: @ login_required def peoples(request): list_a = [] if request.user.username == People.objects.get(account=request.user.username): angestellte_list = People.objects.all() return render_to_response(("emp/people.html"), {'list_a': list_a}) ...
[ "you are comparing a username (CharField) to an Person object. Try :\nif request.user == People.objects.get(...).account:\n\nor better still you could use:\nimport django.shortcuts as shortcuts\nshortcuts.get_object_or_404(People, account=request.username)\n\n", "You need to determine what the \"account\" attribu...
[ 2, 0 ]
[]
[]
[ "django", "django_views", "python" ]
stackoverflow_0006845401_django_django_views_python.txt
Q: Django VMware appliance Does anyone know of a Django 1.0 + postgresql + apache + mod_python VMware appliance? A "vanilla" Django 1.0 appliance where postgresql can be installed manually would also do. A: Configure and build your appliance at Elastic Server On-Demand. A: Another option I've had moderate success...
Django VMware appliance
Does anyone know of a Django 1.0 + postgresql + apache + mod_python VMware appliance? A "vanilla" Django 1.0 appliance where postgresql can be installed manually would also do.
[ "Configure and build your appliance at Elastic Server On-Demand.\n", "Another option I've had moderate success with\nTurnKey Linux Django Appliance\n", "In addition to the other appliances suggested, you may want to take a look at our BitNami Django Stack VMWare Appliance.\nIt is completely free and we keep it ...
[ 7, 2, 2, 0, 0 ]
[]
[]
[ "django", "python", "vmware" ]
stackoverflow_0000147627_django_python_vmware.txt
Q: Can NLTK's XMLCorpusReader be used on a multi-file corpus? I'm trying to use NLTK to do some work on the New York Times Annotated Corpus which contains an XML file for each article (in the News Industry Text Format NITF). I can parse individual documents with no problem like so: from nltk.corpus.reader import XMLC...
Can NLTK's XMLCorpusReader be used on a multi-file corpus?
I'm trying to use NLTK to do some work on the New York Times Annotated Corpus which contains an XML file for each article (in the News Industry Text Format NITF). I can parse individual documents with no problem like so: from nltk.corpus.reader import XMLCorpusReader reader = XMLCorpusReader('nltk_data/corpora/nytimes/...
[ "I'm no NLTK expert, so there may be an easier way to do this, but naively I would suggest that you use Python's glob module. It supports Unix-stle pathname pattern expansion. \nfrom glob import glob\ntexts = glob('nltk_data/corpora/nytimes/*')\n\nSo that would give you the names of the files matching the expressio...
[ 5, 4, 3 ]
[]
[]
[ "nlp", "nltk", "python", "xml" ]
stackoverflow_0006837566_nlp_nltk_python_xml.txt
Q: Python working directory messed up After having this problem: look I checked some things: When going into my virtualenv and cd ing into my django directory, i have the right directory ~/Projects/mysite/mysite when going into python: os.getcwd() returns ~/Projects/MYSITE/MYSITE the first mysite is the virtualenv ...
Python working directory messed up
After having this problem: look I checked some things: When going into my virtualenv and cd ing into my django directory, i have the right directory ~/Projects/mysite/mysite when going into python: os.getcwd() returns ~/Projects/MYSITE/MYSITE the first mysite is the virtualenv the second the django project so thats w...
[ "I have a hunch. Mac OS X's behavior with respect to case is a bit complicated. For example, using default settings on OS 10.6.6, you can create a directory MINE, which will show up as uppercase in directory listings, but will be accessible using both lower- and uppercase. So for example:\n:~/foo $ mkdir MINE\n:~/f...
[ 3 ]
[]
[]
[ "django", "python", "virtualenv", "working_directory" ]
stackoverflow_0006846606_django_python_virtualenv_working_directory.txt
Q: Choose 1 element per index randomly from list A or B in Python I have 2 lists in Python and I want to choose, for every index either an element from list A or list B. I managed to do it easily but this solution has bad performance and it doesn't seem very elegant. Can anybody sugest an alternative that doesn't rel...
Choose 1 element per index randomly from list A or B in Python
I have 2 lists in Python and I want to choose, for every index either an element from list A or list B. I managed to do it easily but this solution has bad performance and it doesn't seem very elegant. Can anybody sugest an alternative that doesn't rely in these for cycles with if's inside? I'll post the code here: def...
[ "import random\nfrom itertools import izip\n\nl1 = ['a', 'b', 'c', 'd', 'e', 'f']\nl2 = [0, 1, 2, 3, 4, 5]\n\n[random.choice(pair) for pair in izip(l1, l2)]\n# e.g. [0, 1, 'c', 3, 'e', 'f']\n\n", "You can do this in a single list comprehension like so:\nnewList = [x if randint(0,1) else y for x, y in zip(l1, l2)]...
[ 10, 1, 0, 0 ]
[]
[]
[ "list", "python", "random" ]
stackoverflow_0006846468_list_python_random.txt
Q: SWIG and Python3 Import Error I have written a library in C. I use SWIG to generate bindings for Java, Python, etc. I managed to write custom type maps for both languages and so on. I also managed to use my library (a custom protocol) and communicate with a server that I wrote in C, with a client that I wrote in J...
SWIG and Python3 Import Error
I have written a library in C. I use SWIG to generate bindings for Java, Python, etc. I managed to write custom type maps for both languages and so on. I also managed to use my library (a custom protocol) and communicate with a server that I wrote in C, with a client that I wrote in Java and, with a client that I'm wri...
[ "Does the C module generated have a PyInit__pytellapic function defined?\nThe name and profile if the module init method has changed in Python 3. If you want the exact same C-code to run under both Python 2 and Python 3 you must include both the old and the new name. See the Migrating C Extensions chapter for more ...
[ 3 ]
[]
[]
[ "python", "python_3.x", "swig" ]
stackoverflow_0006845869_python_python_3.x_swig.txt
Q: Choosing a function based on parameter types in python I have a function that is taking an arbitrary set of arguments and then choosing the correct function to process them based on the types of the arguments. My current approach is using a decorator on all of the processing functions that checks the types of the...
Choosing a function based on parameter types in python
I have a function that is taking an arbitrary set of arguments and then choosing the correct function to process them based on the types of the arguments. My current approach is using a decorator on all of the processing functions that checks the types of the arguments, and then iterating through all of the functions ...
[ "Perhaps the right way to do this is to use keyword arguments, instead of relying on the types of the arguments. That way, you don't have to decorate the little functions, just name the arguments correctly. It will also let you take advantage of Python's duck typing.\n", "It sounds like you're trying to describe ...
[ 4, 2 ]
[]
[]
[ "python" ]
stackoverflow_0006847189_python.txt
Q: Python Event Handler I am trying to implement an event handler of sort. I am try to collect sample network captures using a external process using Popen and it writes an XML file. I parse the xml file to collect what ever information I require. But I do not want to terminate the process until the number of packets...
Python Event Handler
I am trying to implement an event handler of sort. I am try to collect sample network captures using a external process using Popen and it writes an XML file. I parse the xml file to collect what ever information I require. But I do not want to terminate the process until the number of packets has reached a certain lim...
[ "django, being a web-framework, is not suited to event driven programming; it's much better suited for the usual request/response cycle of http.\nIt may make better sense to make the file-polling program a separate script, (possibly using INotify to avoid the need for frequent polling of the file), and it can then...
[ 1 ]
[]
[]
[ "django_views", "multiprocessing", "python" ]
stackoverflow_0006847336_django_views_multiprocessing_python.txt
Q: lxml removes spaces and line breaks in This small program: from lxml.html import tostring, fromstring e = fromstring(''' <html><head> <link href="/comments.css" rel="stylesheet" type="text/css"> <link href="/index.css" rel="stylesheet" type="text/css"> </head> <body> <span></span> ...
lxml removes spaces and line breaks in
This small program: from lxml.html import tostring, fromstring e = fromstring(''' <html><head> <link href="/comments.css" rel="stylesheet" type="text/css"> <link href="/index.css" rel="stylesheet" type="text/css"> </head> <body> <span></span> <span></span> </body> </html>''')...
[ "for me \nprint (tostring(e, encoding=str))\nreturns\n>>> print (tostring(e, encoding=str))\nTraceback (most recent call last):\n File \"<stdin>\", line 1, in <module>\n File \"/usr/lib/python2.7/dist-packages/lxml/html/__init__.py\", line 1493, in tostring\n encoding=encoding)\n File \"lxml.etree.pyx\", line...
[ 2, 1 ]
[]
[]
[ "html_parsing", "lxml", "python", "python_3.x" ]
stackoverflow_0006469361_html_parsing_lxml_python_python_3.x.txt
Q: override recursive method in python When I call the base class recursive method from the derived class, the recursive call is done against the derived method, instead of the base class method. How can I avoid that without modifying base class implementation (in example class A)? Here is an example class A(object):...
override recursive method in python
When I call the base class recursive method from the derived class, the recursive call is done against the derived method, instead of the base class method. How can I avoid that without modifying base class implementation (in example class A)? Here is an example class A(object): # recursive method def f(self, x...
[ "Name mangling is the tool for this job. This would look like this in your case:\nclass A(object):\n # recursive method\n def f(self, x):\n print x,\n if x < 0:\n self.__f(x+1)\n if x > 0:\n self.__f(x-1)\n if x == 0:\n print \"\"\n\n __f = f\n\nc...
[ 4, 2, 1, 1 ]
[]
[]
[ "inheritance", "overriding", "python", "recursion" ]
stackoverflow_0006846829_inheritance_overriding_python_recursion.txt
Q: automating excel with win32com on linux with wine I have a rather complex Excel 2010 file that I automate using python and win32com. For this I run windows in virtual box on an ubuntu machine. However, that same excel file solves/runs fine on Ubuntu Maverick directly using wine 1.3. Any hope of automating Excel ...
automating excel with win32com on linux with wine
I have a rather complex Excel 2010 file that I automate using python and win32com. For this I run windows in virtual box on an ubuntu machine. However, that same excel file solves/runs fine on Ubuntu Maverick directly using wine 1.3. Any hope of automating Excel on wine so I can drop the VM? Or is that just crazy tal...
[ "You'd need a Windows version of Python, not a Linux version -- I'm saying you'd have to run Python under wine as well.\nHave you tried with just a normal Windows install of Python on wine? I don't see any reason why this wouldn't work.\nThere is are numerous pages in a Google search that show Windows Python (32-bi...
[ 3 ]
[]
[]
[ "excel", "linux", "python", "win32com", "wine" ]
stackoverflow_0006847684_excel_linux_python_win32com_wine.txt
Q: python refer to class variable while passing arguments to init What I want to achieve: 1. Have a class variable keeping count of number of objects created 2. That variable should not be available to objects/others i.e. private to the class 3. If specific ID is not provided during init, use this counter variable to...
python refer to class variable while passing arguments to init
What I want to achieve: 1. Have a class variable keeping count of number of objects created 2. That variable should not be available to objects/others i.e. private to the class 3. If specific ID is not provided during init, use this counter variable to assign object.ID I have following python code class UserClass(obj...
[ "To access __user_id_counter an object or class reference is needed. In the argument list self or UserClass can not be accessed, hence:\nclass UserClass(object) :\n __user_id_counter = 0\n def __init__(self, UserID=None) :\n self.UserID = self.__user_id_counter if UserID is None else UserID\n Us...
[ 4, 1, 1 ]
[]
[]
[ "arguments", "class_variables", "default", "init", "python" ]
stackoverflow_0006841261_arguments_class_variables_default_init_python.txt
Q: retrieving a page that redirects to a login page within python I am having a rough time gathering the data from a website programatically. I am attempting to utilize this example to log into the server, but it is not working since I think that this is the wrong type of login. The site I am trying to access redire...
retrieving a page that redirects to a login page within python
I am having a rough time gathering the data from a website programatically. I am attempting to utilize this example to log into the server, but it is not working since I think that this is the wrong type of login. The site I am trying to access redirects to a login page when I attempt to download the data to parse the...
[ "One issue that pops out is that you're passing in the id values of the form parameters for the login, not the name parameters. E.g., in the user name form field, you are specifying UserLogin_username, but the name of that field as expected by the server is \"UserLogin[username]\" \n<label for=\"UserLogin_username\...
[ 1, 0 ]
[]
[]
[ "https", "python", "urllib2" ]
stackoverflow_0006844894_https_python_urllib2.txt
Q: Puzzling dictionary matching problem I've been stuck on this problem for a while and I am hoping someone can help. I am trying to iterate through a column, row[1] in a csv file called transcripts_test.csv and for each string in row[1] match the same string in a dictionary I created called OCR_dict from another csv...
Puzzling dictionary matching problem
I've been stuck on this problem for a while and I am hoping someone can help. I am trying to iterate through a column, row[1] in a csv file called transcripts_test.csv and for each string in row[1] match the same string in a dictionary I created called OCR_dict from another csv file called coors_test.csv. transcripts_t...
[ "This is not what you want:\n coordinates_list = [chromo,start,end] \n OCR_dict = {row[3]:coordinates_list}\n for keys,values in OCR_dict.items():\n OCR_chromosome = values[0]\n\nit creates a new dict in every iteration and that dict just has a single key. Then you loop over that o...
[ 2, 0 ]
[]
[]
[ "csv", "dictionary", "python" ]
stackoverflow_0006848088_csv_dictionary_python.txt
Q: Why doesn't this work (Python)? So I'm trying to learn Python using some tutorials, and I decided to create my own exercise. I wanted to create a script that figures out how many prime numbers there are between 1 and 1000, as well as printing the prime numbers. This is what I have so far: numberlist = [] a = 1 pri...
Why doesn't this work (Python)?
So I'm trying to learn Python using some tutorials, and I decided to create my own exercise. I wanted to create a script that figures out how many prime numbers there are between 1 and 1000, as well as printing the prime numbers. This is what I have so far: numberlist = [] a = 1 prime = True while a < 1000: a = a +...
[ "There are a number of problems with this code. First, a/divisor == int(a/divisor) is always True, because division in Python is integral (you will always get an integer result). Use a % divisor == 0 instead.\nAnother problem is that prime = True is outside the loop, meaning that as soon as one value is declared no...
[ 5, 3, 3, 1, 0 ]
[]
[]
[ "primes", "python" ]
stackoverflow_0006836612_primes_python.txt
Q: which calendar to use that has data extraction API? I am making an application that lets your phone connect and control your calendar. I was initially going to use Google calendar because of its cool Python API but quickly got discouraged after reading the downtime issues which still persist. I didnt choose the ph...
which calendar to use that has data extraction API?
I am making an application that lets your phone connect and control your calendar. I was initially going to use Google calendar because of its cool Python API but quickly got discouraged after reading the downtime issues which still persist. I didnt choose the php library because it requires you to download Zend framew...
[ "If you take a look at http://www.google.com/appsstatus#do=54&hl=en you can see the downtime information for the last two months. There are no problems at all listed for Google Calendar. A search for calendar downtime almost exclusively returns results from previous years, suggesting things have become more reliabl...
[ 2 ]
[]
[]
[ "google_calendar_api", "php", "python" ]
stackoverflow_0006847963_google_calendar_api_php_python.txt
Q: Push messages to clients in Python How can I implement a system that can "push" messages to clients when necessary? Basically, what I need is the ability to "push" text to Python clients from a Python server. The text will then be parsed to actions that will take care at the client side (I already know how to do t...
Push messages to clients in Python
How can I implement a system that can "push" messages to clients when necessary? Basically, what I need is the ability to "push" text to Python clients from a Python server. The text will then be parsed to actions that will take care at the client side (I already know how to do this thing, once an 'action-text' is rece...
[ "You can use redis publish subscribe model more here.\nRedis is highly scalable and fast.\nExample: (From https://github.com/andymccurdy/redis-py/blob/master/tests/pubsub.py)\nimport redis\nimport unittest\n\nclass PubSubTestCase(unittest.TestCase):\n def setUp(self):\n self.connection_pool = redis.Connec...
[ 7, 2 ]
[]
[]
[ "python", "real_time" ]
stackoverflow_0006848276_python_real_time.txt
Q: Python-twitter Logging into to twitter using Oauth-Problem I am a little bit confused by Oauth.( Heads up I am new to Programming and the Python API for twitter. ) I understand that for Oauth I need a "consumer secret" and "consumer key". Apparently I need to register an app with Twitter to use Oauth authenticatio...
Python-twitter Logging into to twitter using Oauth-Problem
I am a little bit confused by Oauth.( Heads up I am new to Programming and the Python API for twitter. ) I understand that for Oauth I need a "consumer secret" and "consumer key". Apparently I need to register an app with Twitter to use Oauth authentication and get the consumer secret and consumer key? I am just making...
[ "It's mandatory to register your app with Twitter to obtain the \"consumer secret\" and \"consumer key\". In this same process you'll be able to create the \"access key\" and \"key secret\", wich are the counterparts of the login. All of this are required to create the api instance in Python:\napi = twitter.Api(con...
[ 0 ]
[]
[]
[ "api", "python", "twitter" ]
stackoverflow_0006511324_api_python_twitter.txt
Q: Running a script that calls another script as an argument that in turn has arguments I'm looking for the most efficient/simple way to run a script (we'll call it script1) with arguments that: call one (only one) of several other scripts (as an argument to script1), which in turn: has arguments on it that are give...
Running a script that calls another script as an argument that in turn has arguments
I'm looking for the most efficient/simple way to run a script (we'll call it script1) with arguments that: call one (only one) of several other scripts (as an argument to script1), which in turn: has arguments on it that are given when script1 is run and are passed along to whichever script is being run based on the a...
[ "If you want your script (one Python program, let's call it script1.py) to call another script (another Python program) with the given arguments, you can write script1.py as:\nimport subprocess, sys\n\nsubprocess.call(sys.argv[1:])\n\nsys.argv is a list that contains your program's name (use print sys.argv[0] and s...
[ 2 ]
[]
[]
[ "arguments", "function", "python" ]
stackoverflow_0006848240_arguments_function_python.txt
Q: Highlighting and Selecting text with Python curses This is my first post to stack overflow. I've been lurking this site for information for years, and it's always helpful, so I thought that I would post my first question. I've been searching for some similar examples, but can't seem to find anything. Ultimately,...
Highlighting and Selecting text with Python curses
This is my first post to stack overflow. I've been lurking this site for information for years, and it's always helpful, so I thought that I would post my first question. I've been searching for some similar examples, but can't seem to find anything. Ultimately, I'm trying to write a simple text ui for finding false ...
[ "I would like to update this question in case anybody else is searching the web for this and stumbles upon this question. \nOkay, so the answer was actually quite simple and required reading all the functions listed on the python curses documentation. \nWhat I did was make a 3 state machine: State 1: Normal mode (d...
[ 13, 0 ]
[]
[]
[ "ncurses", "python", "tui" ]
stackoverflow_0006807808_ncurses_python_tui.txt
Q: Anagram Code in Python - Compare dynamically generated strings to a txt file I have written an Anagram solving program in Python. I wanted your opinion on whether I had gone about it right. Let me explain the logic: First, the user provides input of two words that he/she wants the single word anagram to be gener...
Anagram Code in Python - Compare dynamically generated strings to a txt file
I have written an Anagram solving program in Python. I wanted your opinion on whether I had gone about it right. Let me explain the logic: First, the user provides input of two words that he/she wants the single word anagram to be generated for (2 string values) The two are concatenated and there is third value that...
[ "Why are you doing mystr =''.join(a)? why not just do mystr = a?\nI don't think that if mystr in line: is right either, because you could have mystr as, for instance 'dog', and line as 'dogger bank', or something like that. You should probably check for equality instead.\nOther than that I can't see anything wrong....
[ 1, 1, 1, 0 ]
[]
[]
[ "anagram", "io", "python" ]
stackoverflow_0006848548_anagram_io_python.txt
Q: Django: determine which user is deleting when using post_delete signal I want admins to be notified when certain objects are deleted but I also want to determine which user is performing the delete. Is it possible? This is the code: # models.py # signal to notify admins when nodes are deleted from django.db.models...
Django: determine which user is deleting when using post_delete signal
I want admins to be notified when certain objects are deleted but I also want to determine which user is performing the delete. Is it possible? This is the code: # models.py # signal to notify admins when nodes are deleted from django.db.models.signals import post_delete from settings import DEBUG def notify_on_delete...
[ "I doubt it's possible using the built-in signals (there is no User implicitly tied to a delete operation, and because of Django's loose coupling the database layer doesn't deal with HttpRequest objects). I would create my own signal which provides a user argument and send it in whatever view the delete operation t...
[ 7 ]
[]
[]
[ "django", "django_models", "django_sessions", "django_signals", "python" ]
stackoverflow_0006847952_django_django_models_django_sessions_django_signals_python.txt
Q: the cost of starting node.js scripts verses python scripts I figure by the use cases node is designed for that it would have much less overhead than python would when starting up. But can anyone confirm this by way of experience or benchmarks. The reason I ask is I'm working on a project in which we are starting ...
the cost of starting node.js scripts verses python scripts
I figure by the use cases node is designed for that it would have much less overhead than python would when starting up. But can anyone confirm this by way of experience or benchmarks. The reason I ask is I'm working on a project in which we are starting many, ~20, python scripts every minute. In these processes we ar...
[ "Your question is too vague IMHO. Anyway, if you want to compare the startup time, why not just time? Look at some examples of it (the files null.* are empty since we are trying to measure the boot time only):\n$ i=0\n$ time while [ $((i++)) -lt 1000 ] ; do python null.py ; done\n\nreal 0m55.777s\nuser 0m30.1...
[ 4 ]
[]
[]
[ "node.js", "python" ]
stackoverflow_0006845954_node.js_python.txt
Q: How do you make line segments between two points and find out how many points intersect the line? I have code that generates all the possible lines between points: import matplotlib.pyplot as plt import matplotlib.lines as lines import itertools fig=plt.figure() ax=fig.add_subplot(111) all_data = [[1,10],[2,10],...
How do you make line segments between two points and find out how many points intersect the line?
I have code that generates all the possible lines between points: import matplotlib.pyplot as plt import matplotlib.lines as lines import itertools fig=plt.figure() ax=fig.add_subplot(111) all_data = [[1,10],[2,10],[3,10],[4,10],[5,10],[3,1],[3,2],[3,3],[3,4],[3,5]] x, y = zip(*all_data) plt.scatter(x,y) for pair in ...
[ "Maybe something like this (untested):\ndef crossf(p1, p2):\n u\"returns a boolean function for testing line (p1, p2)\"\n if p1[0] == p2[0]:\n y = [p1[1], p2[1]]\n y.sort()\n # if p3 falls within the y range it is on the line\n return lambda p3: (p3[1] >= y[0]) and (p3[1] <= y[1])\n else:\n slope ...
[ 1, 0 ]
[]
[]
[ "python" ]
stackoverflow_0006835213_python.txt
Q: Adding(mathwise) rows of several csv files in python I have csv files with the same headers (first row and first column contain said headers). The rest of the cells contain numbers. I need to take another csv file and add the numbers from the two csv files together. Is there any way to do this with the csv functio...
Adding(mathwise) rows of several csv files in python
I have csv files with the same headers (first row and first column contain said headers). The rest of the cells contain numbers. I need to take another csv file and add the numbers from the two csv files together. Is there any way to do this with the csv function in python? Thanks
[ "import csv\nf = csv.reader(open('filename1.csv', 'rb'))\ng = csv.reader(open('filename2.csv', 'rb'))\noutput = csv.writer(open('ouputfile.csv', 'wb'))\nfor row_f in f:\n row_g = g.next()\n row_output = list()\n for argi, item in enumerate(row_f):\n try:\n row_output.append(int(item) + in...
[ 1 ]
[]
[]
[ "csv", "file", "function", "math", "python" ]
stackoverflow_0006848907_csv_file_function_math_python.txt
Q: Faster way to get a directory listing than invoking "ls" in a subprocess After a search, and some test runs both os.popen()+read() and subprocess.check_output() seem to be almost equivalent for reading out the contents of a folder. Is there a way to improve either a combination of os.popen()+read() or subprocess.c...
Faster way to get a directory listing than invoking "ls" in a subprocess
After a search, and some test runs both os.popen()+read() and subprocess.check_output() seem to be almost equivalent for reading out the contents of a folder. Is there a way to improve either a combination of os.popen()+read() or subprocess.check_output()? I have to ls a number of folders and read the outputs, and usin...
[ "You are looking for os.listdir and/or os.walk, and perhaps also the os.stat family of functions. These are (Python bindings to) the same primitives that ls uses itself, so anything you can do by parsing the output of ls you can do with these. I recommend you read carefully through everything the os, os.path, and...
[ 5, 2, 0 ]
[]
[]
[ "directory_listing", "performance", "python" ]
stackoverflow_0006849007_directory_listing_performance_python.txt
Q: How do I include a column for lookup, but exclude it from GROUP BY? I am trying to execute the following query using the Django ORM: SELECT object_repr, content_type_id, COUNT(object_repr) FROM django_admin_log GROUP BY object_repr ORDER BY COUNT(object_repr); The closest I have gotten is: LogEntry.objects.value...
How do I include a column for lookup, but exclude it from GROUP BY?
I am trying to execute the following query using the Django ORM: SELECT object_repr, content_type_id, COUNT(object_repr) FROM django_admin_log GROUP BY object_repr ORDER BY COUNT(object_repr); The closest I have gotten is: LogEntry.objects.values('object_repr', 'content_type__id')\ .annotate(num_logs=...
[ "I actually just went through this in the last few days and posted a question but it is not as well worded as yours in my opinion. \nAnyway, what I found is that while Sqlite and MySql will not give an error when you run a query where you select columns not found in the group by clause, those results may be somewh...
[ 3 ]
[]
[]
[ "django", "orm", "python" ]
stackoverflow_0006849179_django_orm_python.txt
Q: Zip code not working - memory error Can someone point out any errors I might have included in my code. I wanted to keep the code as simple as possible but it's failing with a memory error. Some of the compressed files do extract fine though... import zipfile import from os.path isdir, join, normpath, split print...
Zip code not working - memory error
Can someone point out any errors I might have included in my code. I wanted to keep the code as simple as possible but it's failing with a memory error. Some of the compressed files do extract fine though... import zipfile import from os.path isdir, join, normpath, split print "Unzipping data" z = zipfile.ZipFile("C:...
[ "Don't call it zip! You're masking the builtin. \nAlso, is zip.close() really inside your for loop? It shouldn't be.\nYou should use the extract method of the ZipFile object, so you don't need to read the whole file into memory.\nInstead of\nfile(join(\"C:\\\\Incoming\\\\\", name), 'wb').write(zip.read(each))\n\ndo...
[ 5 ]
[]
[]
[ "debugging", "python", "unzip" ]
stackoverflow_0006849317_debugging_python_unzip.txt
Q: Multiple inheritance and using a method of one of the base classes I have the following code: class A(object): def __init__(self): self.name = "A" super(A, self).__init__() def Update(self): print "Update A" self.PickTarget() def PickTarget(self): print "PickTa...
Multiple inheritance and using a method of one of the base classes
I have the following code: class A(object): def __init__(self): self.name = "A" super(A, self).__init__() def Update(self): print "Update A" self.PickTarget() def PickTarget(self): print "PickTarget A" class B(object): def __init__(self): self.name = "B...
[ "It's because A is before B in C's base classes.\nYou need to use B.PickTarget(self) rather than self.PickTarget() in B.Update(self) to get this behavior. Otherwise, switch A and B in C's definition.\nEdit:\nIf the intended behavior is for B to always call methods in B and for A to always call methods in A, it's co...
[ 7, 3, 0 ]
[]
[]
[ "python" ]
stackoverflow_0006849519_python.txt
Q: Matplotlib's "symlog" option: how to prevent curves that "come back"? I'm plotting data which extent, in x, from -1000 to 1000. But I'm only interested in the values between x = -1 and 0. I also want to plot on an x log scale. But since the x-values are negative, I cannot use xscale("log"). I can use xscale("symlo...
Matplotlib's "symlog" option: how to prevent curves that "come back"?
I'm plotting data which extent, in x, from -1000 to 1000. But I'm only interested in the values between x = -1 and 0. I also want to plot on an x log scale. But since the x-values are negative, I cannot use xscale("log"). I can use xscale("symlog") though and this is the behaviour I want. Unfortunately, "symlog" seems ...
[ "This was actually a bug in matplotlib.\nSee https://github.com/matplotlib/matplotlib/issues/396\nIt is now fixed. I'm attaching a picture showing the correct result of the previous snippet. \n" ]
[ 8 ]
[]
[]
[ "matplotlib", "python" ]
stackoverflow_0006681975_matplotlib_python.txt
Q: How can I get the highest value in a column by sorting the date in a CSV file using Python? How can I get the highest value in a column by sorting the date in a CSV file using Python? My code: if sys.argv[1] == "-p": c = sys.argv[2] col_name= r"\\DT001\Process(SK)\Virtual" #d = sys.argv[3] col_name...
How can I get the highest value in a column by sorting the date in a CSV file using Python?
How can I get the highest value in a column by sorting the date in a CSV file using Python? My code: if sys.argv[1] == "-p": c = sys.argv[2] col_name= r"\\DT001\Process(SK)\Virtual" #d = sys.argv[3] col_name2 = r"(PDH-CSV 4.0) (GMT Standard Time)(0)" with open(c, 'rb') as inf: reader = csv....
[ "use this snippet\nfrom time import strptime\ndef filterByDate(mydate , start,end):\n format = \"%m/%d/%Y\"\n return strptime(start,format) <= strptime(mydate,format) and strptime(mydate,format) <= strptime(end,format)\n...\n...\nhighest = float(max(rec[col_index] for rec in reader if filterByDate(rec[date_c...
[ 0 ]
[]
[]
[ "python" ]
stackoverflow_0006845976_python.txt
Q: How do I add PIL to PyDev in Eclipse, so i could import it and use it in my project? I am trying to work with PIL in my project but the pydev can't seem to find it in my project. First of all I can see it when I enter the python shell, I can import it and I see it in the python sys.path. Second, I Added it to the ...
How do I add PIL to PyDev in Eclipse, so i could import it and use it in my project?
I am trying to work with PIL in my project but the pydev can't seem to find it in my project. First of all I can see it when I enter the python shell, I can import it and I see it in the python sys.path. Second, I Added it to the PYTHONPATH in eclipse. I restarted eclipse, but still, when I try to do "from PIL import I...
[ "Try to go to Window -> Preferences -> Pydev-> Interpreter -> Python Interpreter -> Forced Builtins tab.\nThen add a PIL entry and apply.\nI've had the same unresolved import error when tried to import from this particular package (other packages worked fine), and found this information which finally helped me.\n",...
[ 10, 9 ]
[]
[]
[ "django", "eclipse", "pydev", "python", "python_imaging_library" ]
stackoverflow_0006171749_django_eclipse_pydev_python_python_imaging_library.txt
Q: How can I make array B from array A without infinities included in Python 2.7? Array A looks like this: [1, -inf, 2, 3, inf, -60.2] Array B should look like this: [1, 2, 3, -60.2] How can I make array B from array A without infinities included in Python 2.7? A: B = [x for x in A if not math.isinf(x)] A: B = fi...
How can I make array B from array A without infinities included in Python 2.7?
Array A looks like this: [1, -inf, 2, 3, inf, -60.2] Array B should look like this: [1, 2, 3, -60.2] How can I make array B from array A without infinities included in Python 2.7?
[ "B = [x for x in A if not math.isinf(x)]\n\n", "B = filter(lambda x: abs(x) != float('inf'), A)\n\n", "Did you mean:\n>>> inf = float('inf');\n>>> import math\n>>> print filter(lambda x: not math.isinf(x), [1, -inf, 2, 3, inf, -60.2])\n[1, 2, 3, -60.200000000000003]\n\n?\n", "The easiest one:\narrayA = [1, fl...
[ 6, 2, 2, 1, 0 ]
[]
[]
[ "arrays", "find", "infinity", "python" ]
stackoverflow_0006841837_arrays_find_infinity_python.txt
Q: Python authentication problem with SQLite I have a Database in python with 2 fields: Username and passHash. The DB is ok, i already checked and all the parameters are correct. Then i need an authentication system that will look each row for the username, if it finds, look the 2nd field for the password, if not the...
Python authentication problem with SQLite
I have a Database in python with 2 fields: Username and passHash. The DB is ok, i already checked and all the parameters are correct. Then i need an authentication system that will look each row for the username, if it finds, look the 2nd field for the password, if not the same as user-provided, return "pass incorrect"...
[ "From a security standpoint, you should not tell unauthenticated users that their username wasn't found, or that their username was found but the password didn't match. \nBy providing this information, you are giving potential attackers more information about the way they can attack.\nIf an attacker can try common...
[ 3, 0, 0 ]
[]
[]
[ "authentication", "python", "sql", "sqlite", "twisted" ]
stackoverflow_0006849546_authentication_python_sql_sqlite_twisted.txt
Q: process large text file in python I have a very large file (3.8G) that is an extract of users from a system at my school. I need to reprocess that file so that it just contains their ID and email address, comma separated. I have very little experience with this and would like to use it as a learning exercise for ...
process large text file in python
I have a very large file (3.8G) that is an extract of users from a system at my school. I need to reprocess that file so that it just contains their ID and email address, comma separated. I have very little experience with this and would like to use it as a learning exercise for Python. The file has entries that look ...
[ "That actually looks like an LDIF file to me. The python-ldap library has a pure-Python LDIF handling library that could help if your file possesses some of the nasty gotchas possible in LDIF, e.g. Base64-encoded values, entry folding, etc.\nYou could use it like so:\nimport csv\nimport ldif\n\nclass ParseRecords(l...
[ 10, 5, 1, 0 ]
[]
[]
[ "python", "text_files" ]
stackoverflow_0006848857_python_text_files.txt
Q: Replacing certain rows and appending rest in CSV files with Python I have a bunch of file names that I need to append together and put into a new file. The first column are dates. If the dates overlap from one file to another, I want the next file I'm appending to replace what I already have. For example, if the f...
Replacing certain rows and appending rest in CSV files with Python
I have a bunch of file names that I need to append together and put into a new file. The first column are dates. If the dates overlap from one file to another, I want the next file I'm appending to replace what I already have. For example, if the first file is something like: 1/5/2010 'hello' 1/6/2010 'goodbye' 1/7/201...
[ "Try:\ndictio = {}\nfor row in reader:\n [date, text] = row.split()\n dictio[date] = text\n\nfor row in reader2:\n [date, text] = row.split()\n dictio[date] = text\n\ntarget = open('newfile2.csv', 'wb')\nwriter = csv.writer(target)\nfor date, text in dictio.iteritems():\n writer.writerow(\"%s %s\" %(...
[ 1, 0, 0 ]
[]
[]
[ "csv", "duplicates", "python", "replace" ]
stackoverflow_0006822339_csv_duplicates_python_replace.txt
Q: Data Driven Framework: Web/Desktop Camelot V Django etc Wanting to get some feedback on frameworks. Web/Desktop. It doesn't seem to be much difference in most respects expect web can go everywhere and desktop can't. For a small user base however using database database driven application, where 70% input would com...
Data Driven Framework: Web/Desktop Camelot V Django etc
Wanting to get some feedback on frameworks. Web/Desktop. It doesn't seem to be much difference in most respects expect web can go everywhere and desktop can't. For a small user base however using database database driven application, where 70% input would come from files, and 30% for the user. Would I get more benefit ...
[ "I think you'll find web2py very easy to learn and use. Note, if desired, you can easily distribute your web2py app to individual users for installation on their own computer like a desktop app (using the browser as the user interface) -- see here. The users don't need to have anything else installed on their compu...
[ 1 ]
[]
[]
[ "database", "frameworks", "python", "web2py" ]
stackoverflow_0006837114_database_frameworks_python_web2py.txt
Q: python: copy only missing files from FTP dirs and sub-dirs to local dirs and sub-dirs the problem is: I have a local directory '/local' and a remote FTP directory '/remote' full of subdirectories and files. I want to check if there are any new files in the sub-directories of '/remote'. If there are any, then cop...
python: copy only missing files from FTP dirs and sub-dirs to local dirs and sub-dirs
the problem is: I have a local directory '/local' and a remote FTP directory '/remote' full of subdirectories and files. I want to check if there are any new files in the sub-directories of '/remote'. If there are any, then copy them over to '/local'. the question is: am I using the right strategy? Is this totally o...
[ "If you get the modification time of both the local and the remote FTP directories and store it in a data base, you could prune the search for new or modified files. This should speed up the sync procedure significantly.\n" ]
[ 1 ]
[]
[]
[ "compare", "directory", "ftplib", "list", "python" ]
stackoverflow_0006850409_compare_directory_ftplib_list_python.txt
Q: Good Django example/tutorial/book to start with? Does anyone know of a good Django example/tutorial/book for a first hands on? It would be great if it covered session management login/authentication database connect security use of html templates Update Simple examples are really what I am looking for. Something...
Good Django example/tutorial/book to start with?
Does anyone know of a good Django example/tutorial/book for a first hands on? It would be great if it covered session management login/authentication database connect security use of html templates Update Simple examples are really what I am looking for. Something where I start out with the basic functionalities, and...
[ "The Django Book is a good start.\nThe book can also be purchased in print, if you prefer. \n", "When I was just getting started, Practical Django Projects was very helpful.\n", "Django 1.0 Website Development by Ayman Hourieh from Packt Publishing is a pretty nice place to start as well. The author goes throu...
[ 3, 2, 1, 1 ]
[]
[]
[ "django", "python" ]
stackoverflow_0006850463_django_python.txt
Q: Color classification library Status: I am developing my own library Question: Is there any library that can do color classification? I imagine the workflow like this: >>> import colorclassification >>> classifier = colorclassification.Classifier >>> color = classifier.classify_rgb([255, 255, 0]) ['yellow'] >>> c...
Color classification library
Status: I am developing my own library Question: Is there any library that can do color classification? I imagine the workflow like this: >>> import colorclassification >>> classifier = colorclassification.Classifier >>> color = classifier.classify_rgb([255, 255, 0]) ['yellow'] >>> color = classifier.classify_rgb([25...
[ "One way you could do this is just by finding the \"closest\" color. suppose we have a collection of colors, It doesn't have to cover all 16777216 possible rgb values, it doesn't even need to be in rgb, but for the sake of simplicity, it might look something like so:\ncolors = {'red': (255,0,0),\n 'green'...
[ 11 ]
[]
[]
[ "colors", "python", "python_3.x" ]
stackoverflow_0006846935_colors_python_python_3.x.txt
Q: Structuring Socket Communications to Minimize Data Transfer I am working on a project that will utilize a client device on a bandwidth constrained network (cellular). I am not very familiar with socket communications, but I have figured out how to use Java as the server (from this tutorial), and Python is the lang...
Structuring Socket Communications to Minimize Data Transfer
I am working on a project that will utilize a client device on a bandwidth constrained network (cellular). I am not very familiar with socket communications, but I have figured out how to use Java as the server (from this tutorial), and Python is the language on the client. I will be sending from a limited number of c...
[ "UTF-8 is not any fixed number of bytes - a UTF-8 character can be 1 - 16 bytes.\nDon't think of your commands as text, think of them as integers up to 255 -- No encoding or byte order or anything. chr(command) where command is an integer in this range will work fine without worrying about encoding, as long as you ...
[ 1, 1 ]
[]
[]
[ "byte", "java", "python", "tcp" ]
stackoverflow_0006850911_byte_java_python_tcp.txt
Q: Unusual Python exe behavior when running from Progam Files X86 versus Program FIles on Win7 is there some virtualization going on? I have an EXE that I built that I am trying to have installed in the Program Files (x86) folder on Win7 machines. There is really interesting behavior going on. The program has a gui...
Unusual Python exe behavior when running from Progam Files X86 versus Program FIles on Win7 is there some virtualization going on?
I have an EXE that I built that I am trying to have installed in the Program Files (x86) folder on Win7 machines. There is really interesting behavior going on. The program has a gui-we used wx-Python and XRC to handle the interface. we include an XRC folder in the distribution. The program uses getcwd() to locate ...
[ "According to this note, the Program Files (x86) folder is specifically intended for 32-bit program files, as opposed to the Program Files folder, which is intended for 64-bit programs.\nBut in order for a 32-bit program to pretend that it's on a 32-bit machine, the name of the working directory has to be returned ...
[ 0 ]
[]
[]
[ "program_files", "python", "windows" ]
stackoverflow_0006851334_program_files_python_windows.txt
Q: Python type checking Possible Duplicate: Tools for static type checking in Python For most part I love the fact that you can pick up any type and drop it where you like in Python and just let the Duck typing take over. But how would one stop the darn thing from passing Compile time. Is there a way to enforce som...
Python type checking
Possible Duplicate: Tools for static type checking in Python For most part I love the fact that you can pick up any type and drop it where you like in Python and just let the Duck typing take over. But how would one stop the darn thing from passing Compile time. Is there a way to enforce some sort of sanity checks w...
[ "Use a separate tool like Pychecker to warn you about things like usages of non-existent methods or properties. This isn't part of compilation, but you could enforce it as part of your own process, such as a pre-commit hook in your VCS.\n", "No. The Python compiler doesn't (and, generally, can't) even know if you...
[ 4, 3, 3, 1, 1, 1, 1, 0 ]
[]
[]
[ "python", "static_analysis", "static_typing", "types" ]
stackoverflow_0006850977_python_static_analysis_static_typing_types.txt
Q: Javascript-style object methods in Python? In Javascript, I can do this: var person = { name: 'Joe', age: '35', speak: function(){ return 'o hai i am joe' } } Then I can call that method: person.speak() 'o hai i am joe' I know this can be done with classes in Python, and presumably that's the right ...
Javascript-style object methods in Python?
In Javascript, I can do this: var person = { name: 'Joe', age: '35', speak: function(){ return 'o hai i am joe' } } Then I can call that method: person.speak() 'o hai i am joe' I know this can be done with classes in Python, and presumably that's the right way to go. Nonetheless, I'm curious -- is there ...
[ "person = {\n 'name': 'Joe',\n 'age': '35',\n 'speak': lambda: 'o hai i am joe',\n}\n\nHowever, in Python (unlike JavaScript), attribute and [] access are different. To execute speak, write\nperson['speak']()\n\n", "def test():\n print \"hello\"\n\ntestDict = {\"name\" : \"Joe\", \"age\" : 35, \"speak\" : ...
[ 5, 2, 2, 0 ]
[]
[]
[ "javascript", "methods", "python" ]
stackoverflow_0006851443_javascript_methods_python.txt
Q: Installing a python wrapper for a c++ library I am trying to install the python wrapper for the ANN (approx near neighbors) c++ library: link is http://www.scipy.org/scipy/scikits/wiki/AnnWrapper . I am on Windows 7 32-bit. Unfortunately the documentation is a bit terse and I am a newbie to programming in general...
Installing a python wrapper for a c++ library
I am trying to install the python wrapper for the ANN (approx near neighbors) c++ library: link is http://www.scipy.org/scipy/scikits/wiki/AnnWrapper . I am on Windows 7 32-bit. Unfortunately the documentation is a bit terse and I am a newbie to programming in general, so I cannot decipher the instructions found withi...
[ "To install Rob Hetland's wrapper you'll need to execute the following command (or one very similar depending on the C compiler installed on your system) in the directory that you've extracted the archive into:\npython setup.py build install\nor\npython setup.py build install --compiler=mingw32\nIf you don't have a...
[ 0 ]
[]
[]
[ "c++", "python", "wrapper" ]
stackoverflow_0002612379_c++_python_wrapper.txt
Q: Using Python asyncore for load / stress testing a website Hopefully someone will be able to help out with this. Short version: I'm looking to build my own website stress tester in Python. Why? Because I feel like it :) I'm not looking for a pre-built solution [i.e. funkload or JMeter]. It just seems like an intere...
Using Python asyncore for load / stress testing a website
Hopefully someone will be able to help out with this. Short version: I'm looking to build my own website stress tester in Python. Why? Because I feel like it :) I'm not looking for a pre-built solution [i.e. funkload or JMeter]. It just seems like an interesting thing to do as a programming exercise. I also think that ...
[ "I suggest that you try gevent . It can accomplish this task very simply because you write code that looks synchronous and uses the python stdlib like urllib2. It will be very fast because it has low memory overhead (pay for only what you use) and it uses fast polling system calls for IO. This code example is very ...
[ 4, 0 ]
[]
[]
[ "asynchronous", "asyncore", "http", "multithreading", "python" ]
stackoverflow_0006851823_asynchronous_asyncore_http_multithreading_python.txt
Q: Boost.Python: Calling virtual functions from C++ I'm not looking for help on exposing virtual functions to Python, I would like to know how I can call the said virtual functions from the C++ side. Consider this... // ==================== // C++ code // -------------------- struct Base { virtual void func() { ...
Boost.Python: Calling virtual functions from C++
I'm not looking for help on exposing virtual functions to Python, I would like to know how I can call the said virtual functions from the C++ side. Consider this... // ==================== // C++ code // -------------------- struct Base { virtual void func() { cout << "Hello from C++!"; } }; BOOST_PYT...
[ "I think you just call extract<Base*>(obj) where obj is python::object.\n", "Your approach will not work in such a simple way; you have to add wrapper to your python class, from which python class will be subsequently derived. here, under 1. I explained briefly how it works. So, to call python-override of a c++ v...
[ 0, 0 ]
[]
[]
[ "boost", "c++", "python" ]
stackoverflow_0006840380_boost_c++_python.txt
Q: How to check if PyObject* points to the type numpy.uint8 How do I use the Python C-API to check if a PyObject* points to the type numpy.uint8 etc? (Note that I want to check if the PyObject* points to the type numpy.uint8, not if it points to an instance of the type numpy.uint8.) A: You can use PyType_IsSubtype...
How to check if PyObject* points to the type numpy.uint8
How do I use the Python C-API to check if a PyObject* points to the type numpy.uint8 etc? (Note that I want to check if the PyObject* points to the type numpy.uint8, not if it points to an instance of the type numpy.uint8.)
[ "You can use PyType_IsSubtype(child, parent) to see if the child type inherits the parent, but it operates on PyTypeObject*, not PyObject*.\n" ]
[ 1 ]
[]
[]
[ "c", "numpy", "python", "python_c_api" ]
stackoverflow_0006850012_c_numpy_python_python_c_api.txt
Q: Perform actions on dictionary values that match items in a list? I have a dictionary with 46,000 key:value pairs where each key has a 3 item list as values: my dict = {key1: ['A', 'B', 'C'], key2: ['B', 'A', 'G'], key3: ['Z', 'H', 'I']......} I have a list with hundreds of values: L1 = ['A', 'A', 'B', 'D', .......
Perform actions on dictionary values that match items in a list?
I have a dictionary with 46,000 key:value pairs where each key has a 3 item list as values: my dict = {key1: ['A', 'B', 'C'], key2: ['B', 'A', 'G'], key3: ['Z', 'H', 'I']......} I have a list with hundreds of values: L1 = ['A', 'A', 'B', 'D', ......] How do I iterate through the list L1 and for each item in L1, mat...
[ "Without any shortcuts, you could write something like this:\n#!/usr/bin/env python\n\nd = {\n 'key1' : ['A', 'B', 'C'], \n 'key2' : ['B', 'A', 'G'], \n 'key3' : ['Z', 'H', 'I']\n}\n\nl = ['A', 'A', 'B', 'D']\n\nuniq_l = set(l) # you don't need to check duplicates twice\n\nfor key, value in d.items():\n ...
[ 3, 1, 0, 0 ]
[]
[]
[ "dictionary", "key_value_store", "python" ]
stackoverflow_0006852324_dictionary_key_value_store_python.txt
Q: How to capture a frame from a camera stream exactly when a key is hit using opencv in python? I am trying to capture image from a webcam when a key is hit. Following code is successful import cv cv.NamedWindow("w1") camera = cv.CaptureFromCAM(-1) while True: key = cv.WaitKey(0); ...
How to capture a frame from a camera stream exactly when a key is hit using opencv in python?
I am trying to capture image from a webcam when a key is hit. Following code is successful import cv cv.NamedWindow("w1") camera = cv.CaptureFromCAM(-1) while True: key = cv.WaitKey(0); if key == 'q': break; image = cv.QueryFrame(camera) cv.ShowImage("w1"...
[ "I suggest you try it in a slightly different manner:\nimport cv\n\ncv.NamedWindow(\"w1\")\ncamera = cv.CaptureFromCAM(-1)\n\nwhile True:\n image = cv.QueryFrame(camera)\n key = cv.WaitKey(33)\n\n if key == 'q':\n break\n elif key != -1:\n cv.ShowImage(\"w1\", image)\n\ncv.DestroyWindow(\"...
[ 3 ]
[]
[]
[ "camera", "opencv", "python", "video", "video_capture" ]
stackoverflow_0006686498_camera_opencv_python_video_video_capture.txt
Q: Django ManyToMany field transformation on a ModelForm I have this manytomany field in my model that I have overridden with a CharField that receives a csv list of the second models name attribute. class PostForm(ModelForm): tests = CharField(label="tests") class Meta: model = Post fields ...
Django ManyToMany field transformation on a ModelForm
I have this manytomany field in my model that I have overridden with a CharField that receives a csv list of the second models name attribute. class PostForm(ModelForm): tests = CharField(label="tests") class Meta: model = Post fields = ('title','body') def clean_tests(self): # Her...
[ "I'm not sure if there's a method you could override to do this -- from a look at the BaseModelForm constructor though, it looks perfectly okay to specify both the instance and initial keyword arguments together -- the instance is converted into a dict (subject to the fields and exclude options in Meta), and that d...
[ 0 ]
[]
[]
[ "django", "django_forms", "django_models", "python" ]
stackoverflow_0006852028_django_django_forms_django_models_python.txt
Q: How can I split a 2D array into an array with unique values and a dictionary? I'm trying to split a 2D array into a specific format and can't figure out the last step. A sample of my data is structured as follows: # Original Data fileListCode = [['Seq3.xls', 'B08524_057'], ['Seq3.xls', 'B08524_053...
How can I split a 2D array into an array with unique values and a dictionary?
I'm trying to split a 2D array into a specific format and can't figure out the last step. A sample of my data is structured as follows: # Original Data fileListCode = [['Seq3.xls', 'B08524_057'], ['Seq3.xls', 'B08524_053'], ['Seq3.xls', 'B08524_054'], ['Seq98.xls', 'B25...
[ "With, itertools.groupby this process will be much simplier:\n>>> key = operator.itemgetter(0)\n>>> grouped = itertools.groupby(sorted(fileListCode, key=key), key=key)\n>>> [(i, {k[1]: n for n, k in enumerate(j, 1)}) for i, j in grouped]\n[('Seq3.xls', {'B08524_052': 1, 'B08524_053': 2, 'B08524_054': 3}),\n ('Seq98...
[ 4, 2, 1 ]
[]
[]
[ "arrays", "dictionary", "python" ]
stackoverflow_0006852660_arrays_dictionary_python.txt
Q: Efficient (spatial) Network Neighbors? I would like to identify the Kth order neighbors of an edge on a network, specifically the neighbors of a large set of streets. For example, I have a street that I'm interested in looking at, call this the focal street. For each focal street I want to find the streets that ...
Efficient (spatial) Network Neighbors?
I would like to identify the Kth order neighbors of an edge on a network, specifically the neighbors of a large set of streets. For example, I have a street that I'm interested in looking at, call this the focal street. For each focal street I want to find the streets that share an intersection, these are the first o...
[ "It seems to me like what you want to implement is the following: http://en.wikipedia.org/wiki/Composition_of_relations\nIt is actually a straight-forward algorithm. Let R be the relation \"is a first order neighbor\", therefore if two streets x,y are in R then x is a first order neighbor of y. So, for second order...
[ 1 ]
[]
[]
[ "arcgis", "geospatial", "python" ]
stackoverflow_0006852759_arcgis_geospatial_python.txt
Q: Modifying dictionary values while iterating with dict.values() or dict.itervalues() I have a dicionary that is initialized like so: tab = {'Mike': 0, 'Chad': 15, 'Taylor': 2} I want to be able to add integers to each value in the dictionary. For example, after adding 5, the dictionary should look like this: {...
Modifying dictionary values while iterating with dict.values() or dict.itervalues()
I have a dicionary that is initialized like so: tab = {'Mike': 0, 'Chad': 15, 'Taylor': 2} I want to be able to add integers to each value in the dictionary. For example, after adding 5, the dictionary should look like this: {'Mike': 5, 'Chad': 20, 'Taylor': 7} It seems as if this can be done with a couple of lin...
[ "The easiest way?\nfor k in tab.keys():\n tab[k] += 5\n\n", "tab.itervalues() creates an iterator over values.\nYou iterate over these, and are handed each value in turn. The values are ints. In Python, these are immutable.\nIn Python, the statement a += 3 is translated - in most cases - to a = a + 3. a + 3 cr...
[ 17, 7 ]
[]
[]
[ "dictionary", "iteration", "python" ]
stackoverflow_0006852819_dictionary_iteration_python.txt
Q: Python appending to two lists when it should only append to one I have a list called teams which contains two objects, these are objects of the same class and they both have a "members" list. I am appending to these lists individually. See Fight.AddParticipant but the two participant objects I'm appending seem to ...
Python appending to two lists when it should only append to one
I have a list called teams which contains two objects, these are objects of the same class and they both have a "members" list. I am appending to these lists individually. See Fight.AddParticipant but the two participant objects I'm appending seem to end up in both of the team objects, which is unintended behavior. Why...
[ "You have made the lists as class attributes, which means the lists are shared by all instances. It's the same list. You should make the lists instance attributes. Do that by creating them in the __init__ (constructor) method of the class.\n", "In all of your classes, you want to initialize instance variables lik...
[ 3, 3, 0 ]
[]
[]
[ "append", "list", "object", "python" ]
stackoverflow_0006853060_append_list_object_python.txt
Q: How do you set the frame size of cv.CreateVideoWriter if I try: writer = cv.CreateVideoWriter(file, -1,(int(800),int(600)), is_color=1) -or- writer = cv.CreateVideoWriter(file, -1,(800,600), is_color=1) -or- writer = cv.CreateVideoWriter(file, -1,(800.0,600.0), is_color=1) I get the error: TypeError: a float i...
How do you set the frame size of cv.CreateVideoWriter
if I try: writer = cv.CreateVideoWriter(file, -1,(int(800),int(600)), is_color=1) -or- writer = cv.CreateVideoWriter(file, -1,(800,600), is_color=1) -or- writer = cv.CreateVideoWriter(file, -1,(800.0,600.0), is_color=1) I get the error: TypeError: a float is required with this I get progress: writer = cv.CreateVi...
[ "You need to pass a valid fourcc and fps:\nfourcc = cv.CV_FOURCC('X','V','I','D')\nfps = 25.0 # or 30.0 for a better quality stream\nwriter = cv.CreateVideoWriter(file, fourcc, 25.0, (800,600), is_color=1)\n\nAlternatively, you can use named parameters in Python. It is less error-prone this way:\nwriter = cv.Create...
[ 2 ]
[]
[]
[ "computer_vision", "opencv", "python", "typeerror" ]
stackoverflow_0006852016_computer_vision_opencv_python_typeerror.txt
Q: Is **kwargs in Python eager or lazy? I'm trying to execute a Django query: #att.name is a string kwargs = {att.name : F('node__product__' + att.name) } temps = Temp.objects.exclude(**kwargs) I'm wondering if this is correct. All the examples I've seen so far use strings in the values, but what if the value is a ...
Is **kwargs in Python eager or lazy?
I'm trying to execute a Django query: #att.name is a string kwargs = {att.name : F('node__product__' + att.name) } temps = Temp.objects.exclude(**kwargs) I'm wondering if this is correct. All the examples I've seen so far use strings in the values, but what if the value is a function, should I make the value a string...
[ "In python, expressions are always evaluated eagerly. There is no lazy evaluation in python. Some libraries get around the absence of this useful feature by allowing values that should be of some specific type to instead be a string, which it later evals. You can declare some parts of a django model this way (so...
[ 5, 0, 0, 0 ]
[]
[]
[ "django", "keyword_argument", "lazy_evaluation", "python" ]
stackoverflow_0006852720_django_keyword_argument_lazy_evaluation_python.txt
Q: Smart Automatic Scraping I have this problem, I need to scrape lots of different HTML data sources, each data source contains a table with lots of rows, for example country name, phone number, price per minute. I would like to build some semi automatic scraper which will try to .. find automatically the right tab...
Smart Automatic Scraping
I have this problem, I need to scrape lots of different HTML data sources, each data source contains a table with lots of rows, for example country name, phone number, price per minute. I would like to build some semi automatic scraper which will try to .. find automatically the right table in the HTML page, -- probab...
[ "\ndoes this look like a good design ? \n\nNo.\n\nwhat tools would you choose to do it in if you program in python ?\n\nBeautiful Soup\n\nfind automatically the right table in the HTML page, -- probably by searching the text for some sample data and trying to find the common HTML element which contain both\n\nBad i...
[ 4, 0 ]
[]
[]
[ "python" ]
stackoverflow_0006852061_python.txt
Q: how do I specify extended ascii (i.e. range(256)) in the python magic encoding specifier line? I'm using mako templates to generate specialized config files. Some of these files contain extended ASCII chars (>127), but mako chokes saying that the chars are out of range when I use: ## -*- coding: ascii -*- So I'm...
how do I specify extended ascii (i.e. range(256)) in the python magic encoding specifier line?
I'm using mako templates to generate specialized config files. Some of these files contain extended ASCII chars (>127), but mako chokes saying that the chars are out of range when I use: ## -*- coding: ascii -*- So I'm wondering if perhaps there's something like: ## -*- coding: eascii -*- That I can use that will be...
[ "Short answer\nUse cp437 as the encoding for some retro DOS fun. All byte values greater than or equal to 32 decimal, except 127, are mapped to displayable characters in this encoding. Then use cp037 as the encoding for a truly trippy time. And then ask yourself how do you really know which of these, if either o...
[ 19, 3, 1 ]
[]
[]
[ "encoding", "mako", "python", "templates", "wsgi" ]
stackoverflow_0006850486_encoding_mako_python_templates_wsgi.txt
Q: templated configuration in python or perl? I'm trying to implement a templated configuration file. I'd prefer python, but I'd take an answer in perl too. I've used perl for my example. I've searched a bit and found - python single configuration file - ConfigObj - python configuration file generator - ePerl but...
templated configuration in python or perl?
I'm trying to implement a templated configuration file. I'd prefer python, but I'd take an answer in perl too. I've used perl for my example. I've searched a bit and found - python single configuration file - ConfigObj - python configuration file generator - ePerl but I could not from those solve my problem. I'm tr...
[ "I developed Template::MasonLite for exactly this purpose. I was generating a whole lot of config files (Apache configs in my case) and I needed the script to run on multiple hosts without extra dependencies. So I developed a cut-down version of HTML::Mason that could be embedded directly in my script (an extra ~70...
[ 4, 1 ]
[]
[]
[ "configuration", "perl", "python", "templates" ]
stackoverflow_0006852719_configuration_perl_python_templates.txt
Q: Help installing MySQLdb for Python under Mac OS X I know this has been asked several times, but after a few hours of trying, there is no way to make this work. I've installed MySQL 32bits from a dmg file and MySQL-python-1.2.3. I followed this steps, but when I run python setup.py build, these errors come up: runn...
Help installing MySQLdb for Python under Mac OS X
I know this has been asked several times, but after a few hours of trying, there is no way to make this work. I've installed MySQL 32bits from a dmg file and MySQL-python-1.2.3. I followed this steps, but when I run python setup.py build, these errors come up: running build running build_py copying MySQLdb/release.py -...
[ "Try macports:\n$ port search python | grep mysql\npy-mysql @1.2.2 (python, devel, databases)\nPython interface to mysql\npy25-mysql @1.2.2 (python, devel, databases)\nPython interface to mysql\npy26-mysql @1.2.3 (python, devel, databases)\npy27-mysql @1.2.2 (python, devel, databases)\nPython interface to mysql\n\n...
[ 6, 3, 2 ]
[]
[]
[ "macos", "mysql", "mysql_python", "python" ]
stackoverflow_0005986858_macos_mysql_mysql_python_python.txt
Q: Paramiko error using put Hi I am using paramiko 1.7.6 "fanny" on microsoft windows xp v2002 service pack3 with python 2.4.2 I have the follwing script: import paramiko hostname='blah' port=22 username='blah' password='blah' fullpath='\\\\root\\path\\file.xls' remotepath='/inbox/file.xls' self.client= paramiko....
Paramiko error using put
Hi I am using paramiko 1.7.6 "fanny" on microsoft windows xp v2002 service pack3 with python 2.4.2 I have the follwing script: import paramiko hostname='blah' port=22 username='blah' password='blah' fullpath='\\\\root\\path\\file.xls' remotepath='/inbox/file.xls' self.client= paramiko.SSHClient() self.client.load_s...
[ "IOError: [Errno 2] /inbox/file.xls is not a valid file path\nThis is your error, which means that /inbox isn't a valid path. You probably meant to use \nremotepath='inbox/file.xls'\n", "I had the same issue.\nThe signature specifies sftp_client.py\n def put(self, localpath, remotepath, callback=None, confirm=T...
[ 1, 1 ]
[]
[]
[ "paramiko", "python" ]
stackoverflow_0004518568_paramiko_python.txt