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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1,188,585 | 2009-07-27T14:45:00.000 | 10 | 0 | 0 | 0 | python,database,data-structures,persistence | 1,188,704 | 7 | true | 0 | 0 | Pickling is a two-face coin.
On one side, you have a way to store your object in a very easy way. Just four lines of code and you pickle. You have the object exactly as it is.
On the other side, it can become a compatibility nightmare. You cannot unpickle objects if they are not defined in your code, exactly as they we... | 4 | 5 | 0 | I'm considering the idea of creating a persistent storage like a dbms engine, what would be the benefits to create a custom binary format over directly cPickling the object and/or using the shelve module? | What are the benefits of not using cPickle to create a persistent storage for data? | 1.2 | 1 | 0 | 1,116 |
1,188,585 | 2009-07-27T14:45:00.000 | 2 | 0 | 0 | 0 | python,database,data-structures,persistence | 1,188,679 | 7 | false | 0 | 0 | Note that not all objects may be directly pickled - only basic types, or objects that have defined the pickle protocol.
Using your own binary format would allow you to potentially store any kind of object.
Just for note, Zope Object DB (ZODB) is following that very same approach, storing objects with the Pickle format.... | 4 | 5 | 0 | I'm considering the idea of creating a persistent storage like a dbms engine, what would be the benefits to create a custom binary format over directly cPickling the object and/or using the shelve module? | What are the benefits of not using cPickle to create a persistent storage for data? | 0.057081 | 1 | 0 | 1,116 |
1,188,585 | 2009-07-27T14:45:00.000 | 0 | 0 | 0 | 0 | python,database,data-structures,persistence | 1,189,928 | 7 | false | 0 | 0 | Will you ever need to process data from untrusted sources? If so, you should know that the pickle format is actually a virtual machine that is capable of executing arbitrary code on behalf of the process doing the unpickling. | 4 | 5 | 0 | I'm considering the idea of creating a persistent storage like a dbms engine, what would be the benefits to create a custom binary format over directly cPickling the object and/or using the shelve module? | What are the benefits of not using cPickle to create a persistent storage for data? | 0 | 1 | 0 | 1,116 |
1,188,737 | 2009-07-27T15:11:00.000 | 2 | 0 | 1 | 0 | python,http | 1,188,759 | 1 | true | 0 | 0 | Why would you need a specific order in the POST parameters in the first place? As far as I know there are no requirements that POST parameter order is preserved by web servers.
Every language I have used, has used a dictionary type object to hold these parameters as they are inherently key/value pairs. | 1 | 2 | 0 | I have a web service that accepts passed in params using http POST but in a specific order, eg (name,password,data). I have tried to use httplib but all the Python http POST libraries seem to take a dictionary, which is an unordered data structure. Any thoughts on how to http POST params in order for Python?
Thanks! | Python POST ordered params | 1.2 | 0 | 1 | 345 |
1,191,689 | 2009-07-28T02:43:00.000 | 2 | 1 | 0 | 0 | python,r,statistics | 1,832,314 | 7 | false | 0 | 0 | I apply hierarchical Bayes models in R in combination with JAGS (Linux) or sometimes WinBUGS (Windows, or Wine). Check out the book of Andrew Gelman, as referred to above. | 3 | 12 | 1 | Hierarchical Bayes models are commonly used in Marketing, Political Science, and Econometrics. Yet, the only package I know of is bayesm, which is really a companion to a book (Bayesian Statistics and Marketing, by Rossi, et al.) Am I missing something? Is there a software package for R or Python doing the job out ther... | Hierarchical Bayes for R or Python | 0.057081 | 0 | 0 | 8,690 |
1,191,689 | 2009-07-28T02:43:00.000 | 0 | 1 | 0 | 0 | python,r,statistics | 55,978,470 | 7 | false | 0 | 0 | This answer comes almost ten years late, but it will hopefully help someone in the future.
The brms package in R is a very good option for Bayesian hierarchical/multilevel models, using a syntax very similar to the lme4 package.
The brms package uses the probabilistic programming language Stan in the back to do the inf... | 3 | 12 | 1 | Hierarchical Bayes models are commonly used in Marketing, Political Science, and Econometrics. Yet, the only package I know of is bayesm, which is really a companion to a book (Bayesian Statistics and Marketing, by Rossi, et al.) Am I missing something? Is there a software package for R or Python doing the job out ther... | Hierarchical Bayes for R or Python | 0 | 0 | 0 | 8,690 |
1,191,689 | 2009-07-28T02:43:00.000 | 0 | 1 | 0 | 0 | python,r,statistics | 1,197,766 | 7 | false | 0 | 0 | The lme4 package, which estimates hierarchical models using frequentist methods, has a function called mcmcsamp that allows you to sample from the posterior distribution of the model using MCMC. This currently works only for linear models, quite unfortunately. | 3 | 12 | 1 | Hierarchical Bayes models are commonly used in Marketing, Political Science, and Econometrics. Yet, the only package I know of is bayesm, which is really a companion to a book (Bayesian Statistics and Marketing, by Rossi, et al.) Am I missing something? Is there a software package for R or Python doing the job out ther... | Hierarchical Bayes for R or Python | 0 | 0 | 0 | 8,690 |
1,192,480 | 2009-07-28T07:47:00.000 | 2 | 0 | 1 | 0 | python,vim | 1,214,504 | 6 | false | 0 | 0 | glenn jackman asked how to enter the characters (I'm assuming he means characters like "»").
Brian Carper suggests a method using the character's Unicode index number. Since many of these distinctive-looking characters are digraphs [ :help digraphs ], you can also use the CNTL-k shortcut, which is generally easier to r... | 1 | 9 | 0 | How to make tabulation look different than whitespace in vim (highlighted for example).
That would be useful for code in Python. | Making tabulation look different than just whitespace | 0.066568 | 0 | 0 | 480 |
1,194,802 | 2009-07-28T15:12:00.000 | 0 | 0 | 1 | 1 | macos,mono,ironpython | 1,195,079 | 2 | false | 0 | 0 | Look at the Terminal menu, Preferences... menu item.
In the Preferences dialog box, click on the Settings selection.
Within the settings, click on the Keyboard tab.
You have probably modified your tab key to not work correctly. It should not be mentioned as a special key and should generate an ordinary tab character.
... | 1 | 0 | 0 | I am running IronPython 2.0.2 interactive console with Mono 2.4 on OSX Terminal.app . How do I insert indent/tab in the Terminal.app ? I want to do this so I can indent my code.
For example I want to input print "hello tab" what I see is print "hellotab" despite pressing the tab key many times. When the command ... | How to insert indent/tab in os x terminal for IronPython (ipy.exe)? | 0 | 0 | 0 | 1,938 |
1,196,074 | 2009-07-28T18:56:00.000 | 0 | 0 | 1 | 1 | python,process,daemon | 71,059,019 | 9 | false | 0 | 0 | I haven't tried this yet but using .pyw files instead of .py files should help. pyw files dosen't have a console so in theory it should not appear and work like a background process. | 1 | 363 | 0 | I'm trying to port a shell script to the much more readable python version. The original shell script starts several processes (utilities, monitors, etc.) in the background with "&". How can I achieve the same effect in python? I'd like these processes not to die when the python scripts complete. I am sure it's related... | How to start a background process in Python? | 0 | 0 | 0 | 549,636 |
1,196,708 | 2009-07-28T21:01:00.000 | -2 | 0 | 1 | 0 | python,import,directory,shared | 1,196,815 | 6 | false | 0 | 0 | "I appended to sys.path ..."
Please don't.
Set the PYTHONPATH environment variable from outside your application. | 3 | 0 | 0 | I have some python modules in a shared folder on a Windows machine.
The file is \mtl12366150\test\mymodule.py
os.path.exists tells me this path is valid.
I appended to sys.path the folder \mtl12366150\test (and os.path.exists tells me this path is valid).
When I try to import mymodule I get an error saying the module ... | How to import python module in a shared folder? | -0.066568 | 0 | 0 | 3,164 |
1,196,708 | 2009-07-28T21:01:00.000 | 0 | 0 | 1 | 0 | python,import,directory,shared | 1,200,216 | 6 | false | 0 | 0 | I think I found the answer. I was using Python 2.6.1 and with Python 2.6.2 it now works. I had the same faulty behavior with python 2.5.4. | 3 | 0 | 0 | I have some python modules in a shared folder on a Windows machine.
The file is \mtl12366150\test\mymodule.py
os.path.exists tells me this path is valid.
I appended to sys.path the folder \mtl12366150\test (and os.path.exists tells me this path is valid).
When I try to import mymodule I get an error saying the module ... | How to import python module in a shared folder? | 0 | 0 | 0 | 3,164 |
1,196,708 | 2009-07-28T21:01:00.000 | 1 | 0 | 1 | 0 | python,import,directory,shared | 1,196,801 | 6 | false | 0 | 0 | Did you forget to use a raw string, or escape the backslashes, in your additional sys.path component? Remember that "\t" is a tab, whereas r"\t" or "\t" are a backslash followed by a tab.
In most applications you are actually better off using forward slashes rather than backslashes even for Windows paths, and most Wind... | 3 | 0 | 0 | I have some python modules in a shared folder on a Windows machine.
The file is \mtl12366150\test\mymodule.py
os.path.exists tells me this path is valid.
I appended to sys.path the folder \mtl12366150\test (and os.path.exists tells me this path is valid).
When I try to import mymodule I get an error saying the module ... | How to import python module in a shared folder? | 0.033321 | 0 | 0 | 3,164 |
1,197,981 | 2009-07-29T04:00:00.000 | 2 | 1 | 0 | 0 | python,ascii | 1,198,002 | 4 | true | 0 | 0 | ASCII is the American Standard Code for Information Interchange and does not include any accented letters. Your best bet is to get Unicode (as you say you can) and encode it as UTF-8 (maybe ISO-8859-1 or some weird codepage if you're dealing with seriously badly coded user-agents/clients, sigh) -- the content type head... | 1 | 4 | 0 | I need to convert any html entity into its ASCII equivalent using Python. My use case is that I am cleaning up some HTML used to build emails to create plaintext emails from the HTML.
Right now, I only really know how to create unicode from these entities when I need ASCII (I think) so that the plaintext email reads c... | Convert html entities to ascii in Python | 1.2 | 0 | 0 | 8,608 |
1,199,350 | 2009-07-29T10:44:00.000 | 0 | 0 | 1 | 0 | python,file,csv | 1,199,371 | 6 | false | 0 | 0 | Probably either a dict of list or a list of dict. Personally, I'd go with the former. So, parse the heading row of the CSV to get a dict from column heading to column index. Then when you're reading through each row, work out what index you're at, grab the column heading, and then append to the end of the list for that... | 2 | 2 | 1 | I have a CSV file which I am processing and putting the processed data into a text file.
The entire data that goes into the text file is one big table(comma separated instead of space). My problem is How do I remember the column into which a piece of data goes in the text file?
For eg. Assume there is a column called '... | Whats the best way of putting tabular data into python? | 0 | 0 | 0 | 798 |
1,199,350 | 2009-07-29T10:44:00.000 | 1 | 0 | 1 | 0 | python,file,csv | 1,199,409 | 6 | false | 0 | 0 | Is SQLite an option for you? I know that you have CSV input and output. However, you can import all the data into the SQLite database. Then do all the necessary processing with the power of SQL. Then you can export the results as CSV. | 2 | 2 | 1 | I have a CSV file which I am processing and putting the processed data into a text file.
The entire data that goes into the text file is one big table(comma separated instead of space). My problem is How do I remember the column into which a piece of data goes in the text file?
For eg. Assume there is a column called '... | Whats the best way of putting tabular data into python? | 0.033321 | 0 | 0 | 798 |
1,199,493 | 2009-07-29T11:13:00.000 | 0 | 1 | 0 | 0 | python,unit-testing,buildbot | 1,371,766 | 3 | true | 0 | 0 | We've decided to go with decorators that, using platform module and others, check whether the tests should be executed, and if not simply let it pass (though, we saw that python2.7 already has in its trunk a SkipTest exception that could be raised in such cases, to ignore the test). | 1 | 5 | 0 | We have a python project that we want to start testing using buildbot. Its unit tests include tests that should only work on some platforms. So, we've got tests that should pass on all platforms, tests that should only run on 1 specific platform, tests that should pass on platforms A, B, C and tests that pass on B and ... | How to distribute and execute platform-specific unit tests? | 1.2 | 0 | 0 | 709 |
1,199,703 | 2009-07-29T11:49:00.000 | 2 | 1 | 0 | 0 | python,server-side | 1,199,744 | 4 | true | 1 | 0 | If your server is running Apache HTTP server, then you need something like mod_wsgi or mod_python installed and running as a module (your server signature may tell you this).
Once running, you may need to add a handler to your apache config, or a default may be setup.
After that, look at the documentation for the middl... | 1 | 3 | 0 | I've been told by my hosting company that Python is installed on their servers. How would I go about using it to output a simple HTML page? This is just as a learning exercise at the moment, but one day I'd like to use Python in the same way as I currently use PHP. | How do I use Python serverside with shared hosting? | 1.2 | 0 | 0 | 2,969 |
1,200,726 | 2009-07-29T14:36:00.000 | 1 | 1 | 0 | 0 | .net,xml,ironpython,python,lxml | 1,211,395 | 2 | false | 0 | 0 | Something which you might have already considered:
An alternative is to first port the lxml library to IPy and then your code (depending on the code size). You might have to write some C# wrappers for the native C calls to the C extensions -- I'm not sure what issues, if any, are involved in this with regards to IPy.
... | 1 | 6 | 0 | I need to port some code that relies heavily on lxml from a CPython application to IronPython.
lxml is very Pythonic and I would like to keep using it under IronPython, but it depends on libxslt and libxml2, which are C extensions.
Does anyone know of a workaround to allow lxml under IronPython or a version of lxml tha... | How to get lxml working under IronPython? | 0.099668 | 0 | 1 | 2,349 |
1,201,507 | 2009-07-29T16:34:00.000 | 1 | 1 | 0 | 0 | python,exception,simplexmlrpcserver | 1,202,742 | 2 | false | 0 | 0 | Yes, this is what happens when you raise an exception on the server side. Are you expecting the SimpleXMLRPCServer to return the exception to the client?
You can only use objects that can be marshalled through XML. This includes
boolean : The True and False constants
integers : Pass in directly
floating-point numbers ... | 1 | 0 | 0 | I'm trying to raise an exception on the Server Side of an SimpleXMLRPCServer; however, all attempts get a "Fault 1" exception on the client side.
RPC_Server.AbortTest()
File "C:\Python25\lib\xmlrpclib.py", line 1147, in call
return self.__send(self.__name, args)
File "C:\Python25\lib\xmlrpclib.py", line 1437, i... | Sending an exception on the SimpleXMLRPCServer | 0.099668 | 0 | 1 | 746 |
1,201,628 | 2009-07-29T16:53:00.000 | 4 | 1 | 0 | 1 | java,python,perl,web-services,wrapper | 1,201,722 | 5 | true | 1 | 0 | This depends heavily upon your needs. If Jython is an option for the Python code (it isn't always 100% compatible), then it is probably the best option there. Otherwise, you will need to use Java's Process Builder to call the interpretters directly and return the results on their output stream. This will not be fast... | 1 | 4 | 0 | I have to deploy some Web Services on a server that only supports the Java ones, but some of them will be done using perl or python. I want to know if is possible to develop a Java wrapper to call a specific code written in perl or python. So, I want to have all the Web Services in Java, but some of them will call some... | Java Wrapper to Perl/Python code | 1.2 | 0 | 0 | 2,709 |
1,201,771 | 2009-07-29T17:14:00.000 | 3 | 0 | 0 | 0 | python,windows,proxy,registry | 1,205,881 | 3 | true | 0 | 0 | urllib module automatically retrieves settings from registry when no proxies are specified as a parameter or in the environment variables
In a Windows environment, if no proxy
environment variables are set, proxy
settings are obtained from the
registry’s Internet Settings section.
See the documentation of urlli... | 1 | 2 | 0 | How can I get the current Windows' browser proxy setting, as well as set them to a value?
I know I can do this by looking in the registry at Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer, but I'm looking, if it is possible, to do this without messing directly with the registry. | How to set proxy in Windows with Python? | 1.2 | 0 | 1 | 12,290 |
1,201,785 | 2009-07-29T17:17:00.000 | 0 | 0 | 0 | 0 | python,django | 1,201,895 | 1 | false | 1 | 0 | I'd go with option number 2. I don't think your django user is any more likely to get compromised than your Tkinter user. If there's something else under apache that you're worried about, run it under a separate apache with the right user. | 1 | 0 | 0 | I am integrating "legacy" code with Django, and have problems when the process executing Django must write to legacy code directories where it lacks write permissions. (The legacy code is a Python backend to a Tkinter GUI, which I'm repurposing to a browser-based UI.)
I could:
Make the legacy directory writeable
to a... | Django and File Permissions: Best Practices? | 0 | 0 | 0 | 915 |
1,201,817 | 2009-07-29T17:24:00.000 | 20 | 0 | 0 | 0 | python,numpy | 1,208,039 | 2 | true | 0 | 0 | If you're using numpy 1.3, there's also numpy.lib.recfunctions.append_fields().
For many installations, you'll need to import numpy.lib.recfunctions to access this. import numpy will not allow one to see the numpy.lib.recfunctions | 1 | 22 | 1 | What is the cleanest way to add a field to a structured numpy array? Can it be done destructively, or is it necessary to create a new array and copy over the existing fields? Are the contents of each field stored contiguously in memory so that such copying can be done efficiently? | Adding a field to a structured numpy array | 1.2 | 0 | 0 | 9,033 |
1,203,295 | 2009-07-29T21:55:00.000 | 1 | 0 | 0 | 0 | python,django,testing,sqlite | 1,203,393 | 3 | false | 1 | 0 | The test framework is not saving the data to the database, the data is cleaned once the tests have finished. | 1 | 6 | 0 | I'm trying to provide integration to my django application from subversion through the post commit hook.
I have a django test case (a subclass of unittest.TestCase) that (a) inserts a couple of records into a table, (b) spawns an svn commit, (c) svn commit runs a hook that uses my django model to look up info.
I'm usin... | can't see records inserted by django test case | 0.066568 | 0 | 0 | 1,488 |
1,204,376 | 2009-07-30T03:51:00.000 | 1 | 0 | 1 | 0 | python,eval | 1,204,403 | 2 | false | 0 | 0 | Do you mean eval or exec? Please post exactly what you ran, plus the full traceback and error message.
The problem is probably because the Python grammar says that lines are terminated by newlines ('\n'), not the two-character sequence '\r\n'.
In general, it would be safer for you to use replace('\r\n', '\n') in case t... | 1 | 4 | 0 | Why eval function doesn't work with \r\n but with \n. for example
eval("for i in range(5):\r\n print 'hello'") doesn't work
eval("for i in range(5):\n print 'hello'") works
I know there is not a problem cause using replace("\r","") is corrected, but someone knows why happens?
--Edit--
Oh! sorry , exactly, I meant... | \r\n vs \n in python eval function | 0.099668 | 0 | 0 | 4,425 |
1,204,378 | 2009-07-30T03:52:00.000 | 3 | 0 | 1 | 0 | python,wxpython | 1,204,394 | 5 | false | 0 | 0 | You can't do this with just the standard Python library, although there might be some third party package that does it. Barring that, you can use the os package to determine which operating system you're on and use that information to acquire the info you want for that system (and encapsulate that into a single cross-... | 1 | 9 | 0 | From within a Python application, how can I get the total amount of RAM of the system and how much of it is currently free, in a cross-platform way?
Ideally, the amount of free RAM should consider only physical memory that can actually be allocated to the Python process. | Getting total/free RAM from within Python | 0.119427 | 0 | 0 | 10,853 |
1,205,449 | 2009-07-30T09:22:00.000 | 3 | 0 | 0 | 0 | python,neural-network | 1,205,509 | 4 | true | 0 | 0 | You have to encode your input and your output to something that can be represented by the neural network units. ( for example 1 for "x has a certain property p" -1 for "x doesn't have the property p" if your units' range is in [-1, 1])
The way you encode your input and the way you decode your output depends on what you... | 4 | 3 | 1 | Can anyone explain to me how to do more complex data sets like team stats, weather, dice, complex number types
i understand all the math and how everything works i just dont know how to input more complex data, and then how to read the data it spits out
if someone could provide examples in python that would be a big ... | Neural net input/output | 1.2 | 0 | 0 | 671 |
1,205,449 | 2009-07-30T09:22:00.000 | 0 | 0 | 0 | 0 | python,neural-network | 20,683,280 | 4 | false | 0 | 0 | You have to add the number of units for input and output you need for the problem. If the unknown function to approximate depends on n parameter, you will have n input units. The number of output units depends on the nature of the funcion. For real functions with n real parameters you will have one output unit.
Some pr... | 4 | 3 | 1 | Can anyone explain to me how to do more complex data sets like team stats, weather, dice, complex number types
i understand all the math and how everything works i just dont know how to input more complex data, and then how to read the data it spits out
if someone could provide examples in python that would be a big ... | Neural net input/output | 0 | 0 | 0 | 671 |
1,205,449 | 2009-07-30T09:22:00.000 | 2 | 0 | 0 | 0 | python,neural-network | 1,207,505 | 4 | false | 0 | 0 | Your features must be decomposed into parts that can be represented as real numbers. The magic of a Neural Net is it's a black box, the correct associations will be made (with internal weights) during the training
Inputs
Choose as few features as are needed to accurately describe the situation, then decompose each int... | 4 | 3 | 1 | Can anyone explain to me how to do more complex data sets like team stats, weather, dice, complex number types
i understand all the math and how everything works i just dont know how to input more complex data, and then how to read the data it spits out
if someone could provide examples in python that would be a big ... | Neural net input/output | 0.099668 | 0 | 0 | 671 |
1,205,449 | 2009-07-30T09:22:00.000 | 0 | 0 | 0 | 0 | python,neural-network | 1,206,597 | 4 | false | 0 | 0 | More complex data usually means adding more neurons in the input and output layers.
You can feed each "field" of your register, properly encoded as a real value (normalized, etc.) to each input neuron, or maybe you can even decompose even further into bit fields, assigning saturated inputs of 1 or 0 to the neurons... f... | 4 | 3 | 1 | Can anyone explain to me how to do more complex data sets like team stats, weather, dice, complex number types
i understand all the math and how everything works i just dont know how to input more complex data, and then how to read the data it spits out
if someone could provide examples in python that would be a big ... | Neural net input/output | 0 | 0 | 0 | 671 |
1,207,954 | 2009-07-30T17:04:00.000 | 0 | 0 | 1 | 0 | python,path | 5,176,531 | 5 | false | 0 | 0 | May be one can use os.path.relpath(path1, path2) as workaround for os.path.samefile(path1, path2) on Windows?
If os.path.relpath(path1, path2) returns '.' than path1 and path2 point to the same place | 1 | 10 | 0 | How can I check whether two file paths point to the same file in Python? | Check absolute paths in Python | 0 | 0 | 0 | 4,658 |
1,210,711 | 2009-07-31T04:38:00.000 | -10 | 0 | 0 | 0 | python,django | 1,211,756 | 3 | false | 1 | 0 | SQL Join queries are a hack because SQL doesn't have objects or navigation among objects.
Objects don't need "joins". Just access the related objects. | 2 | 4 | 0 | guys, how or where is the "join" query in Django?
i think that Django dont have "join"..but how ill make join?
Thanks | Django .."join" query? | -1 | 0 | 0 | 5,258 |
1,210,711 | 2009-07-31T04:38:00.000 | 4 | 0 | 0 | 0 | python,django | 1,211,769 | 3 | true | 1 | 0 | If you're using models, the select_related method will return the object for any foreign keys you have set up (up to a limit you specify) within that model. | 2 | 4 | 0 | guys, how or where is the "join" query in Django?
i think that Django dont have "join"..but how ill make join?
Thanks | Django .."join" query? | 1.2 | 0 | 0 | 5,258 |
1,211,363 | 2009-07-31T08:47:00.000 | 2 | 0 | 0 | 0 | python,django,web-applications | 1,211,434 | 3 | false | 1 | 0 | Don't do this.
Most files are cached anyway.
But if you really want to add this (because users asked for it), make it optional (default off). | 2 | 0 | 0 | I am trying to download mp3 file to users machine without his/her consent while they are listening the song.So, next time they visit that web page they would not have to download same mp3, but palypack from the local file. this will save some bandwidth for me and for them. it something pandora used to do but I really d... | downloading files to users machine? | 0.132549 | 0 | 1 | 170 |
1,211,363 | 2009-07-31T08:47:00.000 | 4 | 0 | 0 | 0 | python,django,web-applications | 1,211,370 | 3 | true | 1 | 0 | You can't forcefully download files to a user without his consent. If that was possible you can only imagine what severe security flaw that would be.
You can do one of two things:
count on the browser to cache the media file
serve the media via some 3rd party plugin (Flash, for example) | 2 | 0 | 0 | I am trying to download mp3 file to users machine without his/her consent while they are listening the song.So, next time they visit that web page they would not have to download same mp3, but palypack from the local file. this will save some bandwidth for me and for them. it something pandora used to do but I really d... | downloading files to users machine? | 1.2 | 0 | 1 | 170 |
1,211,380 | 2009-07-31T08:51:00.000 | 0 | 0 | 0 | 0 | python,user-interface,wxpython,color-scheme | 1,272,807 | 1 | false | 0 | 1 | You can use
styledTextCtrl.StyleSetSpec(wx.stc.STC_STYLE_INDENTGUIDE, "fore:#CDCDCD")
(Bunch of .StyleSetSpec properties)
...
...
...
styCtrl.SetCaretForeground("BLUE")
styCtrl.SetSelBackground(True, wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHT))
styCtrl.SetSelForeground(True, wx.SystemSettings_GetColour(wx.SYS... | 1 | 1 | 0 | I have a PyShell, which is supposed to be derived from wx.stc.StyledTextCtrl. How do I change the color scheme that it currently uses? | wxPython: Changing the color scheme of a wx.stc.StyledTextCtrl | 0 | 0 | 0 | 828 |
1,213,090 | 2009-07-31T15:10:00.000 | 1 | 0 | 0 | 0 | python,gtk,drawing,pygtk | 6,578,903 | 5 | false | 0 | 1 | You should connect to the expose-event (GTK 2) or draw (GTK 3) signal. In that handler, simply use image.window to get the widget's gtk.gdk.Window; this is a subclass of gtk.gdk.Drawable, so you can draw on it. | 1 | 3 | 0 | I'm using pygtk with PIL. I've already figured out a way to convert PIL Images to gtk.gdk.Pixbufs. What I do to display the pixbuf is I create a gtk.gdk.Image, and then use img.set_from_pixbuf. I now want to draw a few lines onto this image. Apparently I need a Drawable to do that. I've started looking through the docs... | pygtk: Draw lines onto a gtk.gdk.Pixbuf | 0.039979 | 0 | 0 | 5,113 |
1,213,328 | 2009-07-31T15:49:00.000 | 1 | 1 | 0 | 0 | python | 1,400,264 | 2 | false | 0 | 0 | To continue where Alex left off..
Download the uuid-1.30.tar.gz from Alex's pypi link.
unzip and untar.
place the uuid.py to your application's python path (e.g., same dir with your own .py files) | 1 | 1 | 0 | I have an older version of python on the server i'm using and cannot upgrade it. is there a way to get the uuid module? | how can I get the uuid module for python 2.4.3 | 0.099668 | 0 | 0 | 3,485 |
1,213,427 | 2009-07-31T16:05:00.000 | 2 | 0 | 0 | 0 | python,django,apache,nginx,centos | 19,777,706 | 1 | false | 1 | 0 | The problem is in the max body size
If you are using NGinx, add client_max_body_size 35m
And if you are using Apache you have to increase this size too. | 1 | 2 | 0 | WheneverI try to upload an mp3 file through a CMS I built with the Django Admin contrib pacakage, the server takes a couple minutes, then gives me a "Connection was reset" error.
I'm running Django on a CentOS server using NGINX which is proxying Apache with mod_wsgi for python. Could this be a server settings issue? | "Connection Reset" error on Django Admin file upload | 0.379949 | 0 | 0 | 1,962 |
1,213,690 | 2009-07-31T16:58:00.000 | 2 | 1 | 0 | 1 | python,macos,module,packages,macports | 49,869,959 | 13 | false | 0 | 0 | You may already have pip3 pre-installed, so just try it! | 3 | 127 | 0 | I'm starting to learn python and loving it. I work on a Mac mainly as well as Linux. I'm finding that on Linux (Ubuntu 9.04 mostly) when I install a python module using apt-get it works fine. I can import it with no trouble.
On the Mac, I'm used to using Macports to install all the Unixy stuff. However, I'm finding tha... | What is the most compatible way to install python modules on a Mac? | 0.03076 | 0 | 0 | 168,159 |
1,213,690 | 2009-07-31T16:58:00.000 | 7 | 1 | 0 | 1 | python,macos,module,packages,macports | 1,214,123 | 13 | false | 0 | 0 | I use MacPorts to install Python and any third-party modules tracked by MacPorts into /opt/local, and I install any manually installed modules (those not in the MacPorts repository) into /usr/local, and this has never caused any problems. I think you may be confused as to the use of certain MacPorts scripts and environ... | 3 | 127 | 0 | I'm starting to learn python and loving it. I work on a Mac mainly as well as Linux. I'm finding that on Linux (Ubuntu 9.04 mostly) when I install a python module using apt-get it works fine. I can import it with no trouble.
On the Mac, I'm used to using Macports to install all the Unixy stuff. However, I'm finding tha... | What is the most compatible way to install python modules on a Mac? | 1 | 0 | 0 | 168,159 |
1,213,690 | 2009-07-31T16:58:00.000 | 6 | 1 | 0 | 1 | python,macos,module,packages,macports | 2,380,159 | 13 | false | 0 | 0 | If you use Python from MacPorts, it has it's own easy_install located at: /opt/local/bin/easy_install-2.6 (for py26, that is). It's not the same one as simply calling easy_install directly, even if you used python_select to change your default python command. | 3 | 127 | 0 | I'm starting to learn python and loving it. I work on a Mac mainly as well as Linux. I'm finding that on Linux (Ubuntu 9.04 mostly) when I install a python module using apt-get it works fine. I can import it with no trouble.
On the Mac, I'm used to using Macports to install all the Unixy stuff. However, I'm finding tha... | What is the most compatible way to install python modules on a Mac? | 1 | 0 | 0 | 168,159 |
1,215,610 | 2009-08-01T01:45:00.000 | 4 | 0 | 1 | 1 | python,ubuntu,setuptools,virtualenv | 6,919,668 | 5 | false | 0 | 0 | You really should not touch Ubuntu's Python installation unless you are building system admin tools, or building something that could be considered to be a new system service.
If you are using Ubuntu to develop or deploy Python applications, always build your own Python from source, tar it up, and use that for deployme... | 3 | 14 | 0 | Can someone please explain to me what is going on with python in ubuntu 9.04?
I'm trying to spin up virtualenv, and the --no-site-packages flag seems to do nothing with ubuntu. I installed virtualenv 1.3.3 with easy_install (which I've upgraded to setuptools 0.6c9) and everything seems to be installed to /usr/local/lib... | Ubuntu + virtualenv = a mess? virtualenv hates dist-packages, wants site-packages | 0.158649 | 0 | 0 | 8,965 |
1,215,610 | 2009-08-01T01:45:00.000 | 9 | 0 | 1 | 1 | python,ubuntu,setuptools,virtualenv | 1,215,627 | 5 | true | 0 | 0 | I'd be tempted to hack it by making site-packages a link to dist-packages, but I guess this might affect other cases where you want to install some extension other than from the ubuntu dist. I can't think of another answer to 1 except tweaking virtualenv's sources (with both ubuntu and virtualenv being so popular I wou... | 3 | 14 | 0 | Can someone please explain to me what is going on with python in ubuntu 9.04?
I'm trying to spin up virtualenv, and the --no-site-packages flag seems to do nothing with ubuntu. I installed virtualenv 1.3.3 with easy_install (which I've upgraded to setuptools 0.6c9) and everything seems to be installed to /usr/local/lib... | Ubuntu + virtualenv = a mess? virtualenv hates dist-packages, wants site-packages | 1.2 | 0 | 0 | 8,965 |
1,215,610 | 2009-08-01T01:45:00.000 | 2 | 0 | 1 | 1 | python,ubuntu,setuptools,virtualenv | 1,216,108 | 5 | false | 0 | 0 | Well I have a Ubuntu 9.04 and quickly tried setting up a couple sandboxes with site-packages and one without. And things are working fine.
The only difference in the approach I took is I used Ubuntu's python-virtualenv package (1.3.3). And presume that it is tweaked by Ubuntu team to suit Ubuntu setups.
To sum up disab... | 3 | 14 | 0 | Can someone please explain to me what is going on with python in ubuntu 9.04?
I'm trying to spin up virtualenv, and the --no-site-packages flag seems to do nothing with ubuntu. I installed virtualenv 1.3.3 with easy_install (which I've upgraded to setuptools 0.6c9) and everything seems to be installed to /usr/local/lib... | Ubuntu + virtualenv = a mess? virtualenv hates dist-packages, wants site-packages | 0.07983 | 0 | 0 | 8,965 |
1,215,846 | 2009-08-01T04:40:00.000 | 1 | 0 | 0 | 0 | events,wxpython | 1,263,720 | 2 | false | 0 | 1 | Actually, I figured it out. There are events like EVT_GRID_LABEL_LEFT_CLICK and then I test event.GetCol() == -1, to make sure the click is on a whole row, not a whole column. | 1 | 3 | 0 | I would like to be warned when user selects the whole row in a wxGrid but I do not see an event that handles this.What is the best way to do it? | Detect row selection in wxGrid | 0.099668 | 0 | 0 | 3,008 |
1,217,901 | 2009-08-02T00:51:00.000 | 2 | 0 | 0 | 0 | python,django,admin | 3,144,134 | 6 | false | 1 | 0 | If you change the permissions to restrict access then you'll still get the plus sign by a FK/MtM field. Clicking that will open a popup window with 'Permission Denied' in it.
You can actually completely remove the plus sign by not simply not registering the model with the admin.
I have a situation where I have predefin... | 4 | 8 | 0 | Is there a way to remove the "Add" functionality on the Django admin site? For certain entities, I only want the Django admin to be able to view them or change existing ones, but not add new ones. | Remove the "Add" functionality in Django admin | 0.066568 | 0 | 0 | 6,592 |
1,217,901 | 2009-08-02T00:51:00.000 | 1 | 0 | 0 | 0 | python,django,admin | 8,795,993 | 6 | false | 1 | 0 | An easy effective way is to set max_num=0 for that particular inline. | 4 | 8 | 0 | Is there a way to remove the "Add" functionality on the Django admin site? For certain entities, I only want the Django admin to be able to view them or change existing ones, but not add new ones. | Remove the "Add" functionality in Django admin | 0.033321 | 0 | 0 | 6,592 |
1,217,901 | 2009-08-02T00:51:00.000 | 3 | 0 | 0 | 0 | python,django,admin | 1,218,080 | 6 | false | 1 | 0 | You can customize the permission for each user group from within the admin interface: try going to /admin/auth/group and it should be straightforward from there.
This won't be as granular as the solution offered by the earlier answer, but it will take care of most of your needs without needing to customize the admin. | 4 | 8 | 0 | Is there a way to remove the "Add" functionality on the Django admin site? For certain entities, I only want the Django admin to be able to view them or change existing ones, but not add new ones. | Remove the "Add" functionality in Django admin | 0.099668 | 0 | 0 | 6,592 |
1,217,901 | 2009-08-02T00:51:00.000 | 0 | 0 | 0 | 0 | python,django,admin | 13,954,260 | 6 | false | 1 | 0 | Satya's suggestion of setting max_num=0 works perfectly.
Per the Django docs on the ModelForm class:
For users with JavaScript-enabled browsers, an "Add another" link is provided to enable any number of additional inlines to be added in addition to those provided as a result of the extra argument.
The dynamic link wi... | 4 | 8 | 0 | Is there a way to remove the "Add" functionality on the Django admin site? For certain entities, I only want the Django admin to be able to view them or change existing ones, but not add new ones. | Remove the "Add" functionality in Django admin | 0 | 0 | 0 | 6,592 |
1,217,939 | 2009-08-02T01:22:00.000 | 0 | 0 | 0 | 0 | python,fullscreen,pygame,pyopengl | 1,218,011 | 3 | false | 0 | 1 | If you are not changing your clock.tick() when you change between full screen and windowed mode this is almost certainly a vsync issue. If you are on an LCD then it's 100% certain.
Unfortunately v-sync can be handled in many places including SDL, Pyopengl, your display server and your video drivers. If you are using wi... | 1 | 2 | 0 | I'm currently working on a game engine written in pygame and I wanted to add OpenGL support.
I wrote a test to see how to make pygame and OpenGL work together, and when it's running in windowed mode, it runs between 150 and 200 fps. When I run it full screen (all I did was add the FULLSCREEN flag when I set up the wind... | PyOpenGL + Pygame capped to 60 FPS in Fullscreen | 0 | 0 | 0 | 3,949 |
1,218,891 | 2009-08-02T13:23:00.000 | 1 | 0 | 1 | 1 | python,macos,osx-leopard,zope | 1,219,303 | 4 | false | 0 | 0 | The approach I prefer which should work on every UNIX-like operating system:
Create for each application which need an specific python version an user account. Install in each user count the corresponding python version with an user-local prefix (like ~/build/python) and add ~/build/bin/ to the PATH environment variabl... | 1 | 21 | 0 | I currently have multiple versions of Python installed on my Mac, the one that came with it, a version I downloaded recently from python.org, an older version used to run Zope locally and another version that Appengine is using. It's kind of a mess. Any recommendations of using one version of python to rule them all? H... | Multiple versions of Python on OS X Leopard | 0.049958 | 0 | 0 | 19,206 |
1,219,815 | 2009-08-02T20:49:00.000 | 3 | 0 | 1 | 0 | python,refactoring,module | 1,219,850 | 6 | false | 0 | 0 | Personally I find it easier to keep things like this in a single file, just for the practicality of editing a smaller number of files in my editor.
The important thing to do is treat the different pieces of code as though they were in separate files, so you ensure that you can trivially separate them later, for the rea... | 5 | 15 | 0 | I'm working on a Python web application in which I have some small modules that serve very specific functions: session.py, logger.py, database.py, etc. And by "small" I really do mean small; each of these files currently includes around 3-5 lines of code, or maybe up to 10 at most. I might have a few imports and a clas... | Python: prefer several small modules or one larger module? | 0.099668 | 0 | 0 | 2,930 |
1,219,815 | 2009-08-02T20:49:00.000 | -2 | 0 | 1 | 0 | python,refactoring,module | 1,219,914 | 6 | false | 0 | 0 | Small. | 5 | 15 | 0 | I'm working on a Python web application in which I have some small modules that serve very specific functions: session.py, logger.py, database.py, etc. And by "small" I really do mean small; each of these files currently includes around 3-5 lines of code, or maybe up to 10 at most. I might have a few imports and a clas... | Python: prefer several small modules or one larger module? | -0.066568 | 0 | 0 | 2,930 |
1,219,815 | 2009-08-02T20:49:00.000 | 3 | 0 | 1 | 0 | python,refactoring,module | 1,220,447 | 6 | false | 0 | 0 | For command line scripts there most likely will not be much difference unless each invocation invokes all files in the module, in which case there will be a slight performance cost as n files need to be opened vs one.
For mod_python there most likely will be no difference as byte-compiled modules stay alive for the dur... | 5 | 15 | 0 | I'm working on a Python web application in which I have some small modules that serve very specific functions: session.py, logger.py, database.py, etc. And by "small" I really do mean small; each of these files currently includes around 3-5 lines of code, or maybe up to 10 at most. I might have a few imports and a clas... | Python: prefer several small modules or one larger module? | 0.099668 | 0 | 0 | 2,930 |
1,219,815 | 2009-08-02T20:49:00.000 | 8 | 0 | 1 | 0 | python,refactoring,module | 1,219,844 | 6 | true | 0 | 0 | My thoughts are that having separate
modules helps with code clarity, and
later on, if by some chance these
modules grow to more than 10 lines, I
won't feel so bad about having them
separated.
This. Keep it the way you have it. | 5 | 15 | 0 | I'm working on a Python web application in which I have some small modules that serve very specific functions: session.py, logger.py, database.py, etc. And by "small" I really do mean small; each of these files currently includes around 3-5 lines of code, or maybe up to 10 at most. I might have a few imports and a clas... | Python: prefer several small modules or one larger module? | 1.2 | 0 | 0 | 2,930 |
1,219,815 | 2009-08-02T20:49:00.000 | 2 | 0 | 1 | 0 | python,refactoring,module | 1,219,867 | 6 | false | 0 | 0 | Off course you can have as many modules as you like.
But now let as think a little, what happens when we put every small code snippet into one single file.
We will end up in hundreds of import statements in any less trivial module. And off course you could also save a little by having all explicit in seperated files. B... | 5 | 15 | 0 | I'm working on a Python web application in which I have some small modules that serve very specific functions: session.py, logger.py, database.py, etc. And by "small" I really do mean small; each of these files currently includes around 3-5 lines of code, or maybe up to 10 at most. I might have a few imports and a clas... | Python: prefer several small modules or one larger module? | 0.066568 | 0 | 0 | 2,930 |
1,220,465 | 2009-08-03T02:24:00.000 | 1 | 0 | 1 | 0 | python,debugging | 1,221,572 | 6 | false | 0 | 0 | "Basically I want to see what is going on, but be able to jump in if a traceback occurs."
Here's a radical thought: Don't.
"Watching" is a crutch. You should be writing small sections of code that you know will work. Then put those together.
Watching sometimes results from "I'm not sure what Python's really doing", s... | 1 | 1 | 0 | I'm looking for a debugging tool that will run my Python app, but display which line is currently being processed -- like an automatically stepping debugger. Basically I want to see what is going on, but be able to jump in if a traceback occurs. | "Watching" program being processed line-by-line? | 0.033321 | 0 | 0 | 215 |
1,222,147 | 2009-08-03T12:42:00.000 | 1 | 0 | 0 | 0 | python,convolution | 1,226,509 | 2 | true | 0 | 0 | Yes, SciPy/Numpy is mostly concerned about arrays.
If you can tolerate an approximate solution, and your functions only operate over a range of value (not infinite) you can fill an array with the values and convolve the arrays.
If you want something more "correct" calculus-wise you would probably need a powerful solver... | 1 | 2 | 1 | I will have to implement a convolution of two functions in Python, but SciPy/Numpy appear to have functions only for the convolution of two arrays.
Before I try to implement this by using the the regular integration expression of convolution, I would like to ask if someone knows of an already available module that perf... | Convolution of two functions in Python | 1.2 | 0 | 0 | 8,768 |
1,222,782 | 2009-08-03T14:52:00.000 | 2 | 0 | 1 | 0 | python,python-3.x | 1,222,924 | 8 | false | 0 | 0 | Python 3.1 should not be used until other libraries have caught up with support for it.
You should use 2.6 now. It has several 3.x features back-ported to it, so that migrating to 3.x won't be difficult later on, and you won't learn obsolete practices. | 7 | 12 | 0 | Recently I decided to expand my programming horizons and learn the python programming language. While I have used python a little bit for classes in college and for a project or two at work I am by no means an expert. My question is as follows: should I bother with the 2.x releases or should I jump straight to 3.0? I a... | Should I Start With Python 3.0? | 0.049958 | 0 | 0 | 2,297 |
1,222,782 | 2009-08-03T14:52:00.000 | 2 | 0 | 1 | 0 | python,python-3.x | 1,222,832 | 8 | false | 0 | 0 | Use python 3.1, Luke. | 7 | 12 | 0 | Recently I decided to expand my programming horizons and learn the python programming language. While I have used python a little bit for classes in college and for a project or two at work I am by no means an expert. My question is as follows: should I bother with the 2.x releases or should I jump straight to 3.0? I a... | Should I Start With Python 3.0? | 0.049958 | 0 | 0 | 2,297 |
1,222,782 | 2009-08-03T14:52:00.000 | 4 | 0 | 1 | 0 | python,python-3.x | 1,222,804 | 8 | false | 0 | 0 | I think that you will be better served going straight into 3.0. Unless you have a legacy codebase to contend with, there are very few advantages to learning the 2.xx ways of doing things.
In the Python world (as in most others, really), releases do tend to take a while to migrate down to all of the subprojects, but if... | 7 | 12 | 0 | Recently I decided to expand my programming horizons and learn the python programming language. While I have used python a little bit for classes in college and for a project or two at work I am by no means an expert. My question is as follows: should I bother with the 2.x releases or should I jump straight to 3.0? I a... | Should I Start With Python 3.0? | 0.099668 | 0 | 0 | 2,297 |
1,222,782 | 2009-08-03T14:52:00.000 | 8 | 0 | 1 | 0 | python,python-3.x | 1,540,468 | 8 | false | 0 | 0 | Use 3.1
Why?
1) Because as long as everyone is still using 2.6, the libraries will have less reasons to migrate to 3.1. As long as those libraries are not ported to 3.1, you are stuck with the choice of either not using the strengths of 3.1, or only doing the jobs half way by using the hackish solution of using a back... | 7 | 12 | 0 | Recently I decided to expand my programming horizons and learn the python programming language. While I have used python a little bit for classes in college and for a project or two at work I am by no means an expert. My question is as follows: should I bother with the 2.x releases or should I jump straight to 3.0? I a... | Should I Start With Python 3.0? | 1 | 0 | 0 | 2,297 |
1,222,782 | 2009-08-03T14:52:00.000 | 7 | 0 | 1 | 0 | python,python-3.x | 1,225,173 | 8 | false | 0 | 0 | Short answer: Start with Python 2.6.
Why: Programming is more fun and useful when you can leverage the work of others. This means using 3rd party libraries often. Many of the popular libraries for Python don't have 3.x support yet. PIL and NumPy/SciPy come to mind. My favorite interpreter, ipython, also doesn't work wi... | 7 | 12 | 0 | Recently I decided to expand my programming horizons and learn the python programming language. While I have used python a little bit for classes in college and for a project or two at work I am by no means an expert. My question is as follows: should I bother with the 2.x releases or should I jump straight to 3.0? I a... | Should I Start With Python 3.0? | 1 | 0 | 0 | 2,297 |
1,222,782 | 2009-08-03T14:52:00.000 | 20 | 0 | 1 | 0 | python,python-3.x | 1,222,843 | 8 | true | 0 | 0 | Absolutely not 3.0 - 3.1 is out and is stabler, better, faster in every respect; it makes absolutely no sense to start with 3.0 at this time, if you want to take up the 3 series it should on all accounts be 3.1.
As for 2.6 vs 3.1, 3.1 is a better language (especially because some cruft was removed that had accumulated ... | 7 | 12 | 0 | Recently I decided to expand my programming horizons and learn the python programming language. While I have used python a little bit for classes in college and for a project or two at work I am by no means an expert. My question is as follows: should I bother with the 2.x releases or should I jump straight to 3.0? I a... | Should I Start With Python 3.0? | 1.2 | 0 | 0 | 2,297 |
1,222,782 | 2009-08-03T14:52:00.000 | 3 | 0 | 1 | 0 | python,python-3.x | 1,222,856 | 8 | false | 0 | 0 | You should go with the latest release of any programming language you learn unless you have a specific reason not to. Since you don't have an existing project that won't work with Python 3.0, you should feel free to use the newest version. | 7 | 12 | 0 | Recently I decided to expand my programming horizons and learn the python programming language. While I have used python a little bit for classes in college and for a project or two at work I am by no means an expert. My question is as follows: should I bother with the 2.x releases or should I jump straight to 3.0? I a... | Should I Start With Python 3.0? | 0.07486 | 0 | 0 | 2,297 |
1,222,929 | 2009-08-03T15:18:00.000 | 4 | 0 | 1 | 0 | python,multithreading,gil | 1,224,503 | 7 | false | 0 | 0 | The GIL is a good thing.
Just make your C++ application release the GIL while it is doing its multithreaded work. Python code will continue to run in the other threads, unspoiled. Only acquire the GIL when you have to touch python objects. | 2 | 16 | 0 | Does anybody knows fate of Global Interpreter Lock in Python 3.1 against C++ multithreading integration | GIL in Python 3.1 | 0.113791 | 0 | 0 | 13,312 |
1,222,929 | 2009-08-03T15:18:00.000 | 9 | 0 | 1 | 0 | python,multithreading,gil | 1,225,350 | 7 | false | 0 | 0 | The GIL will not affect your code which does not use python objects. In Numpy, we release the GIL for computational code (linear algebra calls, etc...), and the underlying code can use multithreading freely (in fact, those are generally 3rd party libraries which do not know anything about python) | 2 | 16 | 0 | Does anybody knows fate of Global Interpreter Lock in Python 3.1 against C++ multithreading integration | GIL in Python 3.1 | 1 | 0 | 0 | 13,312 |
1,223,007 | 2009-08-03T15:33:00.000 | 0 | 1 | 1 | 0 | python,string,partitioning | 1,223,236 | 5 | false | 0 | 0 | You should look into the itertools module. It can create a generator for you that is very fast. Given your input string, it will provide you with all possible permutations. Depending on what you need, there is also a combinations() generator. I'm not quite sure if you're looking at "b|ca" when you're looking at "abc," ... | 1 | 3 | 0 | I'm working on a statistical project that involves iterating over every possible way to partition a collection of strings and running a simple calculation on each. Specifically, each possible substring has a probability associated with it, and I'm trying to get the sum across all partitions of the product of the substr... | Are there any cleverly efficient algorithms to perform a calculation over the space of partitionings of a string? | 0 | 0 | 0 | 323 |
1,223,289 | 2009-08-03T16:30:00.000 | 8 | 0 | 1 | 1 | python | 1,223,313 | 2 | false | 0 | 0 | How about os.write(<file descriptor>, os.linesep)? (import os is unnecessary because you seem to have already imported it, otherwise you'd be getting errors using os.write to begin with.) | 1 | 43 | 0 | The os.write function can be used to writes bytes into a file descriptor (not file object). If I execute os.write(fd, '\n'), only the LF character will be written into the file, even on Windows. I would like to have CRLF in the file on Windows and only LF in Linux.
What is the best way to achieve this?
I'm using Python... | How to write native newline character to a file descriptor in Python? | 1 | 0 | 0 | 36,433 |
1,224,567 | 2009-08-03T20:52:00.000 | 1 | 0 | 1 | 0 | python,windows,xml,ide,wxpython | 1,224,958 | 7 | false | 0 | 0 | Taking the headline question literally, the answer has to be IronPython. The 2.0 releases are equivalent to CPython 2.5, and the 2.6 release (currently at beta2) is intended to match CPython 2.6 (full 2.6 release some time in the next couple of months). With either you can use the state of the art in Windows GUI fram... | 2 | 1 | 0 | I'm looking to set up my development environment at home for writing Windows applications in Python.
For my first piece, I'm writing a simple, forms-based application that stores data input as XML (and can read that information back.) I do want to set up the tools I'd use professionally, though, having already done a r... | What's the state-of-the-art in Python programming in Windows? | 0.028564 | 0 | 0 | 1,473 |
1,224,567 | 2009-08-03T20:52:00.000 | 1 | 0 | 1 | 0 | python,windows,xml,ide,wxpython | 1,224,727 | 7 | false | 0 | 0 | "What tools are professional python developers using these days?"
Lots
"In order to have a working python environment, what version of the compiler should I be using?"
["compiler" is meaningless. I'll assume you mean "Python"]
We use 2.5.4. We'll be upgrading to 2.6 as soon as we've done the testing.
"What editor is ... | 2 | 1 | 0 | I'm looking to set up my development environment at home for writing Windows applications in Python.
For my first piece, I'm writing a simple, forms-based application that stores data input as XML (and can read that information back.) I do want to set up the tools I'd use professionally, though, having already done a r... | What's the state-of-the-art in Python programming in Windows? | 0.028564 | 0 | 0 | 1,473 |
1,224,726 | 2009-08-03T21:30:00.000 | 5 | 0 | 0 | 1 | python,linux,cygwin,debhelper | 1,250,118 | 1 | true | 0 | 0 | Both cdbs and debhelper are only needed if you are trying to build a debian package. Just do a regular python setup.py build, and it should work fine (assuming you have the other prerequisites available). | 1 | 0 | 0 | python purple says it needs dbms and debhelper in order to run, but I don't run debian. Is there a way to get this running on a different linux? or in cygwin? | is it possible to get python purple running either in cygwin or on a linux that isn't debian? | 1.2 | 0 | 0 | 266 |
1,224,910 | 2009-08-03T22:20:00.000 | 3 | 0 | 0 | 0 | python,urllib2 | 1,224,950 | 1 | false | 0 | 0 | urllib2.urlopen returns a file-like object, and you can (at least in theory) .read(N) from such an object to limit the amount of data returned to N bytes at most.
This approach is not entirely fool-proof, because an actively-hostile site may go to quite some lengths to fool a reasonably trusty received, like urllib2's ... | 1 | 3 | 0 | Is there a way to limit amount of data downloaded by python's urllib2 module ? Sometimes I encounter with broken sites with sort of /dev/random as a page and it turns out that they use up all memory on a server. | limit downloaded page size | 0.53705 | 0 | 1 | 869 |
1,225,686 | 2009-08-04T04:03:00.000 | 0 | 0 | 0 | 0 | python,dialog,webpage | 1,226,061 | 3 | false | 0 | 0 | You can't, and you don't want to. When you ask a question, try explaining what you are trying to achieve, and not just the task immediately before you. You are likely barking down the wrong path. There is some other way of doing what you are trying to do. | 1 | 0 | 0 | When I try to automatically download a file from some webpage using Python,
I get Webpage Dialog window (I use IE). The window has two buttons, such as 'Continue' and 'Cancel'. I cannot figure out how to click on the Continue Button. The problem is
that I don't know how to control Webpage Dialog with Python. I tried ... | How to control Webpage dialog with python | 0 | 0 | 1 | 2,761 |
1,226,091 | 2009-08-04T07:25:00.000 | 1 | 0 | 1 | 0 | python,multithreading | 1,226,101 | 4 | false | 0 | 0 | Use synchronization objects and ask the thread to terminate. Basically, write co-operative handling of this.
If you start yanking out the thread beneath the python interpreter, all sorts of odd things can occur, and it's not just in Python either, most runtimes have this problem.
For instance, let's say you kill a thre... | 1 | 5 | 0 | What is the recommended way to terminate unexpectedly long running threads in python ? I can't use SIGALRM, since
Some care must be taken if both
signals and threads are used in the
same program. The fundamental thing to
remember in using signals and threads
simultaneously is: always perform
signal() operati... | Terminate long running python threads | 0.049958 | 0 | 0 | 6,170 |
1,226,584 | 2009-08-04T09:47:00.000 | 0 | 0 | 1 | 0 | python,multithreading,multiprocess | 1,227,628 | 8 | false | 0 | 0 | If you can easily partition and separate the data you have, it sounds like you should just do that partitioning externally, and feed them to several processes of your program. (i.e. several processes instead of threads) | 2 | 32 | 0 | I have a python application that grabs a collection of data and for each piece of data in that collection it performs a task. The task takes some time to complete as there is a delay involved. Because of this delay, I don't want each piece of data to perform the task subsequently, I want them to all happen in parallel.... | multiprocess or threading in python? | 0 | 0 | 0 | 18,548 |
1,226,584 | 2009-08-04T09:47:00.000 | 0 | 0 | 1 | 0 | python,multithreading,multiprocess | 1,252,808 | 8 | false | 0 | 0 | IronPython has real multithreading, unlike CPython and it's GIL. So depending on what you're doing it may be worth looking at. But it sounds like your use case is better suited to the multiprocessing module.
To the guy who recommends stackless python, I'm not an expert on it, but it seems to me that he's talking about ... | 2 | 32 | 0 | I have a python application that grabs a collection of data and for each piece of data in that collection it performs a task. The task takes some time to complete as there is a delay involved. Because of this delay, I don't want each piece of data to perform the task subsequently, I want them to all happen in parallel.... | multiprocess or threading in python? | 0 | 0 | 0 | 18,548 |
1,227,031 | 2009-08-04T11:48:00.000 | 0 | 1 | 0 | 0 | python,c,configuration-management | 1,227,256 | 4 | false | 0 | 0 | Despite being hated by techies and disowned by Microsoft, INI files are actually quite popular with users, as they are easy to understand and edit. They are also very simple to write parsers for, should your libraries not already support them. | 1 | 5 | 0 | I am looking for a good config file library for c that is not xml. Optimally I would really like one that also has python bindings. The best option I have come up with is to use a JSON library in both c and python. What would you recommend, or what method of reading/writing configuration settings do you prefer? | What is a good configuration file library for c thats not xml (preferably has python bindings)? | 0 | 0 | 0 | 1,054 |
1,229,068 | 2009-08-04T18:10:00.000 | 1 | 0 | 1 | 0 | python,dictionary,persistence,object-persistence | 1,229,114 | 8 | false | 0 | 0 | Assuming the keys and values have working implementations of repr, one solution is that you save the string representation of the dictionary (repr(dict)) to file. YOu can load it using the eval function (eval(inputstring)). There are two main disadvantages of this technique:
1) Is will not work with types that have a... | 3 | 14 | 0 | So, I want to store a dictionary in a persistent file. Is there a way to use regular dictionary methods to add, print, or delete entries from the dictionary in that file?
It seems that I would be able to use cPickle to store the dictionary and load it, but I'm not sure where to take it from there. | With Python, can I keep a persistent dictionary and modify it? | 0.024995 | 0 | 0 | 10,869 |
1,229,068 | 2009-08-04T18:10:00.000 | 6 | 0 | 1 | 0 | python,dictionary,persistence,object-persistence | 1,229,084 | 8 | false | 0 | 0 | Unpickle from file when program loads, modify as a normal dictionary in memory while program is running, pickle to file when program exits? Not sure exactly what more you're asking for here. | 3 | 14 | 0 | So, I want to store a dictionary in a persistent file. Is there a way to use regular dictionary methods to add, print, or delete entries from the dictionary in that file?
It seems that I would be able to use cPickle to store the dictionary and load it, but I'm not sure where to take it from there. | With Python, can I keep a persistent dictionary and modify it? | 1 | 0 | 0 | 10,869 |
1,229,068 | 2009-08-04T18:10:00.000 | 0 | 0 | 1 | 0 | python,dictionary,persistence,object-persistence | 1,229,320 | 8 | false | 0 | 0 | pickling has one disadvantage. it can be expensive if your dictionary has to be read and written frequently from disk and it's large. pickle dumps the stuff down (whole). unpickle gets the stuff up (as a whole).
if you have to handle small dicts, pickle is ok. If you are going to work with something more complex, go f... | 3 | 14 | 0 | So, I want to store a dictionary in a persistent file. Is there a way to use regular dictionary methods to add, print, or delete entries from the dictionary in that file?
It seems that I would be able to use cPickle to store the dictionary and load it, but I'm not sure where to take it from there. | With Python, can I keep a persistent dictionary and modify it? | 0 | 0 | 0 | 10,869 |
1,229,933 | 2009-08-04T21:04:00.000 | 6 | 0 | 0 | 0 | python,layout,gtk,pygtk | 1,229,981 | 1 | true | 0 | 1 | You should use GtkSizeGroup for this. Create a GtkSizeGroup, add both widgets to it. This will ensure that both widgets have the same size. If you want that widget have the same size in only one direction (width or height), set the "mode" property of SizeGroup. | 1 | 1 | 0 | I'm using pyGTK. I want to layout a large element with 2 smaller ones on each side. For aesthetic reasons, I want the 2 smaller ones to be the same size. As it is, they differ by a few pixels, and the middle element is not centered as a result.
I tried using gtk.Table with 3 cells, but having homogeneous=True doesn't h... | How to make two elements in gtk have the same size? | 1.2 | 0 | 0 | 238 |
1,230,089 | 2009-08-04T21:47:00.000 | 5 | 0 | 0 | 0 | python,django | 1,242,238 | 9 | false | 1 | 0 | The single greatest thing you can do to make your life with Django better is -Learn Python-
I have watched people inundate the mailing lists and IRC with problems directly related to their lack of language knowledge. I am not even talking about hard concepts, but rather things like this example interaction:
User: How ... | 2 | 16 | 0 | First question:
What is your favorite Django book or online learning material? CodeProject examples + Django documentation, O'Reilly, etc.
Second Question: What are some good tips and advice you have picked up along the way which helps you to use Django more effectively? Certain design patterns, language idioms, fra... | Two parter: Django book recommendation + Django real world advice | 0.110656 | 0 | 0 | 3,014 |
1,230,089 | 2009-08-04T21:47:00.000 | 1 | 0 | 0 | 0 | python,django | 1,242,465 | 9 | false | 1 | 0 | I Just finished the Practical Django Projects (for version 1.1)as mentioned in piquadrat, Travis' and Alasdairs' answers. I had a lot of aha moments and many more I'll need to get back to that again to fully digest moments.
When James Bennet, the author gets the code samples into the Mercurial repository on BitBucket i... | 2 | 16 | 0 | First question:
What is your favorite Django book or online learning material? CodeProject examples + Django documentation, O'Reilly, etc.
Second Question: What are some good tips and advice you have picked up along the way which helps you to use Django more effectively? Certain design patterns, language idioms, fra... | Two parter: Django book recommendation + Django real world advice | 0.022219 | 0 | 0 | 3,014 |
1,230,392 | 2009-08-04T23:17:00.000 | 0 | 0 | 0 | 0 | python,django | 1,230,419 | 2 | false | 1 | 0 | you can just write a middleware that does exactly that, no need to repeat logging code on every view function. | 1 | 0 | 0 | I was hoping that Django had a built in way of getting the last url that was visited in the app itself. As I write this I realize that there are some complications in doing something like that (excluding pages that redirect, for example) but i thought I'd give it a shot.
if there isn't a built-in for this, what stra... | Does Django have a built in way of getting the last app url the current user visited? | 0 | 0 | 0 | 747 |
1,230,479 | 2009-08-04T23:45:00.000 | 1 | 0 | 1 | 0 | python,py2exe,msvcr90.dll | 1,230,912 | 2 | true | 0 | 0 | Vista 64bit has a 32 bit emulator I believe, so you will not need to worry about this.
However, I would just tell them to install the msvcrt runtime which is supposed to be the correct way to deal with this sxs mess. | 1 | 0 | 0 | I was working on an update to my application and before I began I migrated to 2.62 because it seemed to be the time to. I walked right into the issue of having problems building my application using py2exe because of the MSVCR90.dlls. There seems to be a fair amount of information on how to solve this issue, includin... | Do I only need to check the users machine for the version of the MSVCR90.dll that was installed with my python installation? | 1.2 | 0 | 0 | 314 |
1,231,397 | 2009-08-05T05:47:00.000 | 3 | 0 | 1 | 0 | python,ide | 1,231,658 | 9 | false | 0 | 0 | Under Unix, Emacs is a good choice, to which I always come back, because it is convenient to have a single editor for everything, and because it's open source.
What is best for you depends on your past experience with IDEs. I'd say: stick with what you've been using, or take this opportunity to try an even better IDE.... | 1 | 1 | 0 | I'm a complete newbie to Python. I've worked on PHP/JavaScript earlier but starting today I'm moving onto Python. I have no idea about the environment needed for it. I could use some suggestions on it for me to get started. | New to Python. Need info on the environment for it | 0.066568 | 0 | 0 | 297 |
1,231,688 | 2009-08-05T07:33:00.000 | 7 | 0 | 1 | 0 | python,packages,setuptools,easy-install | 4,320,437 | 13 | false | 0 | 0 | To list installed Python packages, you can use yolk -l. You'll need to use easy_install yolk first though. | 4 | 713 | 0 | Python's easy_install makes installing new packages extremely convenient. However, as far as I can tell, it doesn't implement the other common features of a dependency manager - listing and removing installed packages.
What is the best way of finding out what's installed, and what is the preferred way of removing insta... | How do I remove packages installed with Python's easy_install? | 1 | 0 | 0 | 547,972 |
1,231,688 | 2009-08-05T07:33:00.000 | 193 | 0 | 1 | 0 | python,packages,setuptools,easy-install | 1,233,282 | 13 | false | 0 | 0 | To uninstall an .egg you need to rm -rf the egg (it might be a directory) and remove the matching line from site-packages/easy-install.pth | 4 | 713 | 0 | Python's easy_install makes installing new packages extremely convenient. However, as far as I can tell, it doesn't implement the other common features of a dependency manager - listing and removing installed packages.
What is the best way of finding out what's installed, and what is the preferred way of removing insta... | How do I remove packages installed with Python's easy_install? | 1 | 0 | 0 | 547,972 |
1,231,688 | 2009-08-05T07:33:00.000 | 0 | 0 | 1 | 0 | python,packages,setuptools,easy-install | 49,375,186 | 13 | false | 0 | 0 | This worked for me. It's similar to previous answers but the path to the packages is different.
sudo easy_install -m
sudo rm -rf /Library/Python/2.7/site-packages/.egg
Plaform: MacOS High Sierra version 10.13.3 | 4 | 713 | 0 | Python's easy_install makes installing new packages extremely convenient. However, as far as I can tell, it doesn't implement the other common features of a dependency manager - listing and removing installed packages.
What is the best way of finding out what's installed, and what is the preferred way of removing insta... | How do I remove packages installed with Python's easy_install? | 0 | 0 | 0 | 547,972 |
1,231,688 | 2009-08-05T07:33:00.000 | 3 | 0 | 1 | 0 | python,packages,setuptools,easy-install | 26,481,670 | 13 | false | 0 | 0 | For me only deleting this file : easy-install.pth
worked, rest pip install django==1.3.7 | 4 | 713 | 0 | Python's easy_install makes installing new packages extremely convenient. However, as far as I can tell, it doesn't implement the other common features of a dependency manager - listing and removing installed packages.
What is the best way of finding out what's installed, and what is the preferred way of removing insta... | How do I remove packages installed with Python's easy_install? | 0.046121 | 0 | 0 | 547,972 |
1,231,853 | 2009-08-05T08:22:00.000 | 3 | 0 | 1 | 0 | python,mercurial,ironpython | 1,231,883 | 4 | false | 0 | 0 | Mercurial bundles the necessary python binaries within it, I believe. | 2 | 8 | 0 | I have Mercurial 1.3 installed on my Windows 7 machine. I don't have python installed, but Mercurial seems to be OK with that.
How does it work?
Also, is it possible to force Mercurial run on IronPython and will it be compatible?
Thank you. | How does mercurial work without Python installed? | 0.148885 | 0 | 0 | 1,764 |
1,231,853 | 2009-08-05T08:22:00.000 | 6 | 0 | 1 | 0 | python,mercurial,ironpython | 1,283,908 | 4 | false | 0 | 0 | Others have answered the first question -- let me give a guess about the second part.
Mercurial will normally use some C extensions for speed. You cannot use those with IronPython.
But we also ship pure Python versions of these modules, and depending on how much IronPython implements of a standard Python 2.4 environme... | 2 | 8 | 0 | I have Mercurial 1.3 installed on my Windows 7 machine. I don't have python installed, but Mercurial seems to be OK with that.
How does it work?
Also, is it possible to force Mercurial run on IronPython and will it be compatible?
Thank you. | How does mercurial work without Python installed? | 1 | 0 | 0 | 1,764 |
1,233,448 | 2009-08-05T14:00:00.000 | -2 | 0 | 1 | 0 | python,syntax,lambda | 57,386,600 | 20 | false | 0 | 0 | because a lambda function is supposed to be one-lined, as its the simplest form of a function, an entrance, then return | 1 | 434 | 0 | I've heard it said that multiline lambdas can't be added in Python because they would clash syntactically with the other syntax constructs in Python. I was thinking about this on the bus today and realized I couldn't think of a single Python construct that multiline lambdas clash with. Given that I know the language ... | No Multiline Lambda in Python: Why not? | -0.019997 | 0 | 0 | 257,943 |
1,234,292 | 2009-08-05T16:23:00.000 | 0 | 0 | 0 | 1 | python,sockets,twisted,twisted.words | 1,236,382 | 1 | true | 0 | 0 | ok, for sorting out this issue I have set a __del__ method in the protocol class and I am now logging protocol instances that have not been garbage collected within 1 minute from the time the client has disconnected.
If anybody has any better solution I'll still be glad to hear about it but so far I have already fixed... | 1 | 4 | 0 | I have a pretty intensive chat socket server written in Twisted Python, I start it using internet.TCPServer with a factory and that factory references to a protocol object that handles all communications with the client.
How should I make sure a protocol instance completely destroys itself once a client has disconnecte... | In Twisted Python - Make sure a protocol instance would be completely deallocated | 1.2 | 0 | 1 | 721 |
1,235,417 | 2009-08-05T19:59:00.000 | 4 | 0 | 0 | 0 | python,windows,gtk,pygtk | 1,235,424 | 2 | false | 0 | 1 | Just call the set_deletable with False on the window in question. It will work as long as GTK can convince the window manager to make the window unclosable. | 1 | 4 | 0 | For example, graying out the "X" on windows systems. | In GTK, how do I make a window unable to be closed? | 0.379949 | 0 | 0 | 721 |
1,235,777 | 2009-08-05T21:10:00.000 | 1 | 0 | 0 | 0 | python,django,centos | 1,252,372 | 2 | true | 1 | 0 | Didn't we solve this for you in IRC the other day? If not, there was someone with the same OS and vague problem description.
Turned out to be a third-party app causing the problem, not the newly added one (which a review of the trackback proved if read carefully) | 1 | 0 | 0 | i'm running on wsgi on centos 5...
i've recently updated locally from 1.0 to 1.1
I updated the server using svn update
now when I apply a new app developed locally to the server it returns with a 500 error.
all i'm doing is python manage.py startapp appname
adding the app into installed_apps in the settings file and ... | new django app's from 1.1 causing 500 error | 1.2 | 0 | 0 | 301 |
1,236,060 | 2009-08-05T22:16:00.000 | 2 | 0 | 1 | 0 | python,debugging,visual-c++ | 2,190,931 | 5 | false | 0 | 0 | This works also when linking with static libraries. I made a copy of python26.lib, and renamed it python26_d.lib. I commented out the line #define PY_DEBUG in pyconfig.h. Also changed the pragma to "pragma comment(lib,"python26.lib")" on line 332. Voila! It worked. | 1 | 22 | 0 | Python rather stupidly has a pragma directive in its include files that forces a link against python26_d.lib when the DEBUG preprocessor variable is defined. This is a problem because the python installer doesn't come with python26_d.lib! So I can't build applications in MSVC in debug mode. If I temporarily #undef DEBU... | Compiling python modules with DEBUG defined on MSVC | 0.07983 | 0 | 0 | 10,281 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.