Q_Id int64 337 49.3M | CreationDate stringlengths 23 23 | Users Score int64 -42 1.15k | Other int64 0 1 | Python Basics and Environment int64 0 1 | System Administration and DevOps int64 0 1 | Tags stringlengths 6 105 | A_Id int64 518 72.5M | AnswerCount int64 1 64 | is_accepted bool 2
classes | Web Development int64 0 1 | GUI and Desktop Applications int64 0 1 | Answer stringlengths 6 11.6k | Available Count int64 1 31 | Q_Score int64 0 6.79k | Data Science and Machine Learning int64 0 1 | Question stringlengths 15 29k | Title stringlengths 11 150 | Score float64 -1 1.2 | Database and SQL int64 0 1 | Networking and APIs int64 0 1 | ViewCount int64 8 6.81M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5,291,479 | 2011-03-13T18:36:00.000 | 1 | 0 | 1 | 0 | python,indentation,prompt | 5,291,864 | 2 | false | 0 | 0 | If you are using Windows with the standard cmd.exe console (and it would have been helpful for you to have stated this up front) then you can use the TAB and arrow keys exactly as you desire. | 2 | 2 | 0 | hi everyone :)
my problem is, up until now, i have exclusively used tabs to indent python, as i find it easier than spaces, but for no reason i know, python interactive prompt, the basic python.exe one, suddenly refuses to accept the tab button, all it does is flash the cursor. all i can think of is that my computer in... | indent with 'tab' button in python commandline | 0.099668 | 0 | 0 | 5,644 |
5,291,723 | 2011-03-13T19:17:00.000 | 0 | 0 | 0 | 0 | iphone,python,mobile,wifi | 5,291,796 | 1 | true | 0 | 0 | Do you intend the desktop app to be the server for the mobile app client? Or are both the desktop app and mobile app clients of some server on the web?
Either are entirely possible and workable; however if the server is at a known location on the web, any mobile client instance can know where to find it - if it is runn... | 1 | 0 | 0 | I need your help! I want to create a desktop app and a mobile app to sync data between them.
Imagine a simple TO-DO list app. I also want to know if you think this is the best solution.
My first idea is to create a python app in order to target all possible operative systems, and then create the mobile ones to sync be... | Desktop WiFi app to Sync with Mobile app | 1.2 | 0 | 0 | 462 |
5,294,185 | 2011-03-14T02:39:00.000 | 1 | 0 | 0 | 0 | python,escaping,sql-injection,xss | 5,294,235 | 2 | false | 1 | 0 | Semicolons are sometimes an issue when putting values into SQL, but are not an issue when putting values into HTML.
cgi.escape() is designed for escaping things that are being put into HTML, and thus only escapes things that are an issue in HTML. | 2 | 0 | 0 | I've been told to use (python's) cgi.escape() function to avoid sql injections and xss attacks, although I'm sure that django automatically escapes variables. Reading about such attacks, it seems to me that the role of the semi-colon is crucial to both injecting sql and javascript. Yet, cgi.escape doesn't seem to enc... | Role of semi-colon in sql injection and xss attacks | 0.099668 | 0 | 0 | 1,373 |
5,294,185 | 2011-03-14T02:39:00.000 | 3 | 0 | 0 | 0 | python,escaping,sql-injection,xss | 5,294,230 | 2 | false | 1 | 0 | cgi.escape is used to convert text that might contain &, <, and > characters, which generally aren't visible in HTML documents, into HTML entities that will be displayed. It has nothing whatsoever to do with preventing SQL injection, although it might help prevent XSS attacks by displaying HTML codes as text rather th... | 2 | 0 | 0 | I've been told to use (python's) cgi.escape() function to avoid sql injections and xss attacks, although I'm sure that django automatically escapes variables. Reading about such attacks, it seems to me that the role of the semi-colon is crucial to both injecting sql and javascript. Yet, cgi.escape doesn't seem to enc... | Role of semi-colon in sql injection and xss attacks | 0.291313 | 0 | 0 | 1,373 |
5,296,977 | 2011-03-14T09:47:00.000 | 372 | 1 | 1 | 0 | python | 5,296,992 | 8 | true | 0 | 0 | Nothing, because Python precompiles your script into a PYC file and launches that.
However, if some kind of exception occurs, you may get a slightly misleading explanation, because line X may have different code than before you started the script. | 4 | 315 | 0 | Imagine a python script that will take a long time to run, what will happen if I modify it while it's running? Will the result be different? | What will happen if I modify a Python script while it's running? | 1.2 | 0 | 0 | 69,356 |
5,296,977 | 2011-03-14T09:47:00.000 | -5 | 1 | 1 | 0 | python | 70,072,657 | 8 | false | 0 | 0 | depending. if a python script links to other modified file, then will load newer version ofcourse. but if source doesnt point to any other file it'll just run all script from cache as long as its run. changes will be visible next time...
and if about auto-applying changes when they're made - yes, @pcbacterio was correc... | 4 | 315 | 0 | Imagine a python script that will take a long time to run, what will happen if I modify it while it's running? Will the result be different? | What will happen if I modify a Python script while it's running? | -1 | 0 | 0 | 69,356 |
5,296,977 | 2011-03-14T09:47:00.000 | -1 | 1 | 1 | 0 | python | 70,066,818 | 8 | false | 0 | 0 | It happens nothing. Once the script is loaded in memory and running it will keep like this.
An "auto-reloading" feature can be implemented anyway in your code, like Flask and other frameworks does. | 4 | 315 | 0 | Imagine a python script that will take a long time to run, what will happen if I modify it while it's running? Will the result be different? | What will happen if I modify a Python script while it's running? | -0.024995 | 0 | 0 | 69,356 |
5,296,977 | 2011-03-14T09:47:00.000 | 1 | 1 | 1 | 0 | python | 70,108,346 | 8 | false | 0 | 0 | No, the result will not reflect the changes once saved. The result will not change when running regular python files. You will have to save your changes and re-run your program. | 4 | 315 | 0 | Imagine a python script that will take a long time to run, what will happen if I modify it while it's running? Will the result be different? | What will happen if I modify a Python script while it's running? | 0.024995 | 0 | 0 | 69,356 |
5,298,169 | 2011-03-14T11:51:00.000 | 25 | 1 | 1 | 0 | python,python-zipfile | 5,298,221 | 1 | true | 0 | 0 | ZIP_DEFLATED correspond to an archive member (a file inside the archive) which is compressed (or deflated). ZIP_STORED correspond to an archive member which is simply stored, without being compressed, quite the same as an archive member inside a tar file. | 1 | 13 | 0 | I have difficulty understanding the difference between zipfile.ZIP_DEFLATED and zipfile.ZIP_STORED compression modes of the zipfile module. | Python zipfile module: difference between zipfile.ZIP_DEFLATED and zipfile.ZIP_STORED | 1.2 | 0 | 0 | 10,717 |
5,299,025 | 2011-03-14T13:13:00.000 | 0 | 1 | 0 | 0 | python,email,smtplib,dkim | 5,299,099 | 2 | false | 0 | 0 | You don't. It's the mail server's job to add this signature. | 1 | 2 | 0 | How would I DKIM sign an email I've constructed using email.mime.text.MIMEText and am sending using smtplib? | Sending a DKIM signed email - Python | 0 | 0 | 0 | 1,800 |
5,299,199 | 2011-03-14T13:28:00.000 | 1 | 1 | 1 | 0 | python,django,import,python-module | 46,303,381 | 6 | false | 1 | 0 | I was able to force python to import the global one with
from __future__ import absolute_import
at the beginning of the file (this is the default in python 3.0) | 2 | 2 | 0 | I'm using python and virtualenv/pip. I have a module installed via pip called test_utils (it's django-test-utils). Inside one of my django apps, I want to import that module. However I also have another file test_utils.py in the same directory. If I go import test_utils, then it will import this local file.
Is it possi... | Python - Importing a global/site-packages module rather than the file of the same name in the local directory | 0.033321 | 0 | 0 | 3,449 |
5,299,199 | 2011-03-14T13:28:00.000 | 0 | 1 | 1 | 0 | python,django,import,python-module | 5,351,006 | 6 | true | 1 | 0 | Since my test_utils was in a django project, I was able to go from ..test_utils import ... to import the global one. | 2 | 2 | 0 | I'm using python and virtualenv/pip. I have a module installed via pip called test_utils (it's django-test-utils). Inside one of my django apps, I want to import that module. However I also have another file test_utils.py in the same directory. If I go import test_utils, then it will import this local file.
Is it possi... | Python - Importing a global/site-packages module rather than the file of the same name in the local directory | 1.2 | 0 | 0 | 3,449 |
5,299,280 | 2011-03-14T13:35:00.000 | 1 | 0 | 0 | 0 | python,algorithm,variations | 5,299,434 | 3 | false | 0 | 0 | I'd solve this exercise with dynamic programming. You should be able to get the optimal solution in O(m*n) operations (n beeing the number of cars, m beeing the total mass).
That will only work however if the masses are all integers.
In general you have a binary linear programming problem. Those are very hard in genera... | 1 | 2 | 1 | I need to make a program in python that chooses cars from an array, that is filled with the mass of 10 cars. The idea is that it fills a barge, that can hold ~8 tonnes most effectively and minimum space is left unfilled. My idea is, that it makes variations of the masses and chooses one, that is closest to the max weig... | Program, that chooses the best out of 10 | 0.066568 | 0 | 0 | 230 |
5,300,563 | 2011-03-14T15:16:00.000 | 6 | 1 | 1 | 0 | python,singleton | 5,300,658 | 2 | true | 0 | 0 | Why don't you use Python standard logging and write a handler to interface with your company-standard logging system? Python logging is specifically designed so you don't need to pass logger instances between layers of your code - Python loggers are essentially singletons already.
Handlers for stdlib logging are pretty... | 1 | 5 | 0 | I have created my own simple logger class which uses COM interop to redirect to a company-standard logger. I would like to create logger instance near the beginning of my script and then use this logger to allow all modules in my script to log centrally.
Is there an idiomatic way to share this logger instance between a... | What is the idiomatic way to share a logger instance between modules in my Python script? | 1.2 | 0 | 0 | 2,563 |
5,302,695 | 2011-03-14T18:23:00.000 | 0 | 0 | 0 | 1 | python,rabbitmq,amqp,tornado | 5,787,202 | 2 | false | 1 | 0 | Try to avoid the error. If you declare a connection to the queue, and it doesn't exist, it will be created. Then immediately delete it.
Or, if you will use that queue again in the next week or so, i.e. it is not single-use, then just leave it around and handle deletion as a system admin activity that cleans up long ter... | 1 | 1 | 0 | I've just got started using pika(v 0.9.4) with Tornado (through the use of pika.adapters.tornado_connection.TornadoConnection) and I was wondering what's the appropriate way of catching errors when using, say: queue_delete for when the queue you're trying to delete doesn't exist. RabbitMQ raises AMQPError, but I am not... | amqp queue_delete catch errors in async way | 0 | 0 | 0 | 307 |
5,302,816 | 2011-03-14T18:34:00.000 | 2 | 0 | 1 | 0 | python,data-structures | 5,303,400 | 4 | false | 0 | 0 | What you describe sounds like a sparse matrix, where the foos are along one axis and the bars along the other one. Each non-empty cell represents a relationship between one foo and one bar, and contains the "simple metadata" you describe.
There are efficient sparse matrix packages for Python (scipy.sparse, PySparse) y... | 1 | 1 | 0 | I have a very large dataset - millions of records - that I want to store in Python. I might be running on 32-bit machines so I want to keep the dataset down in the hundreds-of-MB range and not ballooning much larger than that.
These records - represent a M:M relationship - two IDs (foo and bar) and some simple metadat... | Efficient large dicts of dicts to represent M:M relationships in Python | 0.099668 | 1 | 0 | 240 |
5,305,119 | 2011-03-14T22:02:00.000 | 0 | 0 | 0 | 0 | python,wsgi | 5,306,151 | 1 | false | 1 | 0 | You might need to put all the python files on that machine, then convert them to .pyc or .pyo then delete the .py's
I'm suspecting maybe the .pys were generated on a different version of python maybe.
Also paste the import errors .. that might help in diagnoses. | 1 | 1 | 0 | I'm trying to migrate to wsgi but I'm getting ImportError exceptions all the time.
I have my modules installed only with .pyc files, I don't have the .py files in the server (I can't change that, sorry). When I add some .py files the ImportError moves away to some other import line.
Is there a way to make WSGI use the ... | WSGI with .pyc files | 0 | 0 | 0 | 806 |
5,306,852 | 2011-03-15T02:26:00.000 | 1 | 1 | 1 | 0 | python,optparse | 5,306,963 | 2 | false | 0 | 0 | How about parser.format_help()? | 1 | 1 | 0 | I use optparse module to parse the options that I make, and it automatically generates usage message to print with -h option.
How can I get the usage message as a string in a python script? I'd like to print out it when something's wrong with parsing. | Usage message string that optparse makes in python? | 0.099668 | 0 | 0 | 1,826 |
5,306,959 | 2011-03-15T02:43:00.000 | 0 | 0 | 1 | 1 | python,debugging,command-line,gdb | 5,307,026 | 2 | false | 0 | 0 | I'm afraid names won't help you much. Since you didn't build in some printing mechanism and your process is already running you're pretty much screwed.
If you have an idea what the values might be your best bet would be using a process memory scanner and start messing around. Though I estimate your chances of success v... | 1 | 2 | 0 | I write a Python 2.5 Command Line program on CentOS 5.5 and it has been running for 1 day and is still running. Now I want to end this program but get the value of a global variable.
I have done some Google. It seems the only way to get the value of a global variable is to attach the Python program to a GDB.
Suppose th... | Get a Global Variable while a Python Program is running | 0 | 0 | 0 | 1,775 |
5,307,007 | 2011-03-15T02:54:00.000 | 0 | 0 | 0 | 0 | python,qt,user-interface,qt4,pyqt | 5,312,332 | 1 | false | 0 | 1 | Have you tried putting the QComboBoxes inside a layout inside a QWidget, and placing the QWidget in the QTreeWidget? | 1 | 1 | 0 | I have a QTreeWidget with QComboBoxes inside of it. I would like to be able to hide the combo boxes.
I am getting the QComboBox out of the tree using the itemWidget function. I have tried using setVisible(False) and hide() but neither work. Can anyone explain why this is the case and possibly offer a soultion?
I s... | PyQt Hide QDialogs Inside of QTreeWidget | 0 | 0 | 0 | 220 |
5,307,039 | 2011-03-15T02:59:00.000 | 1 | 0 | 0 | 0 | python,ruby-on-rails,ruby,django,drupal | 5,307,082 | 1 | true | 1 | 0 | Drupal would likely handle the basic concept of listings rather adeptly, but you'd need to write plenty of glue code to make it match the exact functionality you want. It would, in fact, be easier to write it from scratch than to force a tool to do a different job.
Go for a full-fledged web app framework. | 1 | 0 | 0 | I would like to create a Kickstarter type clone in terms of functionality.
Can Drupal produce a crude prototype?
Or suck it up, hit the books and learn python/django or ruby/rails.
I appreciate any and all input. | Kickstarter clone in Drupal? | 1.2 | 0 | 0 | 1,290 |
5,308,263 | 2011-03-15T06:31:00.000 | 0 | 0 | 0 | 0 | python,wxpython | 5,308,640 | 3 | false | 0 | 1 | Create an event queue for each frame, when a child frame is opened set a variable that is checked on processing events to join the queue, and then unset this on destruction of the child frame. If this variable is set then throw the message away, otherwise add it to the queue for processing.
Depending on the libraries y... | 1 | 0 | 0 | I created three frames separately. I need to call these child frames
from the click events of buttons located in a main frame. And when a
child frame is open, I want the main frame to be hidden or disabled
until the child frame is closed. How can I do this?
Thanks in advance. | Control three frames from main menu | 0 | 0 | 0 | 149 |
5,308,597 | 2011-03-15T07:17:00.000 | 1 | 0 | 1 | 0 | python | 5,308,656 | 7 | false | 0 | 0 | i started with C at university without any knowledge of programming or whatever, i am sure he is better than the times i was a freshman.
but the important point of programming is not the language for the beginning, it is the understanding of solving a problem
teach him writing an algorithm then suggest C/Python whateve... | 1 | 6 | 0 | I hope that this forum is the right place to ask this question!
I am a teacher at a combined middle/high school and one of the eighth graders is interested in teaching himself some programming.
I've recommended Python as an introductory language. I have struggled to find any programming guides, however, that are access... | Good programming guide for a middleschooler | 0.028564 | 0 | 0 | 342 |
5,312,982 | 2011-03-15T14:10:00.000 | 0 | 0 | 1 | 0 | python,diff,difflib | 5,313,340 | 2 | false | 0 | 0 | The short answer is yes.
The long answer is that it will be a lot of work and you'll probably find that you'd be better using another language or an off-the-shelf tool, depending on the vast amount of sources you're likely to be referencing. | 1 | 0 | 0 | I am trying to figure this out...
Can the difflib.* library in Python be used to make some kind of plagiarism detection program? If so how?
Maybe anyone could help me to figure out this question. | Can difflib be used to make a plagiarism detection program? | 0 | 0 | 0 | 1,424 |
5,313,513 | 2011-03-15T14:51:00.000 | 1 | 0 | 0 | 1 | python,p2p | 5,313,852 | 2 | false | 1 | 0 | After 20 minutes of googling all combinations of python and edonkey/emule/ed2k and visiting all sites of all clients listed under the "eDonkey network" Wikipedia page I can say with near certainty that the answer is "No." | 1 | 1 | 0 | I want deploy a project in google appengine to search edonkey/emule, Is there any python implement of edonkey/emule or ed2k protocol library ? | Is there any python implement of edonkey/emule | 0.099668 | 0 | 0 | 2,485 |
5,314,267 | 2011-03-15T15:47:00.000 | 0 | 0 | 1 | 0 | python,timezone | 5,314,445 | 2 | false | 1 | 0 | using strftime is encouraged, but make sure that your localtime is correct. This should be a setting in your app/site assuming you're using django, or you may have to do this manually | 1 | 2 | 0 | I'm working on Google app engine with Python.
I have stored a datetime object in database and fetched it and applied timezone, and I saved it using template. The result is "2011-03-15 16:54:24.398503+09:00", but what I want is: "2011-03-16 01:54:24" (timezone applied string without millisecond - note that day is change... | Datetime string with timezone in Python? | 0 | 0 | 0 | 883 |
5,314,421 | 2011-03-15T15:58:00.000 | 1 | 0 | 1 | 0 | python,django,naming-conventions | 5,315,446 | 6 | false | 1 | 0 | I use lower_case_with_underscore for variables, methods and functions. I think it really improves readability of the code.
For classes, I tend to use upper case the first letter: class NewsForm (forms.Form): | 3 | 14 | 0 | What is the most used convention for naming variables in Python / Django?
ex: pub_date or pubdate
What about for classes and methods? | Naming variable, best convention | 0.033321 | 0 | 0 | 19,912 |
5,314,421 | 2011-03-15T15:58:00.000 | 1 | 0 | 1 | 0 | python,django,naming-conventions | 5,314,880 | 6 | false | 1 | 0 | The important thing is being consistent with your naming style. Choose one with your project mates and use it. Don't mix them. I personally use camelCase:
Sample class name: MyClass (capital letter at the beginning)
Sample method name: myMethod
Sample variable name: myVariable
Sample constant/enum name: MY_CONST
Class ... | 3 | 14 | 0 | What is the most used convention for naming variables in Python / Django?
ex: pub_date or pubdate
What about for classes and methods? | Naming variable, best convention | 0.033321 | 0 | 0 | 19,912 |
5,314,421 | 2011-03-15T15:58:00.000 | 2 | 0 | 1 | 0 | python,django,naming-conventions | 5,314,547 | 6 | false | 1 | 0 | Code Complete (http://www.cc2e.com/) has some great chapters about function/variable naming, not for Python explicitly, but perhaps still interesting... | 3 | 14 | 0 | What is the most used convention for naming variables in Python / Django?
ex: pub_date or pubdate
What about for classes and methods? | Naming variable, best convention | 0.066568 | 0 | 0 | 19,912 |
5,315,829 | 2011-03-15T17:48:00.000 | -1 | 1 | 0 | 0 | python,passwords | 5,316,042 | 5 | false | 0 | 0 | A more advanced idea is to do the mysql authentication manually. That is, learn the mysql protocol (it's a standard handshake with a challenege and a response) and do the procedure yourself. This way, you never send the password directly. | 4 | 13 | 0 | I have a Python script that is connecting to the database. To that, obviously, I need the password. I need to hide it somewhere.
My problem is that this code is stored in a folder that everybody who has access to the server can look. So, if I write this password encrypted in a file, in the code will appear the key to d... | What is the best way of hide a password? | -0.039979 | 0 | 0 | 8,940 |
5,315,829 | 2011-03-15T17:48:00.000 | 0 | 1 | 0 | 0 | python,passwords | 5,316,392 | 5 | false | 0 | 0 | Just to reinforce what Brian said, if a program runs automatically (i.e., without the opportunity to prompt the user for a password), any program that runs under the same user authority has the same access to any password. It's not clear what else you could do. Perhaps if the (trusted) operating system on the client ... | 4 | 13 | 0 | I have a Python script that is connecting to the database. To that, obviously, I need the password. I need to hide it somewhere.
My problem is that this code is stored in a folder that everybody who has access to the server can look. So, if I write this password encrypted in a file, in the code will appear the key to d... | What is the best way of hide a password? | 0 | 0 | 0 | 8,940 |
5,315,829 | 2011-03-15T17:48:00.000 | 10 | 1 | 0 | 0 | python,passwords | 5,315,927 | 5 | true | 0 | 0 | You're using a scripting language and accessing a database directly with a password. No matter what you do, at some level that password is going to be easily accessible. Obscuring it doesn't really buy you much.
You have to rely on the machine's security and permissions, and perhaps the database (restricting access fro... | 4 | 13 | 0 | I have a Python script that is connecting to the database. To that, obviously, I need the password. I need to hide it somewhere.
My problem is that this code is stored in a folder that everybody who has access to the server can look. So, if I write this password encrypted in a file, in the code will appear the key to d... | What is the best way of hide a password? | 1.2 | 0 | 0 | 8,940 |
5,315,829 | 2011-03-15T17:48:00.000 | 7 | 1 | 0 | 0 | python,passwords | 5,316,011 | 5 | false | 0 | 0 | Don't store the database connection credentials in the Python file at all. Instead, store them in a secure place, readable only by the user account that the script will run under.
For example, create a user account for running this job, and create a file in that user account's home directory (readable only by that use... | 4 | 13 | 0 | I have a Python script that is connecting to the database. To that, obviously, I need the password. I need to hide it somewhere.
My problem is that this code is stored in a folder that everybody who has access to the server can look. So, if I write this password encrypted in a file, in the code will appear the key to d... | What is the best way of hide a password? | 1 | 0 | 0 | 8,940 |
5,316,175 | 2011-03-15T18:18:00.000 | 3 | 0 | 0 | 0 | python,emacs,slime | 5,316,229 | 3 | false | 0 | 1 | python-mode is the default mode for editing Python in emacs. It includes commands for evaluating the buffer and running an inferior interpreter instance. | 1 | 11 | 0 | I'm trying to write some python, and I'm used to the lispy way of doing things, a REPL in EMACS and the ability to send arbitrary code snippets to the REPL. I like this way of developing code, and python's built-in IDLE seems to do it pretty well. However I do like EMACS as an editor.
What's the best thing analogous to... | What's the closest thing to SLIME for python ? / What's the best way to use python from EMACS? | 0.197375 | 0 | 0 | 4,224 |
5,316,284 | 2011-03-15T18:26:00.000 | 0 | 0 | 1 | 0 | python,function,background | 5,316,323 | 6 | false | 0 | 0 | Run findCluster() in a thread (the Threading module makes this very easy), and then draw_ascii_spinner until some condition is met.
Instead of using sleep() to set the pace of the spinner, you can wait on the thread's wait() with a timeout. | 2 | 10 | 0 | I have two functions, draw_ascii_spinner and findCluster(companyid).
I would like to:
Run findCluster(companyid) in the backround and while its processing....
Run draw_ascii_spinner until findCluster(companyid) finishes
How do I begin to try to solve for this (Python 2.7)? | Python: run one function until another function finishes | 0 | 0 | 0 | 12,943 |
5,316,284 | 2011-03-15T18:26:00.000 | 1 | 0 | 1 | 0 | python,function,background | 5,316,330 | 6 | false | 0 | 0 | This can be done with threads. FindCluster runs in a separate thread and when done, it can simply signal another thread that is polling for a reply. | 2 | 10 | 0 | I have two functions, draw_ascii_spinner and findCluster(companyid).
I would like to:
Run findCluster(companyid) in the backround and while its processing....
Run draw_ascii_spinner until findCluster(companyid) finishes
How do I begin to try to solve for this (Python 2.7)? | Python: run one function until another function finishes | 0.033321 | 0 | 0 | 12,943 |
5,316,685 | 2011-03-15T19:07:00.000 | 0 | 0 | 1 | 0 | python,hashtable,irc,filehandle | 5,316,964 | 2 | false | 0 | 0 | Create an empty hash:
files = {}
Add items to the hash:
files["gin"] = open('ginpachi.txt','w')
files["ahq"] = open('ahq[DaBomb].txt','w')
Reference them like you would a normal file handler
files["gin"].close()
...
Unfortunately, there wasn't any information on this on the web (specifically with hashes and file handl... | 1 | 0 | 0 | So I'm working on a script that will automatically download certain files from IRC XDCC bots when run. These requests are asynchronous and there can be a varying number, depending on a config file so I wanted to keep the file handles in a hash table or library so they could easily be referenced based on who the file s... | Python hash holding file handles | 0 | 0 | 0 | 405 |
5,317,817 | 2011-03-15T20:44:00.000 | 6 | 0 | 1 | 0 | python,in-place | 5,318,064 | 2 | true | 0 | 0 | According to my Programming Python 4th edition:
By default, pop is equivalent to
fetching, and then deleting, the last
item at offset −1. With an argument,
pop deletes and returns the item at
that offset—list.pop(-1) is the same
as list.pop(). For in-place change
operations like append, insert, del,
and ... | 1 | 6 | 0 | What's the particular reason that some functions in Python operate "IN PLACE", like [].sort and [].reverse, while some others like [].append not? | Python "IN PLACE" functions | 1.2 | 0 | 0 | 19,359 |
5,319,088 | 2011-03-15T22:59:00.000 | 0 | 0 | 0 | 1 | python,web-services | 5,319,171 | 2 | false | 1 | 0 | This is from my experience of using Django with Apache, but have you tried restarting your web server? Sometimes the web server will hold a copy of the code in memory to speed up execution, but restarting your web server will make it reload all *.py files.
Providing more information about the technology stack you are ... | 2 | 1 | 0 | I have a python web service. My problem is when I changed my web service classes. I can't see the changes on the browser and I see last version of web service on the browser all the time.
I used Bottle framework and cgi. | python webservice execution problem | 0 | 0 | 0 | 93 |
5,319,088 | 2011-03-15T22:59:00.000 | 0 | 0 | 0 | 1 | python,web-services | 7,275,232 | 2 | false | 1 | 0 | You need to restart the Bottle app after each change. Doing this manually during development is a pain in the neck. Fortunately Bottle provides a way to automate via a "reloader" option to the Run method:
run(reloader=True)
When you edit & save a module file, the reloader will restart the server process for you... | 2 | 1 | 0 | I have a python web service. My problem is when I changed my web service classes. I can't see the changes on the browser and I see last version of web service on the browser all the time.
I used Bottle framework and cgi. | python webservice execution problem | 0 | 0 | 0 | 93 |
5,320,457 | 2011-03-16T02:40:00.000 | 8 | 0 | 0 | 0 | java,python,django,tomcat | 5,781,961 | 3 | false | 1 | 0 | Here are my experiences:
Django-Apache fits in 16MBs of memory, whereas Java-Tomcat requires much more than that.
Coding in Python is much faster, that is true. In Java, on the other hand, you have compile-time checks, profilers and debuggers that help you increase the stability of your application.
If you are plannin... | 1 | 7 | 0 | In order to develop a web application that can easily scale, provide production stability, is easily deploy-able, and allows for fast development cycles, what points would you recommend I look at before choosing one or the other framework - using Java and Tomcat, or Django and Apache/Mod_WSGI?
Some pros and cons I coul... | Choosing between Django-Apache and Java-Tomcat for a web application | 1 | 0 | 0 | 16,444 |
5,321,079 | 2011-03-16T04:33:00.000 | 3 | 0 | 0 | 1 | python,google-app-engine,google-chrome | 5,322,597 | 1 | true | 1 | 0 | What kind of program is to be executed? You could very well send a request from Chrome extension to your appengine server, process and return the response. | 1 | 0 | 0 | I have a python program which has to execute when i click on the chrome extension.Can I use the Google app engine to do the same?? | Can I use google app engine to run the python program in the background for chrome extension? | 1.2 | 0 | 0 | 136 |
5,321,699 | 2011-03-16T06:14:00.000 | 1 | 0 | 0 | 0 | python,sqlite | 5,321,757 | 2 | false | 0 | 0 | Where is your python process running from? Try to point to the absolute path of the file. And when pointing to path use raw string r'c:\\mypath\data\notktalar.sub' | 1 | 3 | 0 | When I put my database file (which is a .sdb) into a directory and try to access it from that directory, I receive an error. The error reads "unable to open database file". For example, let's say my .sdb file is in the "data" directory and I use the command "con = lite.connect('data\noktalar.sdb')", this error occurs. ... | Python Database Error | 0.099668 | 1 | 0 | 324 |
5,321,789 | 2011-03-16T06:28:00.000 | 19 | 1 | 0 | 0 | python,performance,jinja2,pyramid,chameleon | 5,324,691 | 3 | false | 1 | 0 | Template engines are rarely the cause of performance problems, even if chameleon is slightly faster than Jinja2 I doubt the effort of learning a new template language etc. is worth it.
Optimization of database queries and caching will probably result in more performance than you could gain by switching the template en... | 1 | 12 | 0 | Has anyone here done any benchmarking of Chameleon versus Jinja2, in respect to performance? I'm more used to the Jinja syntax, since I come from Django, but as Pyramid suggests to use Chameleon, I'm thinking if it would be nice to give it a try - despite having an awkward syntax, IMO. | Speed comparisons between Chameleon and Jinja2 | 1 | 0 | 0 | 6,518 |
5,322,445 | 2011-03-16T08:00:00.000 | 5 | 0 | 0 | 1 | python,gevent | 5,338,718 | 3 | true | 0 | 0 | first instance of StreamServer could be started with: server.start() and second with server2.serve_forever() | 2 | 3 | 0 | I have daemon which has connection pool to handlerSocket. I have 2 types of clients and their protocol differs. I want to setup 2 listeners which handles each protocol and shares connection pool between them. In twisted this is relatively easy to accomplish, but couldn't find out how to do this in gevent.
Thanks! | gevent multiple StreamServer listeners | 1.2 | 0 | 0 | 1,772 |
5,322,445 | 2011-03-16T08:00:00.000 | 0 | 0 | 0 | 1 | python,gevent | 8,439,364 | 3 | false | 0 | 0 | I think the problem will come from the StreamServer's stop() method.
It kills the pool, so, finishing one of listeners will drop all connections, from both listeners.
If this is does not frighten you, you can simply pass the same Pool object to both StreamServers, running each of them in the separate greenlet. | 2 | 3 | 0 | I have daemon which has connection pool to handlerSocket. I have 2 types of clients and their protocol differs. I want to setup 2 listeners which handles each protocol and shares connection pool between them. In twisted this is relatively easy to accomplish, but couldn't find out how to do this in gevent.
Thanks! | gevent multiple StreamServer listeners | 0 | 0 | 0 | 1,772 |
5,327,465 | 2011-03-16T15:20:00.000 | 1 | 1 | 0 | 1 | python,fabric | 14,738,198 | 8 | false | 0 | 0 | As stated above, Fabric will support .ssh/config file settings after a fashion, but using a pem file for ec2 seems to be problematic. IOW a properly setup .ssh/config file will work from the command line via 'ssh servername' and fail to work with 'fab sometask' when env.host=['servername'].
This was overcome by speci... | 1 | 101 | 0 | How do you configure fabric to connect to remote hosts using SSH keyfiles (for example, Amazon EC2 instances)? | Using an SSH keyfile with Fabric | 0.024995 | 0 | 0 | 58,539 |
5,327,485 | 2011-03-16T15:21:00.000 | 2 | 0 | 1 | 0 | javascript,python,google-chrome | 25,336,537 | 3 | false | 1 | 0 | Probably a late reply but a possible solution is to make your python script act as a server and let the browser plugin interact with it. | 2 | 4 | 0 | I have written a module in python which performs some function.
I then created a Google Chrome extension which makes use of JSON and javascript.
Now when I click on the extension I want it to execute the python program which is stored on my hard disk and display the output on the browser again.
Is there a way in which... | How can I execute a Python script from Javascript? | 0.132549 | 0 | 1 | 17,271 |
5,327,485 | 2011-03-16T15:21:00.000 | 1 | 0 | 1 | 0 | javascript,python,google-chrome | 5,328,172 | 3 | false | 1 | 0 | forgive me if i'm incorrect on infinite proportions.
I believe that JavaScript is executed in a sandboxed/ isolated environment. Therefore you cannot invoke a python interpreter* or any other executable residing on the system.
*unless the interpreter itself were written in javascript. | 2 | 4 | 0 | I have written a module in python which performs some function.
I then created a Google Chrome extension which makes use of JSON and javascript.
Now when I click on the extension I want it to execute the python program which is stored on my hard disk and display the output on the browser again.
Is there a way in which... | How can I execute a Python script from Javascript? | 0.066568 | 0 | 1 | 17,271 |
5,328,112 | 2011-03-16T16:05:00.000 | 2 | 0 | 0 | 0 | python,google-app-engine,google-cloud-datastore | 5,331,814 | 2 | true | 1 | 0 | If it's really created once and never changes within the lifetime of a deployment, and it's relatively small (a few megs or less), store it with your app as data files. Have the app load the data into memory initially, and cache it there. | 1 | 2 | 0 | I'm using the Python version of Google App Engine and Datastore. What is a good way to load a table that will contain lookup data?
By look up data I mean that after the initial load no rows will need to be inserted, deleted, or updated
Blowing away all rows and reloading the table is not acceptable if it destroys refe... | Need Pattern for lookup tables in Google App Engine | 1.2 | 1 | 0 | 319 |
5,328,691 | 2011-03-16T16:47:00.000 | 0 | 0 | 0 | 0 | python,controls,version | 5,329,651 | 1 | true | 1 | 0 | The only reasonable way to do what you want is to have application B work against formal releases of application A, even if those releases are labled beta or release candidate. IOW, do not treat application A as source code, but as an imported module installed with setup.py or other means.
Doing it this way will let yo... | 1 | 0 | 0 | I'm developing two pylons applications at the same time. Application B uses a lot of the controllers, etc. in application A. Both applications are under active development, but for administrative reasons, they have to be kept separate.
Is there a convenient way to do version control so that changes to A are easy to pul... | Is there a good way to do version control when developing pylons applications with dependencies? | 1.2 | 0 | 0 | 96 |
5,328,789 | 2011-03-16T16:55:00.000 | 3 | 0 | 0 | 0 | python,django,model-view-controller,cakephp,symfony1 | 5,328,917 | 4 | true | 1 | 0 | Use django to two years, and I had an experience of a project using cakephp and hated it. Django was able to show better in all aspects, much of it takes the python and transparent way how the framework works. I strongly recommend Django. | 2 | 0 | 0 | I am a database guy and its been few years since I did anything with PHP (no MVC experience). I now have to work on a Data Entry project - a form that a user will fill and submit data to the database. I figured this is much more efficient than a spreadsheet approach.
All I need is :
1) Authentication
2) Validation of ... | What is the best, efficient approach to do a quick forms based web project? | 1.2 | 0 | 0 | 142 |
5,328,789 | 2011-03-16T16:55:00.000 | 2 | 0 | 0 | 0 | python,django,model-view-controller,cakephp,symfony1 | 5,329,526 | 4 | false | 1 | 0 | If you're just doing some one off data gathering, you could save yourself the work and use Google Spreadsheets ( Create New -> Form). I know you mentioned spreadsheets, but once you've got the data you can export it and do what you want with it.
It's a simple solution and might not fit, but if it does it'll cut your t... | 2 | 0 | 0 | I am a database guy and its been few years since I did anything with PHP (no MVC experience). I now have to work on a Data Entry project - a form that a user will fill and submit data to the database. I figured this is much more efficient than a spreadsheet approach.
All I need is :
1) Authentication
2) Validation of ... | What is the best, efficient approach to do a quick forms based web project? | 0.099668 | 0 | 0 | 142 |
5,329,573 | 2011-03-16T17:55:00.000 | 1 | 0 | 1 | 0 | c++,python,memory,udp,buffer | 5,338,033 | 5 | true | 0 | 0 | When asking particular questions, you should aim at providing as much information as possible. You have added a use case, but the use case is incomplete.
Your particular use case seems like a very small amount of data that has to be available at a high frequency 10kHz. I would first try to determine whether I can actua... | 4 | 4 | 0 | I've never had formal training in this area so I'm wondering what do they teach in school (if they do).
Say you have two programs in written in two different languages: C++ and Python or some other combination and you want to share a constantly updated variable on the same machine, what would you use and why? The infor... | What is the defacto standard for sharing variables between programs in different languages? | 1.2 | 0 | 0 | 486 |
5,329,573 | 2011-03-16T17:55:00.000 | 0 | 0 | 1 | 0 | c++,python,memory,udp,buffer | 5,330,201 | 5 | false | 0 | 0 | It almost always pass through C binding. | 4 | 4 | 0 | I've never had formal training in this area so I'm wondering what do they teach in school (if they do).
Say you have two programs in written in two different languages: C++ and Python or some other combination and you want to share a constantly updated variable on the same machine, what would you use and why? The infor... | What is the defacto standard for sharing variables between programs in different languages? | 0 | 0 | 0 | 486 |
5,329,573 | 2011-03-16T17:55:00.000 | 2 | 0 | 1 | 0 | c++,python,memory,udp,buffer | 5,329,676 | 5 | false | 0 | 0 | Don't know if this will be helpful, but I'm also a student, and this is what I think you mean.
I've used marshalling to get a java class and import it into a C# program.
With marshalling you use xml to transfer code in a way so that it can be read by other coding environments. | 4 | 4 | 0 | I've never had formal training in this area so I'm wondering what do they teach in school (if they do).
Say you have two programs in written in two different languages: C++ and Python or some other combination and you want to share a constantly updated variable on the same machine, what would you use and why? The infor... | What is the defacto standard for sharing variables between programs in different languages? | 0.07983 | 0 | 0 | 486 |
5,329,573 | 2011-03-16T17:55:00.000 | 2 | 0 | 1 | 0 | c++,python,memory,udp,buffer | 5,329,649 | 5 | false | 0 | 0 | Well you can write XML and use some basic message queuing (like rabbitMQ) to pass messages around | 4 | 4 | 0 | I've never had formal training in this area so I'm wondering what do they teach in school (if they do).
Say you have two programs in written in two different languages: C++ and Python or some other combination and you want to share a constantly updated variable on the same machine, what would you use and why? The infor... | What is the defacto standard for sharing variables between programs in different languages? | 0.07983 | 0 | 0 | 486 |
5,329,668 | 2011-03-16T18:02:00.000 | 3 | 0 | 0 | 0 | python,unicode,minidom | 5,333,621 | 5 | false | 1 | 0 | Minidom doesn't directly support parsing Unicode strings; it's something that has historically had poor support and standardisation. Many XML tools recognise only byte streams as something an XML parser can consume.
If you have plain files, you should either read them in as byte strings (not Unicode!) and pass that to ... | 1 | 12 | 0 | I'm trying to parse a bunch of xml files with the library xml.dom.minidom, to extract some data and put it in a text file. Most of the XMLs go well, but for some of them I get the following error when calling minidom.parsestring():
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 5189: or... | How to parse unicode strings with minidom? | 0.119427 | 0 | 1 | 16,977 |
5,329,684 | 2011-03-16T18:04:00.000 | 3 | 0 | 1 | 0 | python,virtualenv,pip | 5,330,043 | 3 | false | 0 | 0 | Nope. You can run your own PyPI mirror or caching proxy server, but that's about it. | 1 | 15 | 0 | I'm working on a new project that needs a new virtualenv. When I do pip install -r requirements.txt, it downloads the packages all over again even though those packages already exist on the previous project's virtualenv.
Is there any way to tell pip to get the packages from the other virtualenv instead? | Can pip use existing packages rather than downloading again? | 0.197375 | 0 | 0 | 2,659 |
5,329,942 | 2011-03-16T18:25:00.000 | 0 | 0 | 0 | 0 | javascript,python | 5,330,014 | 2 | false | 1 | 0 | You can if you're running a server with Python.
Create a simple server with python and return json. The only requirement is that the python server must be started in order to except requests. | 1 | 0 | 0 | Can I send the url of the page from the javascript to the python program running on the client machine ??
Also can I redirect the output of the python program to the javascript to be displayed on the browser? | Is it possible to send a URL from javascript running on the browser to the python program running on the client machine? | 0 | 0 | 1 | 73 |
5,330,010 | 2011-03-16T18:30:00.000 | 2 | 0 | 0 | 0 | python,serialization,numpy,scipy | 5,330,143 | 4 | false | 0 | 0 | I would suggest to use scipy.save and have an dictionnary between the word and the name of the files. | 1 | 7 | 1 | BACKGROUND
The issue I'm working with is as follows:
Within the context of an experiment I am designing for my research, I produce a large number of large (length 4M) arrays which are somewhat sparse, and thereby could be stored as scipy.sparse.lil_matrix instances, or simply as scipy.array instances (the space gain/l... | Dictionary-like efficient storing of scipy/numpy arrays | 0.099668 | 0 | 0 | 3,381 |
5,331,266 | 2011-03-16T20:20:00.000 | 1 | 0 | 0 | 0 | python,screen-scraping,beautifulsoup,web-scraping | 5,331,407 | 3 | false | 1 | 0 | It is perfectly possible. Easiest way is to iterate through list of URLs, load the content, find the URLs, add them to main list. Stop iteration when enough pages are found.
Just some tips:
urllib2.urlopen for fetching content
BeautifulSoup: findAll('a') for finding URLs | 1 | 6 | 0 | What's the easiest way to scrape just the text from a handful of webpages (using a list of URLs) using BeautifulSoup? Is it even possible?
Best,
Georgina | Python - Easiest way to scrape text from list of URLs using BeautifulSoup | 0.066568 | 0 | 1 | 6,124 |
5,334,284 | 2011-03-17T02:39:00.000 | 4 | 0 | 1 | 0 | python,dictionary | 5,334,309 | 4 | false | 0 | 0 | Look at Objects/dictobject.c in the Python source code. | 1 | 11 | 0 | I want to view the source code of the python dict type but i can't find it.
I'm looking for python 2.6. | Where is the source code for the python 'dict' type? | 0.197375 | 0 | 0 | 16,267 |
5,335,330 | 2011-03-17T05:42:00.000 | 0 | 0 | 0 | 0 | python,sqlite,data-modeling | 5,339,473 | 3 | false | 0 | 0 | If your database is pretty much a collection of almost-homogenic data, you could as well go for a simpler key-value database. If the main action you perform on the data is scanning through everything, it would perform significantly better.
Python library has bindings for popular ones as "anydbm". There is also a dict-i... | 2 | 0 | 0 | I'm designing a python application which works with a database. I'm planning to use sqlite.
There are 15000 objects, and each object has a few attributes. every day I need to add some data for each object.(Maybe create a column with the date as its name).
However, I would like to easily delete the data which is too old... | Please help me design a database schema for this: | 0 | 1 | 0 | 113 |
5,335,330 | 2011-03-17T05:42:00.000 | 0 | 0 | 0 | 0 | python,sqlite,data-modeling | 5,335,386 | 3 | false | 0 | 0 | For that size of a db, I would use something else. I've used sqlite once for a media library with about 10k objects and it was slow, like 5 minutes to query it all and display, searches were :/, switching to postgres made life so much easier. This is just on the performance issue only.
It also might be better to creat... | 2 | 0 | 0 | I'm designing a python application which works with a database. I'm planning to use sqlite.
There are 15000 objects, and each object has a few attributes. every day I need to add some data for each object.(Maybe create a column with the date as its name).
However, I would like to easily delete the data which is too old... | Please help me design a database schema for this: | 0 | 1 | 0 | 113 |
5,335,845 | 2011-03-17T06:57:00.000 | 0 | 0 | 0 | 0 | python,mysql,django | 5,336,126 | 2 | false | 1 | 0 | I have a feeling your database schema knows this is a date, right? In that case it's not being stored in the format you describe, but as some representation such as seconds since the era.
This means that when you retreave it your code has to do something with it to make it look right. If you don't tell it how to look ... | 1 | 0 | 0 | my datetime property is saving in mysql in this format 2011-03-17 00:00:00 but after fetchind the data with filter function it is giving March 17,2011 midnight but i have not say to do any this type of task. My question is how can i insist django to stic to show same value what is saved in MYSQL. | django autoconverting datetime property | 0 | 0 | 0 | 699 |
5,336,320 | 2011-03-17T07:54:00.000 | 2 | 0 | 1 | 0 | python,types | 5,336,368 | 9 | false | 0 | 0 | Yes it is.
In Python a function doesn't always have to return a variable of the same type (although your code will be more readable if your functions do always return the same type). That means that you can't specify a single return type for the function.
In the same way, the parameters don't always have to be the s... | 3 | 129 | 0 | While I am aware of the duck-typing concept of Python, I sometimes struggle with the type of arguments of functions, or the type of the return value of the function.
Now, if I wrote the function myself, I DO know the types. But what if somebody wants to use and call my functions, how is he/she expected to know the type... | How to know function return type and argument types? | 0.044415 | 0 | 0 | 194,909 |
5,336,320 | 2011-03-17T07:54:00.000 | 1 | 0 | 1 | 0 | python,types | 5,339,458 | 9 | false | 0 | 0 | For example: how to describe concisely in a docstring that a function returns a list of tuples, with each tuple of the form (node_id, node_name, uptime_minutes) and that the elements are respectively a string, string and integer?
Um... There is no "concise" description of this. It's complex. You've designed it to be... | 3 | 129 | 0 | While I am aware of the duck-typing concept of Python, I sometimes struggle with the type of arguments of functions, or the type of the return value of the function.
Now, if I wrote the function myself, I DO know the types. But what if somebody wants to use and call my functions, how is he/she expected to know the type... | How to know function return type and argument types? | 0.022219 | 0 | 0 | 194,909 |
5,336,320 | 2011-03-17T07:54:00.000 | 22 | 0 | 1 | 0 | python,types | 5,336,458 | 9 | true | 0 | 0 | This is how dynamic languages work. It is not always a good thing though, especially if the documentation is poor - anyone tried to use a poorly documented python framework? Sometimes you have to revert to reading the source.
Here are some strategies to avoid problems with duck typing:
create a language for your probl... | 3 | 129 | 0 | While I am aware of the duck-typing concept of Python, I sometimes struggle with the type of arguments of functions, or the type of the return value of the function.
Now, if I wrote the function myself, I DO know the types. But what if somebody wants to use and call my functions, how is he/she expected to know the type... | How to know function return type and argument types? | 1.2 | 0 | 0 | 194,909 |
5,336,583 | 2011-03-17T08:25:00.000 | 0 | 0 | 0 | 0 | python | 5,338,054 | 1 | false | 0 | 0 | I haven't used Xlib before
But you may try that
window.right = -100
use negative number as the same of minimize | 1 | 2 | 0 | How to minimize a window using Xlib in python? | Minimize window using Xlib in python | 0 | 0 | 0 | 448 |
5,337,351 | 2011-03-17T09:45:00.000 | 0 | 0 | 0 | 0 | python,django,design-decisions,django-users | 5,337,521 | 4 | false | 1 | 0 | Currently, you have some requirements, but over time they may change. Django's user system is quite straightforward, and using it allows to adapt more easily to some of the most common use cases.
Another aspect to think about, is that there are several applications already available that you can use, and that may requi... | 2 | 4 | 0 | I'm currently designing a Django based site. For simplicity lets assume that it is a simple community site where users can log in and write messages to other users.
My current choice is wether to use the buildin User-Model or to build something my own. I don't need much from the buildin User: there will be no username ... | Use Django User-Model or create a own Model? | 0 | 0 | 0 | 2,331 |
5,337,351 | 2011-03-17T09:45:00.000 | 2 | 0 | 0 | 0 | python,django,design-decisions,django-users | 5,593,711 | 4 | false | 1 | 0 | As the author of django-primate I would like to add some comments. Django-primate which easily lets ju modify the built in User model is meant for just that. You might need just something a little extra, then use django-primate.
But there are problems, although I do not think modifying the django User model per se is a... | 2 | 4 | 0 | I'm currently designing a Django based site. For simplicity lets assume that it is a simple community site where users can log in and write messages to other users.
My current choice is wether to use the buildin User-Model or to build something my own. I don't need much from the buildin User: there will be no username ... | Use Django User-Model or create a own Model? | 0.099668 | 0 | 0 | 2,331 |
5,337,682 | 2011-03-17T10:16:00.000 | 1 | 0 | 1 | 0 | python | 5,337,764 | 3 | false | 0 | 0 | What has this to do with Python? Either use an absolute path or a relative path using the wellknown ".." notation. This is Shell basic knowhow. | 1 | 3 | 0 | I have a python script say "foo_1.py" which resides in folder x and another script foo_2.py which resides in folder y.
Folders x and y are in folder z.
I called a method which belongs to foo_2.py which generates an image in folder y (say img1.png).
Now what I want is to access this img1.png from foo_1.py. How is it ... | How to Access a image from another directory? python | 0.066568 | 0 | 0 | 7,797 |
5,338,979 | 2011-03-17T12:26:00.000 | 1 | 0 | 0 | 0 | javascript,python,python-3.x,web-scraping | 5,352,888 | 3 | false | 1 | 0 | Use Firebug to see exactly what is being called to get the data to display (a POST or GET url?). I suspect there's an AJAX call that's retrieving the data from the server either as XML or JSON. Just call the same AJAX call, and parse the data yourself.
Optionally, you can download Selenium for Firefox, start a Seleniu... | 2 | 0 | 0 | i'm working in python 3.2 (newb) on windows machine (though i have ubuntu 10.04 on virtual box if needed, but i prefer to work on the windows machine).
Basically i'm able to work with the http module and urlib module to scrape web pages, but only those that don't have java script document.write("<div....") and the like... | Scraping a web page with java script in Python | 0.066568 | 0 | 1 | 8,915 |
5,338,979 | 2011-03-17T12:26:00.000 | 0 | 0 | 0 | 0 | javascript,python,python-3.x,web-scraping | 5,340,415 | 3 | false | 1 | 0 | document.write is usually used because you are generating the content on the fly, often by fetching data from a server. What you get are web apps that are more about javascript than HTML. "Scraping" is rather more a question of downloading HTML and processing it, but here there isn't any HTML to download. You are essen... | 2 | 0 | 0 | i'm working in python 3.2 (newb) on windows machine (though i have ubuntu 10.04 on virtual box if needed, but i prefer to work on the windows machine).
Basically i'm able to work with the http module and urlib module to scrape web pages, but only those that don't have java script document.write("<div....") and the like... | Scraping a web page with java script in Python | 0 | 0 | 1 | 8,915 |
5,341,448 | 2011-03-17T15:43:00.000 | 0 | 0 | 0 | 0 | python,django,forms,datetime,default | 5,345,806 | 2 | false | 1 | 0 | I tend to do these types of defaults in the models save() method or when the pre_save signal is called. | 2 | 2 | 0 | I have a DateTimeField on a model. In the forms for that model, I use the SplitDateTimeWidget. I want to enable users to enter just a date, and have my code define a default time (like 2 p.m.) if one is not entered.
Is there a simple way to do this? Since this is needed for multiple forms, I would like to have a way th... | How to add a default time (but not date) to a DateTimeField in DJango? | 0 | 0 | 0 | 194 |
5,341,448 | 2011-03-17T15:43:00.000 | 1 | 0 | 0 | 0 | python,django,forms,datetime,default | 5,341,535 | 2 | false | 1 | 0 | You may be able to do this by subclassing DateTimeField and over-riding the clean() method. | 2 | 2 | 0 | I have a DateTimeField on a model. In the forms for that model, I use the SplitDateTimeWidget. I want to enable users to enter just a date, and have my code define a default time (like 2 p.m.) if one is not entered.
Is there a simple way to do this? Since this is needed for multiple forms, I would like to have a way th... | How to add a default time (but not date) to a DateTimeField in DJango? | 0.099668 | 0 | 0 | 194 |
5,341,954 | 2011-03-17T16:19:00.000 | 3 | 0 | 0 | 0 | python,qt,garbage-collection,pyqt4 | 5,341,992 | 1 | true | 0 | 1 | I had this - somewhere you have an reference to your widget, and that reference has been counted... the only way to delete that widget is to make sure that there are no remaining references so python can garbage-collect it.
At least you don't end up with a dangling reference like C++, which can lead to some nasty crash... | 1 | 3 | 0 | It might be the bindings (SIP) or even python, but I have a problem with Qt (pyqt4).
I have a QTabWidget, and inside it I put widgets one can close.
I have a widget that allocates about 400mb of memory. I have not set a parent, and I call deleteLater() on close but nothing happens. Even calling the python's gc does not... | Memory not deallocated - PyQt4 | 1.2 | 0 | 0 | 1,477 |
5,342,359 | 2011-03-17T16:47:00.000 | 1 | 0 | 0 | 0 | python,database,postgresql | 5,342,409 | 4 | false | 0 | 0 | Really we need more information. What data is inside the tuple? Is it just integers? Just strings? Is it megabytes of images?
If you had a Python tuple like (4,6,2,"Hello",7) you could insert the string '(4,6,2,"Hello",7)' into a Postgres database, but that's probably not the answer you're looking for.
You really need ... | 2 | 0 | 0 | is it possible to Insert a python tuple in a postgresql database | is it possible to Insert a python tuple in a postgresql database | 0.049958 | 1 | 0 | 4,015 |
5,342,359 | 2011-03-17T16:47:00.000 | 1 | 0 | 0 | 0 | python,database,postgresql | 5,342,419 | 4 | false | 0 | 0 | This question does not make any sense. You can insert using SQL whatever is supported by your database model. If you need a fancy mapper: look at an ORM like SQLAlchemy. | 2 | 0 | 0 | is it possible to Insert a python tuple in a postgresql database | is it possible to Insert a python tuple in a postgresql database | 0.049958 | 1 | 0 | 4,015 |
5,342,430 | 2011-03-17T16:54:00.000 | 2 | 0 | 1 | 0 | python | 5,342,516 | 2 | true | 0 | 0 | SQLite is a nice solution, as the database wrapper will handle locking of reads and writes (within the database) for you. You can even use a column as your file's read/write lock. | 1 | 2 | 0 | I design a multi-threaded application that will monitor and handle files in selected folders (according to user preference).
What is the best way to store information on the files ?
(e.g. User add xxx directory, I need to go over the directory and add all the files and sub dir to my application)
I was considering my ow... | How to store folders/files tree | 1.2 | 0 | 0 | 349 |
5,343,264 | 2011-03-17T18:05:00.000 | 0 | 1 | 0 | 1 | python,pipe | 5,343,298 | 3 | false | 0 | 0 | How about one of them being a thread started by the another one? | 1 | 1 | 0 | I used MailSlots with Delphi for my softwares when I needed dialogs between them (on MS Windows on the same coputer).
Now I need to do the same things but with Python and on MS Windows but also on Linux.
So : what is the best way to communicate between Python written software running on the same computer ?
For some fir... | What is the best way to communicate between Python softwares running on the same computer? | 0 | 0 | 0 | 368 |
5,344,641 | 2011-03-17T20:10:00.000 | 0 | 0 | 0 | 1 | python,linux,centos,cassandra,yum | 5,344,716 | 2 | false | 0 | 0 | Try installing rrdtool via yum, that should contain librrd.so.2 and correct your issue. | 1 | 2 | 0 | I am attemping to install OpsCenter for Cassandra, and using the the standard REHL image. I can't figure out how to get this to work. Another version of EPEL perhaps?
yum install opscenter....
Error: Package: python26-rrdtool-1.2.27-1.i386 (opscenter)
Requires: librrd.so.2 | Amazon Linux AMI EC2 - librrd.so.2 dependency issue | 0 | 1 | 0 | 410 |
5,346,169 | 2011-03-17T22:41:00.000 | 1 | 0 | 1 | 0 | python,windows,automation,ui-automation,pywin32 | 5,346,365 | 3 | false | 0 | 0 | I feel I just need like a "chill out"
function to cause Python to stop
whatever it is it's doing, let the
targeted UI recover and refresh and
process input, then bring it back to
Python. What function would do that?
Calling sleep() (any variant of it) will block execution of the thread from which you call it... | 1 | 2 | 0 | I'm automating some windows stuff with Python, using PIL to take screenshots and such. the issue is that sometimes, deep in some function, I'll do a time.sleep(1) and the GUI app I'm interfacing with will freeze for that second. This is weird cause doing time.sleep in other places doesn't cause the freeze. I haven't be... | python+windows automation - windows glitch sometimes | 0.066568 | 0 | 0 | 473 |
5,346,295 | 2011-03-17T22:55:00.000 | 16 | 0 | 0 | 0 | python,pyramid,chameleon,template-tal | 10,369,248 | 2 | false | 1 | 0 | Chameleon also allows ${structure: markup}. | 1 | 4 | 0 | I can't make sense of chameleon's tags. I'm a django user, but decided to introduce my CompSci course mates and myself to Pyramid, since I though more lightweight = easier to learn.
At the moment the ${} tag is escaping any html tags I'm trying to output through it. In django there was some way to specify that a variab... | Python Pyramid & Chameleon templating language escapes html | 1 | 0 | 0 | 3,750 |
5,348,163 | 2011-03-18T04:39:00.000 | 2 | 0 | 1 | 0 | python,collision-detection,bounding-box,frustum | 5,381,995 | 2 | false | 0 | 0 | That will work. However, usually one would rather extract the frustum planes and calculate the distances to these. You said "speed is not a big deal", but eventually you may find that it is. After all, one does frustum culling to make things faster.
Multiplying a vertex with a matrix takes the equivalent of 4 dot produ... | 1 | 3 | 0 | I want to check a view frustum against the axis aligned bounding boxes of some objects, to check roughly whether those objects are in the field of view or not. Speed is not a big deal. | Checking for bounding box intersections/collisions with a view frustum | 0.197375 | 0 | 0 | 3,799 |
5,348,981 | 2011-03-18T06:57:00.000 | 0 | 0 | 0 | 0 | python,django | 5,349,122 | 1 | false | 1 | 0 | By using a sql query. This is really basic stuff, like the other questions you have asked. Buy a book or use google, there's plenty of info out there on this stuff. | 1 | 0 | 0 | How we can provide all objects of class which are stored in mysql data when application start with /admin url. | How to call view from view.py in /admin url in django | 0 | 0 | 0 | 231 |
5,350,089 | 2011-03-18T09:25:00.000 | 1 | 0 | 0 | 0 | python,django,django-models,django-admin | 5,350,427 | 2 | false | 1 | 0 | If you look into caching solutions, they will probably do what you need.
The general queryset caching solution I use in johnny-cache, but for what you need, you can probably just load it up from the db and store it in the cache. | 2 | 1 | 0 | I'm new to Django and I'm working on the public website for a small company.
I'm facing an issue that I guess has already been encountered by lots a django noobs,
but I can't manage to find a good solution.
My problem is that there some informations (contact address, office phone number, company description...) that I... | Storing/Retrieving/Editing project specific data with Django | 0.099668 | 0 | 0 | 96 |
5,350,089 | 2011-03-18T09:25:00.000 | 0 | 0 | 0 | 0 | python,django,django-models,django-admin | 5,350,914 | 2 | false | 1 | 0 | What you want to do is use select_related('contact_profile','office_data') etc when you query the items in your view, and in the admin, instead of registering all the data separately just use the InlineAdmin class for the Admin site and you will be able to edit all the information as if it was a single entity.
Check ou... | 2 | 1 | 0 | I'm new to Django and I'm working on the public website for a small company.
I'm facing an issue that I guess has already been encountered by lots a django noobs,
but I can't manage to find a good solution.
My problem is that there some informations (contact address, office phone number, company description...) that I... | Storing/Retrieving/Editing project specific data with Django | 0 | 0 | 0 | 96 |
5,350,491 | 2011-03-18T10:10:00.000 | 2 | 1 | 0 | 0 | python,linux | 5,350,513 | 2 | false | 0 | 0 | You could try reading /dev/input/mice. | 1 | 0 | 0 | How can i detect mouse movement in a python script in linux?
I want to then send those events to a handler which will dispatch that where i can process it later.
There is no gui installed if that matters. | How can i simply detect mouse movement in python? | 0.197375 | 0 | 0 | 3,099 |
5,350,599 | 2011-03-18T10:21:00.000 | 0 | 0 | 0 | 0 | python,mongodb,pymongo | 5,377,084 | 3 | false | 0 | 0 | You can simply get config databasr and
execute find() on shards collection
just like normal collection. | 1 | 0 | 0 | I have a Webserver running in Python. He is getting some Data from some Apps and need to store these in MongoDB. My MongoDB is sharded.
Now i want that my Webserver know how much Shards MongoDB has. At the moment he reads this from a cfg file. There is an Statement in MongoDb named printshardingstatus where u can see ... | Execute MongoDb Statements in Python | 0 | 1 | 0 | 1,576 |
5,350,958 | 2011-03-18T10:56:00.000 | 4 | 1 | 1 | 0 | python,unicode | 5,351,400 | 3 | true | 0 | 0 | str and unicode are classes, not functions. When you call str(u'abcd') you are initialising a new string which takes 'abcd' as a variable. It just so happens that str() can be used to convert a string of any type to an ascii str.
Other areas to look out for are when reading from a file/input, or basically anything you ... | 2 | 4 | 0 | We are moving from latin1 to UTF-8 and have 100k lines of python code.
Plus I'm new in python (ha-ha-ha!).
I already know that str() function fails when receiving Unicode so we should use unicode() instead of it with almost the same effect.
What are the other "dangerous" places of code?
Are there any basic guidelines/a... | How to move a python 2.6 project to UTF-8? | 1.2 | 0 | 0 | 1,414 |
5,350,958 | 2011-03-18T10:56:00.000 | 2 | 1 | 1 | 0 | python,unicode | 5,357,350 | 3 | false | 0 | 0 | Can it be written an automatic 'code transformer'? =)
No. str and unicode are two different types which have different purposes. You should not attempt to replace every occurrence of a byte string with a Unicode string, neither in Python 2 nor Python 3.
Continue to use byte strings for binary data. In particular anyth... | 2 | 4 | 0 | We are moving from latin1 to UTF-8 and have 100k lines of python code.
Plus I'm new in python (ha-ha-ha!).
I already know that str() function fails when receiving Unicode so we should use unicode() instead of it with almost the same effect.
What are the other "dangerous" places of code?
Are there any basic guidelines/a... | How to move a python 2.6 project to UTF-8? | 0.132549 | 0 | 0 | 1,414 |
5,351,250 | 2011-03-18T11:23:00.000 | 0 | 0 | 0 | 0 | python,web-services,soap,soaplib | 5,389,161 | 1 | true | 1 | 0 | a bit ugly, but looks like it works:
if '' != length:
body = input.read(int(length))
elif req_env.get("HTTP_TRANSFER_ENCODING").lower() == 'chunked':
chunk_size = int(input.readline(), 16)
while chunk_size > 0:
chunk_read_size... | 1 | 0 | 0 | I have soap webservice built with soaplib,
but if client sent chunked request it fails on
length = req_env.get("CONTENT_LENGTH")
body = input.read(int(length))
because length is '' (empty string), any ideas how to fix soaplib? | fix soaplib to support chunked requests | 1.2 | 0 | 1 | 279 |
5,353,984 | 2011-03-18T15:14:00.000 | 2 | 0 | 0 | 0 | python,django | 5,354,095 | 2 | false | 1 | 0 | I use _meta in several projects where I want to have generic access to information that's otherwise not provided by the api. I think you're probably okay most of the time as Django is pretty stable. It's probably a good idea to be covering your usage of _meta in your unit tests. | 1 | 5 | 0 | Django uses Meta class for lots of additional object information. However, they store this information in an object '_meta' which by naming convention is private.
All over the django admin (and other places) I see stuff like opts = model._meta and then they use the various options like app_label and verbose_name.
Can I... | Is it safe to access ._meta directly in your django app? | 0.197375 | 0 | 0 | 1,686 |
5,354,436 | 2011-03-18T15:45:00.000 | 1 | 0 | 1 | 0 | python,floating-point | 5,354,454 | 2 | false | 0 | 0 | There isn't a built-in type in Python that's represented using 32-bit floats.
However, see Sven Marnach's answer for alternatives. | 1 | 5 | 0 | I am trying to understand the exact nature of float when it comes to python. Apparently, python stores floats in a PyFloatObject type which contains a double. However, how can I force it to behave like a 32 bit floating point variable ? Is there another type for this ? | python floating point nature and converting to a smaller type | 0.099668 | 0 | 0 | 686 |
5,354,676 | 2011-03-18T16:04:00.000 | 39 | 1 | 1 | 0 | python | 5,356,035 | 7 | true | 0 | 0 | Thanks @Dharmesh. That was what I needed. There is only one change that needs to be made. The module won't be importing itself so to get the module object I can do:
setattr(sys.modules[__name__], 'attr1', 'attr1') | 1 | 23 | 0 | I have a need to add module attributes at run time. For example, when a module is loaded, it reads the file where the data is contained. I would like that data to be available as a module attribute, but the data is only available at run time.
How can I add module attributes at run time? | How can I add attributes to a module at run time? | 1.2 | 0 | 0 | 16,367 |
5,355,239 | 2011-03-18T16:50:00.000 | 1 | 0 | 1 | 0 | python,methods,code-organization | 5,355,435 | 4 | false | 0 | 0 | I'm not sure if there is an official standard, but I always put the __init__ method first, followed by my own methods, followed by any built ins that I plan on implementing (__str__,__eq__, etc). I try to group methods by similar functionality and order built-ins the same throughout my classes. | 4 | 5 | 0 | How should (or is a clean way) of organising methods in Python?
I always put the __init__ method first, followed by any other __foo__ (What do you call them?) methods. But then it leads into a jumble. | How should I arrange methods in a class in Python? | 0.049958 | 0 | 0 | 1,744 |
5,355,239 | 2011-03-18T16:50:00.000 | 4 | 0 | 1 | 0 | python,methods,code-organization | 5,355,352 | 4 | false | 0 | 0 | My preference is to place the __init__ method first, then assign the other methods alphabetically afterward. | 4 | 5 | 0 | How should (or is a clean way) of organising methods in Python?
I always put the __init__ method first, followed by any other __foo__ (What do you call them?) methods. But then it leads into a jumble. | How should I arrange methods in a class in Python? | 0.197375 | 0 | 0 | 1,744 |
5,355,239 | 2011-03-18T16:50:00.000 | 1 | 0 | 1 | 0 | python,methods,code-organization | 5,355,265 | 4 | true | 0 | 0 | I use two strategies:
an editor that can fold the code so you don't have to see all of it.
I split the big classes into smaller ones where each does only one thing and then build my app from those small blocks. | 4 | 5 | 0 | How should (or is a clean way) of organising methods in Python?
I always put the __init__ method first, followed by any other __foo__ (What do you call them?) methods. But then it leads into a jumble. | How should I arrange methods in a class in Python? | 1.2 | 0 | 0 | 1,744 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.