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,545,168 | 2011-04-04T22:45:00.000 | 0 | 0 | 1 | 0 | python,junit4 | 5,545,488 | 1 | true | 0 | 0 | That syntax is called decorator in python 2.6. I'm not sure whether it is the same thing as an innotation though. | 1 | 1 | 0 | I am referring to JUnit annotations like @test, @before , @after.
e.g i can write a method:
@Ignore("Not Ready to Run")
@Test
multiplication():
self.assertEqual('15', simpleMath.multiply(3, 5)) | Are annotations supported by Python 2.6.x | 1.2 | 0 | 0 | 199 |
5,546,062 | 2011-04-05T01:07:00.000 | 4 | 0 | 0 | 0 | python,performance,parsing | 5,546,212 | 1 | false | 0 | 0 | The speed of these parsers is mostly a property of the grammar they support. SPARK supports Earley grammars and PLY supports LALR(1) grammars. There is a great deal of information available about the pros and cons of each style of grammar, so I will just provide a quick overview here.
The biggest difference between Ear... | 1 | 2 | 0 | SPARK-based parsers are more slow than PLY-based ones, AFAIK. But how much slower? Are they suitable for industrial-strength compilers?
If you have something else to say about pros and cons of SPARK, I'll be glad to hear. | What is the performance of SPARK-based parsers? | 0.664037 | 0 | 0 | 427 |
5,546,499 | 2011-04-05T02:24:00.000 | 0 | 0 | 0 | 0 | python,django | 5,564,022 | 2 | false | 1 | 0 | RDBMS with type based structures are not designed for that. For instance, take Google's big table, which don't complain what you store (i.e, product A property types may be entirely different from product B, though both are of type Product).
You need object based storage system, with type flexibility.
Are you sure you... | 1 | 2 | 0 | I'd like to know the best way to associate various data types with an object in Django. Some of the types should be string, boolean, image file, choice from a list, or a link. For example, say you have a Product model. For product X, you'll want to add an image attribute, a string for the model name, and a link. For... | How do you implement multiple data types for an object in Django? | 0 | 0 | 0 | 1,476 |
5,546,860 | 2011-04-05T03:26:00.000 | 1 | 0 | 1 | 1 | python-imaging-library,homebrew | 36,866,806 | 4 | false | 0 | 0 | As @BarnabasSzabolcs mentioned, newer versions named pillow.
an alternative to brew install Homebrew/python/pillow is pip install pillow. You may need to add sudo, depends on your python environment permissions.
p.s.
that answer could be fit better as a comment, 14 credits to go... | 1 | 12 | 0 | In a new SnowLeopard install, I'd like to use homebrew to install PIL. However the recipe installs PIL under cellar instead of in /Library/Python/2.6/site-packages. Is there a way to change the install directory? | How to install PIL in system library using homebrew? | 0.049958 | 0 | 0 | 19,221 |
5,546,937 | 2011-04-05T03:43:00.000 | 1 | 0 | 1 | 0 | python,module | 5,546,952 | 3 | false | 0 | 0 | Unless ~ is your current directory or is in sys.path (which it shouldn't be) you won't be able to use any packages contained in it, including speech and its subpackages. Put the directory structure somewhere sane and add that path to $PYTHONPATH. | 1 | 1 | 0 | I'm having a hard time understanding this.
Lets assume I have a directory tree that looks like this:
~/speech
-- __init__.py
-- program.py
----------------
~/speech/parts
----__init__.py
----noun.py
----verb.py
----------------
~/speech/sentence
----__init__.py
----subject.py
----predicate.py
the __init__.py files... | python - using __init__.py for modules in multiple dirs | 0.066568 | 0 | 0 | 1,190 |
5,547,692 | 2011-04-05T05:41:00.000 | 1 | 0 | 1 | 0 | python,qt,introspection,qtscript | 5,549,948 | 2 | false | 0 | 0 | You really should look more at QObject and QMetaObject.
QScriptValue supports the types defined in the ECMA-262 standard: The primitive types, which are Undefined, Null, Boolean, Number, and String; and the Object type. Additionally, Qt Script has built-in support for QVariant, QObject and QMetaObject.
From Qt's QMetaO... | 1 | 1 | 0 | Does QtScript support introspection/reflection (i.e. like python's dir() for example) that would enble me to 'map out' an api from the inside by exploring the object model at runtime? | QtScript Introspection/Reflection? | 0.099668 | 0 | 0 | 698 |
5,551,269 | 2011-04-05T11:45:00.000 | 0 | 1 | 1 | 0 | python,git | 67,986,868 | 7 | false | 0 | 0 | if you have committed in the repo, just
go to the folder /__pycache__,
delete all of them (no worries, they are temporary files and generated repeatedly)
have a new commit, such as 'update gitignore'
you are done! .pyc will not appear again. | 2 | 137 | 0 | How can I ignore .pyc files in git?
If I put it in .gitignore it doesn't work. I need them to be untracked and not checked for commits. | Ignore .pyc files in git repository | 0 | 0 | 0 | 164,905 |
5,551,269 | 2011-04-05T11:45:00.000 | 94 | 1 | 1 | 0 | python,git | 5,551,629 | 7 | false | 0 | 0 | You have probably added them to the repository before putting *.pyc in .gitignore.
First remove them from the repository. | 2 | 137 | 0 | How can I ignore .pyc files in git?
If I put it in .gitignore it doesn't work. I need them to be untracked and not checked for commits. | Ignore .pyc files in git repository | 1 | 0 | 0 | 164,905 |
5,552,049 | 2011-04-05T12:46:00.000 | 0 | 0 | 0 | 1 | python,atom-feed,google-reader | 5,554,213 | 1 | true | 0 | 0 | The Google Reader API does not support ETags or If-Modified-Since. However, it does support an ot=<timestamp in seconds since the epoch> parameter which you can use to restrict fetched data to items since you last attempted a fetch. | 1 | 0 | 0 | I am using the universal feed parser library in python to get an atom feed. This atom feed has been generated using google reader after bundling several subscriptions.
I am able to receive the latest feeds, however the feedparser.parse(url) returns a FeedParserDict which doesnot have the etag or modified values. I una... | getting etag from 'google reader bundle' feed using universal feed parser in python | 1.2 | 0 | 1 | 203 |
5,552,162 | 2011-04-05T12:55:00.000 | 2 | 0 | 0 | 0 | python,apache2,mingw,lxml,cx-oracle | 5,559,988 | 1 | true | 1 | 0 | It is indeed because of 'msvcrt90.dll'. From somewhere in micro patch revisions of Python 2.6 they stopped building in automatic dependencies on the DLL for extension modules and relied on Python executable doing it. When embedded in other systems however you are then dependent on that executable linking to DLL and in ... | 1 | 2 | 0 | when I launch my application with apache2+modwsgi
I catch
Exception Type: ImportError
Exception Value: DLL load failed: The specified module could not be found.
in line
from lxml import etree
with Django dev server all works fine
Visual C++ Redistributable 2008 installed
Dependency walker told that msvcrt90.dll... | problem with soaplib (lxml) with apache2 + mod_wsgi | 1.2 | 1 | 0 | 1,054 |
5,552,234 | 2011-04-05T13:01:00.000 | 0 | 0 | 1 | 0 | python | 5,552,372 | 7 | false | 0 | 0 | It is very well possible to have multiple versions of python on your machine. Just make sure, that if you call python in your console it uses the python you want it to use. Same goes for your IDE.
Regarding the version: It is always nice to have the latest version on board (in python however there are compatibility iss... | 3 | 6 | 0 | I'm a newbie programmer just installing Python 3.2, but I know I also have an older version of Python on my machine. in fact, I think Macbook comes with it installed. Do I have to worry about having different versions on my computer when I try to start learning Python? | Will installing new version of Python conflict with old versions | 0 | 0 | 0 | 18,947 |
5,552,234 | 2011-04-05T13:01:00.000 | 0 | 0 | 1 | 0 | python | 5,552,361 | 7 | false | 0 | 0 | Python version with different major or minor version numbers can be installed in parallel. For example, you can have 2.4, 2.5, 2.6, 2.7 and 3.1 on the same machine. However, you can't have versions with the same major and minor number installed at the same time (at least, not without tricks), so you can't have 2.5.2 an... | 3 | 6 | 0 | I'm a newbie programmer just installing Python 3.2, but I know I also have an older version of Python on my machine. in fact, I think Macbook comes with it installed. Do I have to worry about having different versions on my computer when I try to start learning Python? | Will installing new version of Python conflict with old versions | 0 | 0 | 0 | 18,947 |
5,552,234 | 2011-04-05T13:01:00.000 | 0 | 0 | 1 | 0 | python | 5,868,126 | 7 | false | 0 | 0 | Be careful before installing new version of python.
Python has no backward compatibility.
Scripts written for python 2.7.* won't work on python 3
For example,
print "Hello" will work on python 2.7 but not on version3 | 3 | 6 | 0 | I'm a newbie programmer just installing Python 3.2, but I know I also have an older version of Python on my machine. in fact, I think Macbook comes with it installed. Do I have to worry about having different versions on my computer when I try to start learning Python? | Will installing new version of Python conflict with old versions | 0 | 0 | 0 | 18,947 |
5,552,641 | 2011-04-05T13:30:00.000 | 2 | 0 | 0 | 0 | python,numpy,matplotlib,plot,visualization | 5,555,313 | 2 | false | 0 | 0 | The key thing to consider is whether you have important structure along both dimensions in the matrix. If you do then it's worth trying a colored matrix plot (e.g., imshow), but if your ten topics are basically independent, you're probably better off doing ten individual line or histogram plots. Both plots have advan... | 1 | 8 | 1 | I have a very large matrix(10x55678) in "numpy" matrix format. the rows of this matrix correspond to some "topics" and the columns correspond to words(unique words from a text corpus). Each entry i,j in this matrix is a probability, meaning that word j belongs to topic i with probability x. since I am using ids rather ... | plotting a 2D matrix in python, code and most useful visualization | 0.197375 | 0 | 0 | 30,834 |
5,553,769 | 2011-04-05T14:44:00.000 | 1 | 0 | 0 | 0 | python,caching | 5,555,511 | 3 | false | 1 | 0 | I would probably use threading.Timer for this. A Timer object will call a specified function with given arguments after a period of time. So write a function that returns a JSON object to the pool, and start a timer that specifies the specific JSON object that has been reserved. Additionally, you can cancel a timer bef... | 1 | 3 | 0 | I have a need to reserve an object (JSON) within my app for a period of time (typically 180 seconds) At some point the client may or may not come back and request this object by its key.
The tricky part is that I need to be notified when this object expires so I can return it to the available pool if the client hasn't... | Add 'object' to a stack with expiry timers and get notified when it expires | 0.066568 | 0 | 0 | 964 |
5,553,798 | 2011-04-05T14:46:00.000 | 3 | 0 | 1 | 0 | c++,python,boost | 5,951,300 | 2 | false | 0 | 0 | bjam is used for compiling boost itself (although your can use it as configuration tool for your code aswell). Running the utility should compile the library and does not require any further work, afaik.
The include and library paths you have listed in your second post are correct, as far as I can tell (assuming the pa... | 2 | 4 | 0 | I'm having a bit of trouble finding a guide that allows me to integrate the Boost.Python compilation into VS 8. It seems like it depends heavily on this bjam utility to build the source, but there isn't any mention of how this can integrate into VS 8 interface.
I can see that the bjam program calls VS 8 to do much of ... | Integrating Boost.Python with Visual Studio 8 | 0.291313 | 0 | 0 | 1,049 |
5,553,798 | 2011-04-05T14:46:00.000 | 0 | 0 | 1 | 0 | c++,python,boost | 5,556,549 | 2 | false | 0 | 0 | I found the issue, thanks for the suggestion Phillip. It turns out I just needed to provide the correct header and library directories to VS 8 and compile as a DLL (not a console program).
Include Directories:
\boost-python\boost_1_46_1
\Python27\include`
Library Directories:
\Python27\libs
\boost-python\boost_1_46... | 2 | 4 | 0 | I'm having a bit of trouble finding a guide that allows me to integrate the Boost.Python compilation into VS 8. It seems like it depends heavily on this bjam utility to build the source, but there isn't any mention of how this can integrate into VS 8 interface.
I can see that the bjam program calls VS 8 to do much of ... | Integrating Boost.Python with Visual Studio 8 | 0 | 0 | 0 | 1,049 |
5,554,429 | 2011-04-05T15:33:00.000 | 1 | 1 | 0 | 0 | python,shell,integration-testing | 5,554,478 | 2 | false | 0 | 0 | Yes. The unittest libraries can be used for this.
Don't be fooled by the name. A "unit" is not always a single, standalone class (or function).
A "unit" can be a composite "unit" of one or more classes or modules or packages. | 1 | 0 | 0 | I have a Python command line script that connects to a database, generates files from the data and sends e-mails. I already have some unit-tests for the important components. Now I'd like to do tests that use several or all components together, load the test database with sample data and check for the correct output.
... | How to do integration tests for a Python script? | 0.099668 | 0 | 0 | 522 |
5,555,367 | 2011-04-05T16:43:00.000 | 0 | 0 | 1 | 0 | python,executable,py2exe | 20,275,085 | 3 | false | 0 | 0 | As others said, you need the .dll files to run the program. It works however if you leave the program in the dist folder (or create a copy of dist) and create a shortcut. You can move the shortcut wherever you like and it will work, since the file itself is still in the folder with the .dlls. | 3 | 4 | 0 | I'm still new to Python and py2exe. I've created an executable from py2exe, but when I try to copy the single .executable from the "dist" folder it was created in, and paste it else where (let's say my desktop), When I open the executable after it's moved from the folder it opens quickly disappears (it's a console app... | Created an .exe with py2exe, but when I copy paste from "dist" folder to desktop, doesn't run properly | 0 | 0 | 0 | 2,089 |
5,555,367 | 2011-04-05T16:43:00.000 | 0 | 0 | 1 | 0 | python,executable,py2exe | 50,486,663 | 3 | false | 0 | 0 | Put your dist folder into the system search path, and it should work fine.
This happened to me also in times past. | 3 | 4 | 0 | I'm still new to Python and py2exe. I've created an executable from py2exe, but when I try to copy the single .executable from the "dist" folder it was created in, and paste it else where (let's say my desktop), When I open the executable after it's moved from the folder it opens quickly disappears (it's a console app... | Created an .exe with py2exe, but when I copy paste from "dist" folder to desktop, doesn't run properly | 0 | 0 | 0 | 2,089 |
5,555,367 | 2011-04-05T16:43:00.000 | 6 | 0 | 1 | 0 | python,executable,py2exe | 5,555,393 | 3 | true | 0 | 0 | In the dist directory is there a set of .dll files needed to run the exe file. | 3 | 4 | 0 | I'm still new to Python and py2exe. I've created an executable from py2exe, but when I try to copy the single .executable from the "dist" folder it was created in, and paste it else where (let's say my desktop), When I open the executable after it's moved from the folder it opens quickly disappears (it's a console app... | Created an .exe with py2exe, but when I copy paste from "dist" folder to desktop, doesn't run properly | 1.2 | 0 | 0 | 2,089 |
5,555,975 | 2011-04-05T17:31:00.000 | 1 | 0 | 1 | 0 | python,algorithm,image-processing | 5,556,151 | 2 | false | 0 | 0 | I guess the most straightforward way to achieve this is to compute the correlation map of the two images. Just convolve the two images using a scientific library such as scipy, apply a low pass filter and find the maximum value of the result.
You should check out the following packages:
numpy
scipy
matplotlib
PIL if y... | 1 | 1 | 1 | I have to create a python image processing program which reads in two images, one containing a single object and the other containing several objects. However, the first images object is present in the second image but is surrounded by other objects (some similar).
The images are both the same size but I am having pro... | Finding an object within an image containing many objects (Python) | 0.099668 | 0 | 0 | 711 |
5,557,937 | 2011-04-05T20:16:00.000 | 5 | 0 | 1 | 0 | python | 5,557,954 | 4 | false | 0 | 0 | if/else is probably more appropriate here, since any exceptions raised would be ones you threw yourself (and you'd still have to handle them). | 2 | 6 | 0 | I want to restrict user input so that a provided N obeys N >0 or N < 100.
Should I use if... else or try... except? Could you provide examples of both approaches? | How do I use try .. except or if ...else to validate user input? | 0.244919 | 0 | 0 | 25,866 |
5,557,937 | 2011-04-05T20:16:00.000 | 1 | 0 | 1 | 0 | python | 5,557,969 | 4 | false | 0 | 0 | The simplest approach would be if/else.
But I'd probably do both a validator with if/else and thrown exception. | 2 | 6 | 0 | I want to restrict user input so that a provided N obeys N >0 or N < 100.
Should I use if... else or try... except? Could you provide examples of both approaches? | How do I use try .. except or if ...else to validate user input? | 0.049958 | 0 | 0 | 25,866 |
5,558,388 | 2011-04-05T20:54:00.000 | 1 | 0 | 0 | 0 | python,pylons | 7,864,808 | 2 | false | 0 | 0 | That would be bad if you use many forms of
I suggest using Pylons with WTForm
To cope with WTForm create a separate class, for example, a Layout that will handle all of the fields in the form of a uniform standard adopted by your site.
This is very good to make the processing of forms in a separate class because they d... | 1 | 3 | 0 | Is using formbuild with pylons, when you have pretty customized needs, actually easier than manually creating your own form html? | Formbuild with Pylons? | 0.099668 | 0 | 0 | 218 |
5,558,717 | 2011-04-05T21:24:00.000 | 1 | 0 | 1 | 0 | python | 5,558,751 | 3 | false | 0 | 0 | Your second problem is impossible without remembering a state on the server. The client must and shall always be seen as unsafe. There is no sane way of getting the same strings back as you sent. The user can always hack in on some way.
Unless you want to do this cryptographically, which I really doubt :)
However, if y... | 2 | 1 | 0 | The problem I'm really trying to solve:
I have a square table of true/false values, with rows and columns labelled by strings.
I want to display this as an html form with checkboxes, allow the user to tick and untick elements, then submit the form, and then I want to reconstruct the array from the form.
The subproblem ... | how to turn a tuple to a string and back in python / how to edit an associative array on a web page | 0.066568 | 0 | 0 | 939 |
5,558,717 | 2011-04-05T21:24:00.000 | 0 | 0 | 1 | 0 | python | 5,569,704 | 3 | true | 0 | 0 | Looks like json is the usual way, and it's a python built-in
import json
json.dumps(("hi","there"))
'["hi", "there"]'
json.loads('["hi", "there"]')
[u'hi', u'there']
json.loads(json.dumps(("hi","th'ere",'the"e$re')))
[u'hi', u"th'ere", u'the"e$re'] | 2 | 1 | 0 | The problem I'm really trying to solve:
I have a square table of true/false values, with rows and columns labelled by strings.
I want to display this as an html form with checkboxes, allow the user to tick and untick elements, then submit the form, and then I want to reconstruct the array from the form.
The subproblem ... | how to turn a tuple to a string and back in python / how to edit an associative array on a web page | 1.2 | 0 | 0 | 939 |
5,559,256 | 2011-04-05T22:18:00.000 | 9 | 0 | 1 | 0 | python | 5,559,270 | 2 | true | 0 | 0 | No. And that's the philosophy of python: Do not make the compiler/parser enforce privacy since developers who want to access private members have ways to do so anyway (reflection etc.).
The idea is telling people Hey, this is not part of the public API. If you use it improperly, it could breaks things or kill your cat.... | 2 | 2 | 0 | I see a lot of python code that does "loose" private variables / functions. They'll declare functions / variables with one underscore (eg. _foo) and then use it just in the class / file. It really annoys me that they don't use the double underscore because eventually, someone will call this "private" member from outsid... | Private functions / Variables enforcement in python | 1.2 | 0 | 0 | 1,309 |
5,559,256 | 2011-04-05T22:18:00.000 | 6 | 0 | 1 | 0 | python | 5,559,290 | 2 | false | 0 | 0 | In Python, there is no strict concept(like Java for example) of private methods. Even using double underscores is still accessible by doing _classname__method.
In short, don't go against the grain, rather go with the Python philosophy in which private is a convention, not a force. | 2 | 2 | 0 | I see a lot of python code that does "loose" private variables / functions. They'll declare functions / variables with one underscore (eg. _foo) and then use it just in the class / file. It really annoys me that they don't use the double underscore because eventually, someone will call this "private" member from outsid... | Private functions / Variables enforcement in python | 1 | 0 | 0 | 1,309 |
5,559,645 | 2011-04-05T23:10:00.000 | 0 | 0 | 0 | 0 | python,sql-server,sqlalchemy | 5,559,890 | 1 | true | 0 | 0 | At this moment none of the known Python drivers to connect to Sql Server had a compatible python 3000 version.
PyODBC
mxODBC
pymssql
zxjdbc
AdoDBAPI | 1 | 0 | 0 | I'm currently working on a proof of concept application using Python 3.2 via SQLAlchemy with a MS SQL Server back end. Thus far, I'm hitting a brick wall looking for ways to actually do the connection. Most discussions point to using pyODBC, however it does not support Python 3.x yet.
Does anyone have any connection ... | SQLAlchemy 3.2 and MS SQL Connectivity | 1.2 | 1 | 0 | 867 |
5,559,660 | 2011-04-05T23:13:00.000 | 0 | 0 | 1 | 0 | python,sqlite | 5,559,724 | 5 | false | 0 | 0 | You could capture the error when trying to create the file in your code and in your exception handler, check if the file exists and use the existing file instead of creating it. | 2 | 0 | 0 | I'm working on a python server which concurrently handles transactions on a number of databases, each storing performance data about a different application. Concurrency is accomplished via the Multiprocessing module, so each transaction thread starts in a new process, and shared-memory data protection schemes are not ... | Prevent a file from being created in python | 0 | 1 | 0 | 327 |
5,559,660 | 2011-04-05T23:13:00.000 | 0 | 0 | 1 | 0 | python,sqlite | 5,559,768 | 5 | false | 0 | 0 | You didn't mention the platform, but on linux open(), or os.open() in python, takes a flags parameter which you can use. The O_CREAT flag creates a file if it does not exist, and the O_EXCL flag gives you an error if the file already exists. You'll also be needing O_RDONLY, O_WRONLY or O_RDWR for specifying the access ... | 2 | 0 | 0 | I'm working on a python server which concurrently handles transactions on a number of databases, each storing performance data about a different application. Concurrency is accomplished via the Multiprocessing module, so each transaction thread starts in a new process, and shared-memory data protection schemes are not ... | Prevent a file from being created in python | 0 | 1 | 0 | 327 |
5,560,291 | 2011-04-06T00:46:00.000 | 0 | 0 | 1 | 0 | python,python-imaging-library,pygame | 5,608,836 | 2 | false | 0 | 0 | I am experimenting with the Python interface to OpenCV. It is capable of doing real time calculations on the movie stream. | 1 | 0 | 0 | I have a media file (AVI or mpeg doesn't really matter) I'd like to just get the top half of the each frame and remove the lower half from my video. IS there any library in python that can help me? | Using Python to crop an AVI file | 0 | 0 | 0 | 832 |
5,561,701 | 2011-04-06T05:06:00.000 | 10 | 0 | 1 | 1 | javascript,python,comparison,node.js,tornado | 5,563,767 | 5 | false | 0 | 0 | node.js uses V8 which compiles into assembly code, tornado doesn't do that yet.
Other than that (which doesn't actually seem to make much difference to the speed), it's the ecosystem. Do you prefer the event model of JS, or the way Python works? Are you happier using Python or JS libraries? | 3 | 81 | 0 | Besides the fact that node.js is written in JS and Tornado in Python, what are some of the differences between the two? They're both non-blocking asynchronous web servers, right? Why choose one over the other besides the language? | Differences between node.js and Tornado | 1 | 0 | 0 | 30,121 |
5,561,701 | 2011-04-06T05:06:00.000 | 3 | 0 | 1 | 1 | javascript,python,comparison,node.js,tornado | 9,171,990 | 5 | false | 0 | 0 | Nodejs also has a seamless integration / implementation of websockets called Socket.io. It handles browsers supporting sockets - events and also has backward polling compatibility for older browsers. It is quite quick on development requiring a notification framework or some similar event based programming. | 3 | 81 | 0 | Besides the fact that node.js is written in JS and Tornado in Python, what are some of the differences between the two? They're both non-blocking asynchronous web servers, right? Why choose one over the other besides the language? | Differences between node.js and Tornado | 0.119427 | 0 | 0 | 30,121 |
5,561,701 | 2011-04-06T05:06:00.000 | 3 | 0 | 1 | 1 | javascript,python,comparison,node.js,tornado | 29,455,334 | 5 | false | 0 | 0 | I would suggested you go with NodeJS, if there is no personal pref to python. I like Python a lot, but for async I choose Tornado over node, and later had to struggle finding way to do a thing, or libraries with async support (like Cassandra has async in tests, but nowhere could I find way to use cqlengine with async. ... | 3 | 81 | 0 | Besides the fact that node.js is written in JS and Tornado in Python, what are some of the differences between the two? They're both non-blocking asynchronous web servers, right? Why choose one over the other besides the language? | Differences between node.js and Tornado | 0.119427 | 0 | 0 | 30,121 |
5,561,950 | 2011-04-06T05:41:00.000 | 1 | 0 | 0 | 0 | java,javascript,python,https,web-scraping | 5,561,974 | 3 | false | 1 | 0 | If they've created a Web API that their JavaScript interfaces with, you might be able to scrape that directly, rather than trying to go the HTML route.
If they've obfuscated it or that option isn't available for some other reason, you'll basically need a Web browser to evaluate the JavaScript and then scrap the browser... | 1 | 12 | 0 | I am trying to monitor day-to-day prices from an online catalogue.
The site uses HTTPS and generates the catalogue pages with javascript. How can i interface with the site and make it generate the pages I need?
I have done this with other sites where the HTML can easily be accessed, I have no problem parseing the HTML... | How to scrape HTTPS javascript web pages | 0.066568 | 0 | 1 | 9,750 |
5,563,089 | 2011-04-06T07:52:00.000 | 6 | 0 | 1 | 0 | python,python-2.x | 37,502,042 | 7 | false | 0 | 0 | raw_input is a form of input that takes the argument in the form of a string whereas the input function takes the value depending upon your input.
Say, a=input(5) returns a as an integer with value 5 whereas
a=raw_input(5) returns a as a string of "5" | 1 | 132 | 0 | What is the raw_input function? Is it a user interface? When do we use it? | raw_input function in Python | 1 | 0 | 0 | 686,872 |
5,563,437 | 2011-04-06T08:25:00.000 | 1 | 0 | 0 | 0 | python,sqlalchemy | 5,564,716 | 1 | false | 0 | 0 | You can't do that. You must parse the file and split it into individual SQL commands, and then execute each one separately in a transaction. | 1 | 2 | 0 | Any idea on how I could run a bunch of .sql files that contains lots of functions from within sqlalchemy, after I create the schema ? I've tried using DDL(), engine.text(<text>).execute(), engine.execute(<text>). None of them work, they are either failing because improper escape or some other weird errors. I am using s... | run .sql files from within sqlalchemy | 0.197375 | 1 | 0 | 1,729 |
5,563,743 | 2011-04-06T08:51:00.000 | 0 | 0 | 0 | 0 | python,math,matrix,scipy,linear-algebra | 5,715,781 | 5 | true | 0 | 0 | One good solution is to calculate all the minors of determinants and check they are all non negatives. | 3 | 13 | 1 | I want to check if a matrix is positive definite or positive semidefinite using Python.
How can I do that? Is there a dedicated function in SciPy for that or in other modules? | Check for positive definiteness or positive semidefiniteness | 1.2 | 0 | 0 | 19,269 |
5,563,743 | 2011-04-06T08:51:00.000 | 0 | 0 | 0 | 0 | python,math,matrix,scipy,linear-algebra | 5,565,951 | 5 | false | 0 | 0 | an easier method is to calculate the determinants of the minors for this matrx. | 3 | 13 | 1 | I want to check if a matrix is positive definite or positive semidefinite using Python.
How can I do that? Is there a dedicated function in SciPy for that or in other modules? | Check for positive definiteness or positive semidefiniteness | 0 | 0 | 0 | 19,269 |
5,563,743 | 2011-04-06T08:51:00.000 | 18 | 0 | 0 | 0 | python,math,matrix,scipy,linear-algebra | 5,563,883 | 5 | false | 0 | 0 | I assume you already know your matrix is symmetric.
A good test for positive definiteness (actually the standard one !) is to try to compute its Cholesky factorization. It succeeds iff your matrix is positive definite.
This is the most direct way, since it needs O(n^3) operations (with a small constant), and you would... | 3 | 13 | 1 | I want to check if a matrix is positive definite or positive semidefinite using Python.
How can I do that? Is there a dedicated function in SciPy for that or in other modules? | Check for positive definiteness or positive semidefiniteness | 1 | 0 | 0 | 19,269 |
5,564,624 | 2011-04-06T10:07:00.000 | 4 | 0 | 1 | 0 | python,intellij-idea,pycharm | 5,564,814 | 1 | true | 1 | 0 | Settings | File Types | Ignore files and folders, remove CVS from the ignored list. | 1 | 3 | 0 | Am using Pycharm 1.2 on OSX 10.6 . One of my project directories is named cvs, but it is not showing up in the project explorer. I have tried uninstalling cvs version control plugin but this didn't resolve it. When i try to manually create the directory , i get a message < trying to create a directory with an ignored... | Pycharm 1.2 Ignoring A Directory Named cvs | 1.2 | 0 | 0 | 274 |
5,568,319 | 2011-04-06T14:47:00.000 | 2 | 0 | 0 | 0 | python,excel,charts,export-to-excel | 5,568,485 | 5 | false | 0 | 0 | I suggest you to try gnuplot while drawing graph from data files. | 1 | 6 | 1 | I have been trying to generate data in Excel.
I generated .CSV file.
So up to that point it's easy.
But generating graph is quite hard in Excel...
I am wondering, is python able to generate data AND graph in excel?
If there are examples or code snippets, feel free to post it :)
Or a workaround can be use python to gene... | use python to generate graph in excel | 0.07983 | 1 | 0 | 48,351 |
5,568,330 | 2011-04-06T14:48:00.000 | 5 | 0 | 1 | 1 | python,macos | 5,568,374 | 1 | true | 0 | 0 | You can simply type python3.2 instead of just python to use python 3.2. | 1 | 6 | 0 | Python 2.5 came installed on my Mac. I downloaded Python 3.2 and have it running in my IDE. When I open the terminal in Mac and type in Python, it tells me I'm working with 2.5.
1) What do I enter in the command line to change from 2.5 to 3.2?
2) Once I get to 3.2 (using your answer), how do I get back to 2.5 if I wa... | Changing versions of Python in command line | 1.2 | 0 | 0 | 3,806 |
5,568,555 | 2011-04-06T15:01:00.000 | 11 | 0 | 1 | 0 | python,multithreading,python-multithreading | 5,568,844 | 5 | false | 0 | 0 | If I'm not mistaken, thread allows you to run a function as a separate thread, whereas with threading you have to create a class, but get more functionality.
EDIT: This is not precisely correct. threading module provides different ways of creating a thread:
threading.Thread(target=function_name).start()
Create a child... | 3 | 82 | 0 | What's the difference between the threading and thread modules in Python? | Thread vs. Threading | 1 | 0 | 0 | 36,719 |
5,568,555 | 2011-04-06T15:01:00.000 | -2 | 0 | 1 | 0 | python,multithreading,python-multithreading | 30,689,805 | 5 | false | 0 | 0 | The module "Thread" treats a thread as a function, while the module "threading" is implemented in an object oriented way, i.e. every thread corresponds to an object. | 3 | 82 | 0 | What's the difference between the threading and thread modules in Python? | Thread vs. Threading | -0.07983 | 0 | 0 | 36,719 |
5,568,555 | 2011-04-06T15:01:00.000 | 103 | 0 | 1 | 0 | python,multithreading,python-multithreading | 5,578,141 | 5 | true | 0 | 0 | In Python 3, thread has been renamed to _thread. It is infrastructure code that is used to implement threading, and normal Python code shouldn't be going anywhere near it.
_thread exposes a fairly raw view of the underlying OS level processes. This is almost never what you want, hence the rename in Py3k to indicate tha... | 3 | 82 | 0 | What's the difference between the threading and thread modules in Python? | Thread vs. Threading | 1.2 | 0 | 0 | 36,719 |
5,568,904 | 2011-04-06T15:27:00.000 | 1 | 0 | 1 | 1 | python,state | 48,079,154 | 4 | false | 0 | 0 | If you ok with OOP, consider creating a method for each class that output a serialised version ( using pickle ) to file. Then add a second method to load in the instance the data, and if the pickled file is there you call the load method instead of the processing one.
I use this approach for ML and it really seed up m... | 2 | 11 | 0 | I occasionally have Python programs that take a long time to run, and that I want to be able to save the state of and resume later. Does anyone have a clever way of saving the state either every x seconds, or when the program is exiting? | Saving the state of a program to allow it to be resumed | 0.049958 | 0 | 0 | 20,357 |
5,568,904 | 2011-04-06T15:27:00.000 | 4 | 0 | 1 | 1 | python,state | 5,569,817 | 4 | false | 0 | 0 | If you want to save everything, including the entire namespace and the line of code currently executing to be restarted at any time, there is not a standard library module to do that.
As another poster said, the pickle module can save pretty much everything into a file and then load it again, but you would have to spec... | 2 | 11 | 0 | I occasionally have Python programs that take a long time to run, and that I want to be able to save the state of and resume later. Does anyone have a clever way of saving the state either every x seconds, or when the program is exiting? | Saving the state of a program to allow it to be resumed | 0.197375 | 0 | 0 | 20,357 |
5,568,942 | 2011-04-06T15:30:00.000 | 0 | 0 | 0 | 0 | python,sharepoint,soap,sharepoint-2010 | 5,569,326 | 2 | false | 0 | 0 | There is not an "easy" way to do this. You would have to retrieve the schema from the web service, and modify it before instantiating it somewhere else. It depends a bit on where the clone operation is destined, but you will have to change the schema in some way to some degree, regardless of the destination.
Beyond... | 1 | 1 | 0 | Due to paranoid Sharepoint administrators we have the need clone an existing list over the SOAP API ourselves..Is there an (easy) way to accomplish this? We already have a Python based API for accessing the list items and field descriptions over SOAP - I am not sure if this is enough for create a 1:1 copy ourselves...i... | Cloning a list (definition and items) over SOAP? | 0 | 0 | 1 | 242 |
5,569,652 | 2011-04-06T16:13:00.000 | 1 | 1 | 1 | 0 | python,distribution | 5,569,750 | 5 | false | 0 | 0 | AFAIK it's not possible to download Python with only selected modules, but after an install you can remove everything (read: the libraries) you don't need (never going to use JSON? Gone!, etc). | 1 | 5 | 0 | I very like the "battery included" philosophy of Python but now I have to perform a slim installation with only core features and some other which I'd like to choose one by one.
Is it possible to download Python with only selected modules? | Get Python without (selected) batteries | 0.039979 | 0 | 0 | 287 |
5,571,035 | 2011-04-06T18:13:00.000 | 0 | 0 | 1 | 1 | python,windows,logging,text-files | 5,574,829 | 2 | true | 0 | 0 | As ʇsәɹoɈ commented, the standard FileHandler logger does not lock the file, so it should work. However, if for some reason you cannot keep you lock on the file - then I'd recommend having your other app open the file periodically, record the position it's read to and then seek back to that point later. I know the Linu... | 1 | 1 | 0 | When my Python script is writing a large amount of logs to a text file line by line using the Python built-in logging library, in my Delphi-powered Windows program I want to effectively read all newly added logs (lines).
When the Python scripting is logging
to the file, my Windows program will
keep a readonly file han... | Effectively reading a large, active Python log file | 1.2 | 0 | 0 | 517 |
5,571,684 | 2011-04-06T19:11:00.000 | -1 | 0 | 1 | 0 | python,file,file-format,iso | 5,580,441 | 4 | true | 0 | 0 | Of course, as with any file.
It can be done with open/read/write/seek/tell/close operations on a file. Pack/unpack the data with struct/ctypes. It would require serious knowledge of the contents of ISO, but I presume you already know what to do. If you're lucky you can try using mmap - the interface to file contents st... | 1 | 4 | 0 | Is it possible to take an ISO file and edit a file in it directly, i.e. not by unpacking it, changing the file, and repacking it?
It is possible to do 1. from Python? How would I do it? | python: edit ISO file directly | 1.2 | 0 | 0 | 4,307 |
5,572,037 | 2011-04-06T19:39:00.000 | 0 | 0 | 1 | 0 | python,data-structures | 5,572,119 | 3 | false | 0 | 0 | Say object_123 is a dict, which it pretty much looks like. Your structure seems to be a standard dict with keys like (('foo', 'bar'), ('stupid', True)); in other words, tuple(sorted(object_123.items())) so that they're always listed in a defined order.
The reason for the defined ordering is because dict.items() isn't g... | 1 | 1 | 0 | The data structure should meet the following purpose:
each object is unique with certain key-value pairs
the keys and values are not predetermined and can contain any string value
querying for objects should be fast
Example:
object_123({'stupid':True, 'foo':'bar', ...})
structure.get({'stupid':True, 'foo':'bar', ...... | Python data structure design | 0 | 0 | 0 | 708 |
5,572,489 | 2011-04-06T20:22:00.000 | 1 | 0 | 0 | 1 | python,pdf,printing,pygtk | 5,572,506 | 3 | false | 0 | 1 | Have you considered generating HTML? | 1 | 2 | 0 | I am developing an application which has to be able to print a couple of pages with Python. Now I am searching for a method to create these pages and print them. It should work on Linux and Windows. The pages contain tables, images and text.
I developed the GUI with PyGtk, but I think it's convenient to create an image... | OS independent printing with Python | 0.066568 | 0 | 0 | 2,696 |
5,575,451 | 2011-04-07T03:00:00.000 | 15 | 0 | 1 | 0 | python,matplotlib | 55,520,433 | 3 | false | 0 | 0 | in the context of matplotlib,
axes is not the plural form of axis, it actually denotes the plotting area, including all axis. | 2 | 75 | 1 | I'm confused about what the different between axes and axis is in matplotlib. Could someone please explain in an easy-to-understand way? | Difference between "axes" and "axis" in matplotlib? | 1 | 0 | 0 | 16,337 |
5,575,451 | 2011-04-07T03:00:00.000 | 68 | 0 | 1 | 0 | python,matplotlib | 5,575,468 | 3 | true | 0 | 0 | Axis is the axis of the plot, the thing that gets ticks and tick labels. The axes is the area your plot appears in. | 2 | 75 | 1 | I'm confused about what the different between axes and axis is in matplotlib. Could someone please explain in an easy-to-understand way? | Difference between "axes" and "axis" in matplotlib? | 1.2 | 0 | 0 | 16,337 |
5,579,047 | 2011-04-07T09:42:00.000 | 0 | 1 | 0 | 0 | python,c,bittorrent | 5,582,728 | 2 | false | 0 | 0 | For Transmission, try looking at libtransmission/peer-mgr.c for code specific to each type of message received from a particular peer. This file represents the peer manager and all communication with it.
It uses libtransmission/peer-msgs.c for handling the exact messages. | 1 | 2 | 0 | For the work I am currently doing I need similar functionality as Bittorrent, only difference is I need to do some sort of extra analysis on every block received by client from peers. Though I am fairly new with Python, I found official Bittorrent client source code easy to understand (as compared to Transmission's C s... | Block handling in bittorent | 0 | 0 | 1 | 168 |
5,581,005 | 2011-04-07T12:28:00.000 | 1 | 0 | 0 | 0 | python,django | 5,581,104 | 2 | false | 1 | 0 | You can use Django Debug Toolbar and enable it only for choosen IPs | 1 | 1 | 0 | I'm supplying a Django project to a client, who has requested a 'debugging' page that will show useful information.
[UPDATE for clarity: We'd like this page so we can use it for debugging in future: the clients are not very technical and I won't have direct access to their servers. In the event of future issues, it wo... | Add a debugging page to a Django project? | 0.099668 | 0 | 0 | 94 |
5,581,447 | 2011-04-07T12:58:00.000 | 2 | 0 | 0 | 0 | python,pyglet | 5,590,220 | 4 | false | 0 | 1 | The cocos2d.org framework is built on pyglet and includes scene management. | 1 | 3 | 0 | Can anybody recommend how to switch between scenes in pyglet.
I.e.
menu > game
game > menu
menu > help
ect
The only way that i can think to do it off the top of my head is by using different windows, which i am quite sure would be the complete wrong way to do it. Or by overloading all of the window's event function... | Switching scenes with pyglet | 0.099668 | 0 | 0 | 3,236 |
5,581,466 | 2011-04-07T12:59:00.000 | 1 | 0 | 0 | 0 | python,mysql,django,django-models,django-blob | 5,581,586 | 3 | true | 1 | 0 | Django's ORM has no field for binary large objects. Either use something like a FileField, or search for candidate field classes using a search engine. | 1 | 2 | 0 | I want to create a table like so -
CREATE TABLE trial_xml (
id int(11) DEFAULT NULL,
pid int(11) DEFAULT NULL,
sid varchar(256) CHARACTER SET utf8 NOT NULL,
data blob,
PRIMARY KEY (soid),
KEY suid_index (suid) )
ENGINE=MyISAM DEFAULT CHARSET=latin1
my question is how do I set "data" field as "blob" in django'... | Django models "blob" field | 1.2 | 0 | 0 | 4,606 |
5,582,450 | 2011-04-07T14:08:00.000 | 1 | 1 | 0 | 0 | php,python | 5,582,849 | 3 | false | 0 | 0 | If you've been coding in PHP for years, then maybe PHP is still the right choice for you? As long as your project is related to web (by the way Facebook uses PHP!) you should stick to it.
Python is really easy and fun to learn, but as any other programming language - it requires time to get into it. And for web projec... | 2 | 2 | 0 | I've been coding php for years, and now i have to finally make my own project, and i want it very optimized and shiny. So, i've been searching around the net about which programming language should i use for my needs (fast, secure, easy-understandable, customizable) and all points to -> Python. So I decided to go on, b... | From PHP to Python accommodation | 0.066568 | 0 | 0 | 155 |
5,582,450 | 2011-04-07T14:08:00.000 | 2 | 1 | 0 | 0 | php,python | 5,582,510 | 3 | false | 0 | 0 | This line of work requires you to adjust to different syntaxes (even in PHP alone you need to know sql and js and Css and html too...).
So the answer is no, there is nothing like what you ask, and you better get used to that :-)
b.t.w is Python really faster than PHP? | 2 | 2 | 0 | I've been coding php for years, and now i have to finally make my own project, and i want it very optimized and shiny. So, i've been searching around the net about which programming language should i use for my needs (fast, secure, easy-understandable, customizable) and all points to -> Python. So I decided to go on, b... | From PHP to Python accommodation | 0.132549 | 0 | 0 | 155 |
5,584,398 | 2011-04-07T16:29:00.000 | 1 | 0 | 0 | 0 | python,pygtk | 5,585,600 | 2 | true | 0 | 1 | I've struggled with an issue similar to this, and came to the conclusion that it wasn't possible in an officially documented manner... gtk.Table doesn't seem to have been designed to deal with the idea that things might overlap. Widgets seemed to be rendered in an order related to (but not exactly) the order they were ... | 1 | 1 | 0 | I have a gtk.Table to which I've attached a number of gtk.Buttons, some of which overlap others. I can't figure out how to bring a specific button to the front, however. How do I do it? | How do I bring a PyGTK Button to the front? | 1.2 | 0 | 0 | 200 |
5,584,586 | 2011-04-07T16:44:00.000 | 4 | 0 | 1 | 0 | python,modulo,integer-division | 48,724,679 | 13 | false | 0 | 0 | We can solve this by using modulus operator (%)
26 % 7 = 5;
but
26 / 7 = 3 because it will give quotient but % operator will give remainder. | 3 | 203 | 0 | How could I go about finding the division remainder of a number in Python?
For example:
If the number is 26 and divided number is 7, then the division remainder is 5.
(since 7+7+7=21 and 26-21=5.) | Find the division remainder of a number | 0.061461 | 0 | 0 | 691,048 |
5,584,586 | 2011-04-07T16:44:00.000 | -1 | 0 | 1 | 0 | python,modulo,integer-division | 62,574,685 | 13 | false | 0 | 0 | you can define a function and call it remainder with 2 values like rem(number1,number2) that returns number1%number2
then create a while and set it to true then print out two inputs for your function holding number 1 and 2 then print(rem(number1,number2) | 3 | 203 | 0 | How could I go about finding the division remainder of a number in Python?
For example:
If the number is 26 and divided number is 7, then the division remainder is 5.
(since 7+7+7=21 and 26-21=5.) | Find the division remainder of a number | -0.015383 | 0 | 0 | 691,048 |
5,584,586 | 2011-04-07T16:44:00.000 | 64 | 0 | 1 | 0 | python,modulo,integer-division | 36,072,654 | 13 | false | 0 | 0 | 26 % 7 (you will get remainder)
26 / 7 (you will get divisor, can be float value)
26 // 7 (you will get divisor, only integer value) | 3 | 203 | 0 | How could I go about finding the division remainder of a number in Python?
For example:
If the number is 26 and divided number is 7, then the division remainder is 5.
(since 7+7+7=21 and 26-21=5.) | Find the division remainder of a number | 1 | 0 | 0 | 691,048 |
5,584,943 | 2011-04-07T17:14:00.000 | 18 | 0 | 1 | 0 | javascript,python,django,json,node.js | 5,584,965 | 2 | true | 0 | 0 | JSON does not have objects per se, and cannot store JavaScript functions. Its syntax may appear similar to JavaScript literals, but trying to use it as such all the time will cause nothing but pain.
And there should be no need to use eval(); both JavaScript and Python have JSON parsers and serializers readily available... | 1 | 12 | 0 | On the surface it appears that python uses json natively. The only exception I can think of is the fact that json can store js functions.
Here's my issue:
I need to pass json to a python file through the terminal.
Why should or shouldn't I just use eval()? | what's the difference between python objects and json objects? | 1.2 | 0 | 0 | 12,399 |
5,585,473 | 2011-04-07T18:01:00.000 | 4 | 0 | 1 | 0 | python,pip,easy-install | 5,585,530 | 2 | true | 0 | 0 | You have to re-install easy_install using Python 2.7 and all other modules as well. Don't expect that existing packages installed with a different interpreter are supposed to work out of the box with a new interpreter. Reinstalling into the new Python 2.7 interpreter is the way to go. First step: reinstall easy_install... | 1 | 4 | 0 | I am new to python, I have changed my path to point to the new python 2.7, but pip and easy_install, and mercurial are still looking at the default installed version 2.6. How do I fix this? | Upgraded Python on Snowleopard Using Homebrew now pip and easy_install don't work | 1.2 | 0 | 0 | 2,627 |
5,585,872 | 2011-04-07T18:36:00.000 | 1 | 0 | 0 | 0 | python,image-processing,video-encoding | 5,586,198 | 4 | false | 1 | 0 | You could use Popen just to run the ffmpeg in a subprocess. | 1 | 13 | 0 | I am writing a python/django application and it needs to do image manipulation and then combine the images into a video (each image is a frame). Image manipulation is easy. I'm using PIL, but for the convert to video part, I'm stuck. I've found pyffmpeg but that just seems to do decoding of videos to frames, not the ot... | python image frames to video | 0.049958 | 0 | 0 | 30,494 |
5,587,280 | 2011-04-07T20:34:00.000 | 1 | 0 | 1 | 0 | python,substitution,encryption | 5,587,409 | 3 | false | 0 | 0 | I would first get a list of English words for reference. Next construct a list of possible 2 and 3 letter words. Then just start testing those small words in your cipher. Once you guess at a small word, check the larger words against your word list. If some of the words no longer have possible completions in the li... | 1 | 1 | 0 | I know similar questions have been asked, but this is kind of a trivial case.
Given a text file endcoded with a substitution cipher, I need to decode it using python. I am not given any examples of correctly deciphered words. The relationship is 1-to-1 and case doesn't make a difference. Also, punctuation isn't changed... | Solving a substitution cipher with python | 0.066568 | 0 | 0 | 6,917 |
5,588,081 | 2011-04-07T21:50:00.000 | 0 | 0 | 0 | 0 | python,django | 5,588,180 | 1 | true | 1 | 0 | If you are calling admin.autodiscover() in your urls.py Django's admin.site will be looking for admin.py files in all packages of your INSTALLED_APPS and import all found ModelAdmin classes and add them to the admin.site.
You have three inputs for SearchKeyword appearing in the admin because the there are three InlineA... | 1 | 0 | 0 | I am reading Chapter 3 of "Practical Django Projects", on how to make a CMS. I have improved the search function and everything works fine. However I am wondering why everythings works...
On page 35, I have added an admin.py file in the cms/search/ directory. How does the compiler know that he needs to take this file i... | "Practical Django Projects" - Search function | 1.2 | 0 | 0 | 179 |
5,590,148 | 2011-04-08T03:38:00.000 | 4 | 0 | 0 | 0 | python,linux,mongodb,database,nosql | 5,590,275 | 4 | true | 0 | 0 | MongoDB is likely a good choice related to performance, flexibility and usability (easy approachable). However large databases require careful planning - especially when it comes to aspects of backup and high-availability. Without further insight about project requirements there is little to say if one machine is enoug... | 1 | 1 | 1 | I am looking for a scheme-less database to store roughly 10[TB] of data on disk, ideally, using a python client. The suggested solution should be free for commercial use, and have good performance for reads and writes.
The main goal here is to store time-series data, including more than billion records, accessed by tim... | Scheme-less database solution to work on one machine only? | 1.2 | 0 | 0 | 401 |
5,590,396 | 2011-04-08T04:22:00.000 | 1 | 0 | 0 | 1 | python,python-3.x | 5,592,323 | 1 | true | 0 | 0 | Reloading a module is rarely a good idea in a production environment; it's a mechanism intended for debugging. When you reload a module, the module's contents (classes, function, data) get replaced, but existing references to these items from other modules are not affected. This is particularly important for classes: e... | 1 | 3 | 0 | Hello i want to know the best way to re import or re execute a module, because i have a web server with just one Apache session for all my domains and applications, and i if i need to make some changes on one application restart the server will affect the others, so looking for the best way to recall a module. If i cho... | Help choosing between reload or subprocess | 1.2 | 0 | 0 | 146 |
5,591,230 | 2011-04-08T06:20:00.000 | -3 | 1 | 0 | 0 | php,python | 5,591,381 | 2 | false | 0 | 0 | After some clarifications at last it came clear that your question was
"how to connect PHP to HTTP server"
So, actually you were interested in three letters: CGI.
However I still doubt you will get any good from it. | 1 | 1 | 0 | How can I make a PHP 5.3 webserver using Python?
I know how to make a simple HTTP server, but how can I include PHP?
Thanks. | PHP Webserver in Python | -0.291313 | 0 | 1 | 1,908 |
5,594,758 | 2011-04-08T12:01:00.000 | 2 | 0 | 1 | 0 | python | 5,594,813 | 2 | true | 0 | 0 | Remember to operate on floating numbers, and not convert it after the operation. E.g. 2/5000000.
Also, use the Decimal library, if you are looking for more accurate decimals. | 1 | 2 | 0 | I am looking for a way to perform a digit divided by larger value(2/5000000) and then store that value in table, but the problem is when i save that value, only 0 is stored , instead of correct value.I tried with float, double precision, but still only 0 is stored, is there any other way .
Thank you | How to store exponential values using python | 1.2 | 0 | 0 | 649 |
5,595,051 | 2011-04-08T12:30:00.000 | 1 | 0 | 1 | 0 | python | 5,595,099 | 5 | false | 0 | 0 | That could be IndentationError resulting from incorrect mix of tabs and spaces in code and/or incorrect code formatting. | 4 | 0 | 0 | What do you think is the most frequent errors or pitfalls a beginner may encounter when he use python? | what is the most frequent error in python for a beginner? | 0.039979 | 0 | 0 | 132 |
5,595,051 | 2011-04-08T12:30:00.000 | 2 | 0 | 1 | 0 | python | 5,595,186 | 5 | false | 0 | 0 | Forgetting the self keyword in classes.
Either in method declaration and/or when referencing class members (specially for someone coming from .NET/Java/.. world where "equivalent" this keyword can be omitted). | 4 | 0 | 0 | What do you think is the most frequent errors or pitfalls a beginner may encounter when he use python? | what is the most frequent error in python for a beginner? | 0.07983 | 0 | 0 | 132 |
5,595,051 | 2011-04-08T12:30:00.000 | 0 | 0 | 1 | 0 | python | 5,595,106 | 5 | false | 0 | 0 | After answering twice the same question. It looks like the more surprising thing it's when the script is named like the module they want to import. | 4 | 0 | 0 | What do you think is the most frequent errors or pitfalls a beginner may encounter when he use python? | what is the most frequent error in python for a beginner? | 0 | 0 | 0 | 132 |
5,595,051 | 2011-04-08T12:30:00.000 | 1 | 0 | 1 | 0 | python | 5,595,093 | 5 | false | 0 | 0 | My guess would be:
SyntaxError: invalid syntax | 4 | 0 | 0 | What do you think is the most frequent errors or pitfalls a beginner may encounter when he use python? | what is the most frequent error in python for a beginner? | 0.039979 | 0 | 0 | 132 |
5,595,276 | 2011-04-08T12:50:00.000 | 3 | 0 | 1 | 1 | python,eclipse,pydev | 7,762,436 | 13 | false | 0 | 0 | I too had the error: stdlib sources not found.
My fix was to install XCode 4.2 and then retry Eclipse's PyDev "Auto Config" method.
No error. PyDev running OK! | 7 | 25 | 0 | I have been trying to use Eclipse 3.6 as a Python editor.
I install the latest version of PyDev, and then try to set the Interpreter - Python field of the preferences, on my mac.
My python version is 2.6 and the path is "/usr/bin/python". When I enter this, and I select the items to add to the system PYTHONPATH I get ... | PyDev Eclipse Python interpreters Error: stdlib not found | 0.046121 | 0 | 0 | 26,549 |
5,595,276 | 2011-04-08T12:50:00.000 | 1 | 0 | 1 | 1 | python,eclipse,pydev | 18,840,306 | 13 | false | 0 | 0 | In Preferences > PyDev > Interpreter - Python
Choose New...
Name it "Python2.7"
set the path to /usr/bin/python
it then auto-configs some paths, select them, and it proceeds. | 7 | 25 | 0 | I have been trying to use Eclipse 3.6 as a Python editor.
I install the latest version of PyDev, and then try to set the Interpreter - Python field of the preferences, on my mac.
My python version is 2.6 and the path is "/usr/bin/python". When I enter this, and I select the items to add to the system PYTHONPATH I get ... | PyDev Eclipse Python interpreters Error: stdlib not found | 0.015383 | 0 | 0 | 26,549 |
5,595,276 | 2011-04-08T12:50:00.000 | 2 | 0 | 1 | 1 | python,eclipse,pydev | 12,368,091 | 13 | false | 0 | 0 | @labjunky , if the .py files from the lib folder in the source tar ball are dropped into the User's site-packages folder ~/Library/Python/2.7/lib/python/site-packages[ provided it is listed in the locations by PyDev and selected] , it works too. this can be useful if the user does not have permission to modify the loca... | 7 | 25 | 0 | I have been trying to use Eclipse 3.6 as a Python editor.
I install the latest version of PyDev, and then try to set the Interpreter - Python field of the preferences, on my mac.
My python version is 2.6 and the path is "/usr/bin/python". When I enter this, and I select the items to add to the system PYTHONPATH I get ... | PyDev Eclipse Python interpreters Error: stdlib not found | 0.03076 | 0 | 0 | 26,549 |
5,595,276 | 2011-04-08T12:50:00.000 | 2 | 0 | 1 | 1 | python,eclipse,pydev | 5,697,623 | 13 | false | 0 | 0 | I found the solution of not touching macs deliverd python version, but downloading ad installing a new one (currently 3.something)
when setting up the interpreter, point to /usr/local/bin/pyhton3
(to find out the exact path open terminal and type: sudo -s !hittenter> your password !hittenter> cd /usr/local/bin !hi... | 7 | 25 | 0 | I have been trying to use Eclipse 3.6 as a Python editor.
I install the latest version of PyDev, and then try to set the Interpreter - Python field of the preferences, on my mac.
My python version is 2.6 and the path is "/usr/bin/python". When I enter this, and I select the items to add to the system PYTHONPATH I get ... | PyDev Eclipse Python interpreters Error: stdlib not found | 0.03076 | 0 | 0 | 26,549 |
5,595,276 | 2011-04-08T12:50:00.000 | 0 | 0 | 1 | 1 | python,eclipse,pydev | 70,013,286 | 13 | false | 0 | 0 | I got this error because I downloaded the embedded zip file version of Python and extracted it to a folder. I then downloaded the actual installer and ran it. That gave me the stuff that I was missing. | 7 | 25 | 0 | I have been trying to use Eclipse 3.6 as a Python editor.
I install the latest version of PyDev, and then try to set the Interpreter - Python field of the preferences, on my mac.
My python version is 2.6 and the path is "/usr/bin/python". When I enter this, and I select the items to add to the system PYTHONPATH I get ... | PyDev Eclipse Python interpreters Error: stdlib not found | 0 | 0 | 0 | 26,549 |
5,595,276 | 2011-04-08T12:50:00.000 | 7 | 0 | 1 | 1 | python,eclipse,pydev | 13,389,249 | 13 | false | 0 | 0 | When I upgraded to Mountain Lion (10.8.2) I had this problem. The solution was to install XCode 4.5.2, then in XCode > Preferences > Components, there is an option to install the Command Line Tools. I installed them and then I was able install Interpreter. | 7 | 25 | 0 | I have been trying to use Eclipse 3.6 as a Python editor.
I install the latest version of PyDev, and then try to set the Interpreter - Python field of the preferences, on my mac.
My python version is 2.6 and the path is "/usr/bin/python". When I enter this, and I select the items to add to the system PYTHONPATH I get ... | PyDev Eclipse Python interpreters Error: stdlib not found | 1 | 0 | 0 | 26,549 |
5,595,276 | 2011-04-08T12:50:00.000 | 28 | 0 | 1 | 1 | python,eclipse,pydev | 5,940,607 | 13 | false | 0 | 0 | Had the same problem. Eclipse wouldn't find all the required path using the default installed python (2.6). I downloaded python 2.7, went through the install. My new "which python" path became:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python.
When I tried to set up the interpreter this time, specified t... | 7 | 25 | 0 | I have been trying to use Eclipse 3.6 as a Python editor.
I install the latest version of PyDev, and then try to set the Interpreter - Python field of the preferences, on my mac.
My python version is 2.6 and the path is "/usr/bin/python". When I enter this, and I select the items to add to the system PYTHONPATH I get ... | PyDev Eclipse Python interpreters Error: stdlib not found | 1 | 0 | 0 | 26,549 |
5,597,836 | 2011-04-08T16:08:00.000 | 1 | 0 | 1 | 0 | python | 5,993,256 | 5 | false | 0 | 0 | Another trick (besides the ones already suggested) is opening an interactive shell and importing your (perhaps modified) python script. Upon importing, most of the variables, functions, classes and so on (depending on how the whole thing is prepared) are available, and you could even create objects interactively from c... | 1 | 73 | 0 | Is it possible to start an interactive Python shell inside a Python program?
I want to use such an interactive Python shell (which is running inside my program's execution) to inspect some program-internal variables. | Embed (create) an interactive Python shell inside a Python program | 0.039979 | 0 | 0 | 31,367 |
5,599,283 | 2011-04-08T18:26:00.000 | 0 | 0 | 1 | 0 | python | 5,599,345 | 4 | false | 0 | 0 | x = 0
def assignNewValueToX(v):
global x
x = v
eval('assignNewValueToX(1)')
print(x)
It works... cause python will actually run assignNewValueToX to be able to evaluate the expression. It can be developed further, but I am sure there is a better option for almost any needs one may have. | 3 | 95 | 0 | Okay. So my question is simple: How can I assign the value of a variable using eval in Python? I tried eval('x = 1') but that won't work. It returns a SyntaxError. Why won't this work? | How can I assign the value of a variable using eval in python? | 0 | 0 | 0 | 66,640 |
5,599,283 | 2011-04-08T18:26:00.000 | 0 | 0 | 1 | 0 | python | 63,408,712 | 4 | false | 0 | 0 | You can actually put exec() command inside eval()
So your statement would look like eval("exec('x = 1')")
p.s. this is dangerous | 3 | 95 | 0 | Okay. So my question is simple: How can I assign the value of a variable using eval in Python? I tried eval('x = 1') but that won't work. It returns a SyntaxError. Why won't this work? | How can I assign the value of a variable using eval in python? | 0 | 0 | 0 | 66,640 |
5,599,283 | 2011-04-08T18:26:00.000 | 16 | 0 | 1 | 0 | python | 5,599,309 | 4 | false | 0 | 0 | You can't, since variable assignment is a statement, not an expression, and eval can only eval expressions. Use exec instead.
Better yet, don't use either and tell us what you're really trying to do so that we can come up with a safe and sane solution. | 3 | 95 | 0 | Okay. So my question is simple: How can I assign the value of a variable using eval in Python? I tried eval('x = 1') but that won't work. It returns a SyntaxError. Why won't this work? | How can I assign the value of a variable using eval in python? | 1 | 0 | 0 | 66,640 |
5,599,414 | 2011-04-08T18:39:00.000 | 0 | 1 | 0 | 1 | python,distutils | 5,599,557 | 1 | true | 0 | 0 | Looking into the source for distutils and seeing how it enforces rebuilds it looks like it checks timestamps of files to determine whether a file is out of date or not.
Can you make sure the timestamp is changing when winscp is uploading the file? Otherwise it looks like the build command has a "force" option that forc... | 1 | 0 | 0 | I'm trying to use distutils with a Python module that contains extensions written in C. The program code is housed on a Linux server, but I sometimes upload changes from a Windows machine using the file transfer program WinSCP (editing is done in Notepad++). I've noticed that distutils often does not notice these chang... | distutils does not recompile C extension modules | 1.2 | 0 | 0 | 938 |
5,600,048 | 2011-04-08T19:43:00.000 | 0 | 0 | 0 | 0 | javascript,python,asynchronous,selenium,selenium-webdriver | 16,048,919 | 4 | false | 0 | 0 | Testing animation with selenium is opening a can of worms. The tests can be quite brittle and cause many false positives.
The problem is to do that the calls are asynchronous, and difficult to track the behaviour and change in state of the page.
In my experience the asynchronous call can be so quick that the spinner is... | 3 | 8 | 0 | I know I can get Selenium 2's webdriver to run JavaScript and get return values but so much asynchronous stuff is happening I would like JavaScript to talk to Selenium instead of the other way around. I have done some searching and haven't found anything like this. Do people just generally use implicitly_wait? That see... | Can JavaScript talk to Selenium 2? | 0 | 0 | 1 | 3,988 |
5,600,048 | 2011-04-08T19:43:00.000 | 2 | 0 | 0 | 0 | javascript,python,asynchronous,selenium,selenium-webdriver | 5,600,229 | 4 | false | 0 | 0 | Not to be overly blunt, but if you want your App to talk to your Test Runner, then you're doing it wrong.
If you need to wait for an XHR to finish, you could try displaying a spinner and then test that the spinner has disappeared to indicate a successful request.
In regards to the animation, when the animation has comp... | 3 | 8 | 0 | I know I can get Selenium 2's webdriver to run JavaScript and get return values but so much asynchronous stuff is happening I would like JavaScript to talk to Selenium instead of the other way around. I have done some searching and haven't found anything like this. Do people just generally use implicitly_wait? That see... | Can JavaScript talk to Selenium 2? | 0.099668 | 0 | 1 | 3,988 |
5,600,048 | 2011-04-08T19:43:00.000 | 3 | 0 | 0 | 0 | javascript,python,asynchronous,selenium,selenium-webdriver | 5,627,924 | 4 | false | 0 | 0 | Theoretically it is possible, but I would advise against it.
The solution would probably have some jQuery running on the site that sets a variable to true when the JavaScript processing has finished.
Set selenium up to loop through a getEval until this variable becomes true and then do something in Selenium.
It would m... | 3 | 8 | 0 | I know I can get Selenium 2's webdriver to run JavaScript and get return values but so much asynchronous stuff is happening I would like JavaScript to talk to Selenium instead of the other way around. I have done some searching and haven't found anything like this. Do people just generally use implicitly_wait? That see... | Can JavaScript talk to Selenium 2? | 0.148885 | 0 | 1 | 3,988 |
5,601,566 | 2011-04-08T22:51:00.000 | 0 | 1 | 1 | 0 | python,module,import,dependencies,pydev | 5,637,508 | 4 | false | 0 | 0 | I believe you have to add the path of PyCommon into PYTHONPATH or else it won't be able to find the actual modules to import. | 3 | 9 | 0 | I'm probably doing something really dumb here, but it's driving me crazy.
I have two PyDev projects in Eclipse. One project, 'Analysis' depends on the other, 'PyCommon'. I'm 100% sure of this as when I look at the project references for Analysis, PyCommon is checked, and automatic import/code completion works when I re... | Can't import module from dependent project in PyDev | 0 | 0 | 0 | 5,179 |
5,601,566 | 2011-04-08T22:51:00.000 | 2 | 1 | 1 | 0 | python,module,import,dependencies,pydev | 16,126,724 | 4 | false | 0 | 0 | I think pydev is having trouble with similar package names near the root of the package name "fhb". I'm having the same problem. Removing the packages in one of the projects let me reference the other one without a problem.
I couldn't solve the problem, but I think it has to do with the root folder of the package bein... | 3 | 9 | 0 | I'm probably doing something really dumb here, but it's driving me crazy.
I have two PyDev projects in Eclipse. One project, 'Analysis' depends on the other, 'PyCommon'. I'm 100% sure of this as when I look at the project references for Analysis, PyCommon is checked, and automatic import/code completion works when I re... | Can't import module from dependent project in PyDev | 0.099668 | 0 | 0 | 5,179 |
5,601,566 | 2011-04-08T22:51:00.000 | 0 | 1 | 1 | 0 | python,module,import,dependencies,pydev | 24,829,182 | 4 | false | 0 | 0 | Your problem may come from __init__.py being missing from some of your module folders.
For your example, for using OrderStatus from order_status.py in fhb.pycommon.types.order_status, you need to have a (possibly empty) __init__.py file in fhb, fhb/pycommon, and fhb/pycommon/types.
Also note that for pylint to work co... | 3 | 9 | 0 | I'm probably doing something really dumb here, but it's driving me crazy.
I have two PyDev projects in Eclipse. One project, 'Analysis' depends on the other, 'PyCommon'. I'm 100% sure of this as when I look at the project references for Analysis, PyCommon is checked, and automatic import/code completion works when I re... | Can't import module from dependent project in PyDev | 0 | 0 | 0 | 5,179 |
5,602,439 | 2011-04-09T02:06:00.000 | 2 | 0 | 1 | 0 | python,security,operating-system,naming,language-history | 5,602,552 | 2 | true | 0 | 0 | Built-in functions are things that you need often. You do not have to import any module to access them, and thus don't use any module prefix either. open() is one such function, since opening files is a very common operation. It opens a file and returns a file object, which is easy to use.
The os module is for operatin... | 1 | 3 | 0 | I have noticed that considerably amount of questions in SO, relating to Python, are about people messing up Sys -class, OS class and no class. For example, an easy confusing is the case: os.open("something"), open("something") and sys.open("something"). I haven't understood yet the reasons behind the naming of classes,... | Reasons behind naming in easy-to-confuse Python's classes such as OS and SYS? | 1.2 | 0 | 0 | 237 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.