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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6,456,627 | 2011-06-23T15:28:00.000 | 1 | 0 | 0 | 0 | python,django,performance,django-templates | 6,456,673 | 3 | false | 1 | 0 | I'd say it's about the same; take the most clean way, and if you need speed, cache it. | 3 | 4 | 0 | Which is more efficient in Django: to render an object using the template language? or to push the code to render the object via a templatetag function using the python language? | django templates performance | 0.066568 | 0 | 0 | 673 |
6,457,253 | 2011-06-23T16:11:00.000 | 3 | 0 | 1 | 0 | python,file-io,for-loop | 6,457,345 | 3 | false | 0 | 0 | Yes, you can modify the line in place, but if the length changes, you will have to rewrite the remainder of the file.
You'll also need to know where the line is, in the file. This usually means the program needs to at least read through the file up to the line that needs to be changed.
There are exceptions - if the lin... | 2 | 6 | 0 | Is there a way, in Python, to modify a single line in a file without a for loop looping through all the lines?
The exact positions within the file that need to be modified are unknown. | Modifying a single line in a file | 0.197375 | 0 | 0 | 8,842 |
6,457,253 | 2011-06-23T16:11:00.000 | 5 | 0 | 1 | 0 | python,file-io,for-loop | 6,457,357 | 3 | false | 0 | 0 | Unless we're talking about a fairly contrived situation in which you already know a lot about the file, the answer is no. You have to iterate over the file to determine where the newline characters are; there's nothing special about a "line" when it comes to file storage -- it all looks the same. | 2 | 6 | 0 | Is there a way, in Python, to modify a single line in a file without a for loop looping through all the lines?
The exact positions within the file that need to be modified are unknown. | Modifying a single line in a file | 0.321513 | 0 | 0 | 8,842 |
6,462,462 | 2011-06-24T01:40:00.000 | 3 | 0 | 1 | 0 | python,registry,ms-office | 6,831,335 | 2 | true | 0 | 0 | You have to read another section out of DigitalProductID
In CSharp I used
for (int ilByte = 52; ilByte <= 66; ilByte++)
to read the necessary section to calculate the product key for O2K - O2K7.
With Office 2010 you need to use
for (int ilByte = 808; ilByte <= 822; ilByte++)
to read the bytes which make out the produ... | 2 | 0 | 0 | I have a small python program I wrote for a friend, one of the tasks is to audit the Office Version & Product Key on the machine it's run on.
I was able to locate the 32bit/64bit keys in the registry easily but it seems my algorithm breaks down on the new Office 2010 system.
My first problem is there's now 30+ entries ... | Office 2010 Product Key & Registration Lookup | 1.2 | 0 | 0 | 4,366 |
6,462,462 | 2011-06-24T01:40:00.000 | 0 | 0 | 1 | 0 | python,registry,ms-office | 6,956,668 | 2 | false | 0 | 0 | The position may be correct for Office 2010 , but the algorithm to decode the key must be different than 2007.
Today we entered 3 new CD-Keys in 3 new Laptops and the old 2007 working algorithm returned a wrong CD-Key. | 2 | 0 | 0 | I have a small python program I wrote for a friend, one of the tasks is to audit the Office Version & Product Key on the machine it's run on.
I was able to locate the 32bit/64bit keys in the registry easily but it seems my algorithm breaks down on the new Office 2010 system.
My first problem is there's now 30+ entries ... | Office 2010 Product Key & Registration Lookup | 0 | 0 | 0 | 4,366 |
6,462,967 | 2011-06-24T03:20:00.000 | 4 | 0 | 1 | 0 | python,model-view-controller,oop | 6,463,049 | 3 | true | 1 | 1 | MVC can be counter-intuitive sometimes, especially when you're first learning OO and discover that having a "draw" method makes things so organized!
Here's an overview of one of many ways you might implement MVC for your game:
Model:
"Box": box_type, pos_x, pos_y
"BoxManager": list(Box)
"GameState": box_manager, playe... | 3 | 2 | 0 | I wrote a simple sokoban like 2D game in python that I want to clean up. It's done in a sort-of OO way where each object in the game has a Draw function I can call to redraw the screen. It works out nicely since I can loop through each position on the screen and call the object's draw function.
I am learning about de... | MVC Game Design with objects | 1.2 | 0 | 0 | 1,166 |
6,462,967 | 2011-06-24T03:20:00.000 | 0 | 0 | 1 | 0 | python,model-view-controller,oop | 11,327,596 | 3 | false | 1 | 1 | One aspect that I'll just quickly make explicit is that when your model changes, it can't call the view to say "render this change" - because the model shouldn't know about the view(s).
Instead the model raises an event to say it has changed, and the view re-renders as necessary on receiving these. The view(s) know abo... | 3 | 2 | 0 | I wrote a simple sokoban like 2D game in python that I want to clean up. It's done in a sort-of OO way where each object in the game has a Draw function I can call to redraw the screen. It works out nicely since I can loop through each position on the screen and call the object's draw function.
I am learning about de... | MVC Game Design with objects | 0 | 0 | 0 | 1,166 |
6,462,967 | 2011-06-24T03:20:00.000 | 0 | 0 | 1 | 0 | python,model-view-controller,oop | 6,463,038 | 3 | false | 1 | 1 | Refactoring your code to conform to MVC would mean creating a "view" (like that represented your screen, and that view would have (for example) a draw method that took the "model" (a python object that contained all of the block states) and rendered that model to the screen.
Now perhaps all that draw method would do t... | 3 | 2 | 0 | I wrote a simple sokoban like 2D game in python that I want to clean up. It's done in a sort-of OO way where each object in the game has a Draw function I can call to redraw the screen. It works out nicely since I can loop through each position on the screen and call the object's draw function.
I am learning about de... | MVC Game Design with objects | 0 | 0 | 0 | 1,166 |
6,463,179 | 2011-06-24T04:00:00.000 | 2 | 0 | 0 | 0 | python,url,login,download,urllib2 | 6,463,190 | 1 | true | 0 | 0 | It is the task of the remote server/Service to provide the content-disposition header.
There is nothing you can do unless the remote server/service is under your own control.. | 1 | 0 | 0 | So I finally managed to get my script to login to a website and download a file... however, in some instances I will have a url like "http://www.test.com/index.php?act=Attach&type=post&id=3345". Firefox finds the filename ok... so I should be able to.
I am unable to find the "Content-Disposition" header via something ... | Using python (urllib) to download a file, how to get the real filename? | 1.2 | 0 | 1 | 580 |
6,465,053 | 2011-06-24T08:11:00.000 | 5 | 0 | 1 | 1 | python | 6,465,119 | 1 | true | 0 | 0 | Assuming you're on Linux, the OS looks for shared objects in the directories listed in /etc/ld.so.conf, /etc/ld.so.conf.d/* and $LD_LIBRARY_PATH. | 1 | 4 | 0 | I'm trying to bundle a Python library (fontforge) together so that my script runs on a machine without that library installed (but with Python installed). So far I tried copying ".so" files corresponding to "Missing library" errors to current directory, and while it worked for some, it didn't work for others, I'm getti... | Where does Python look for library binaries? | 1.2 | 0 | 0 | 917 |
6,466,790 | 2011-06-24T10:54:00.000 | 1 | 0 | 0 | 1 | python,api,error-handling | 6,467,479 | 2 | false | 1 | 0 | The easiest solution will be probably to try to validate the user input before you use it. A simple regular expression which checks the last parts of the domain the user has entered might be enough.
If you want to support arbitrary domains without a google\.[a-z]+ or appspot.com suffix you will need another way to figu... | 1 | 0 | 0 | I m workin on an api where the user enters a domain and i need to redirect to the login page of that domain.
So this works for only google domains and i need to handle the error created when user enters non google domain . I m workin on google app engine.
I m new to dis error handling.So kindly explain how it works alo... | Handle server error python | 0.099668 | 0 | 0 | 207 |
6,467,651 | 2011-06-24T12:15:00.000 | 0 | 0 | 1 | 0 | c++,python,windows,multithreading,audio | 6,468,189 | 4 | false | 0 | 0 | py2.6 comes with processed-based threading as well so you don't have todo just green-threads | 1 | 1 | 0 | I'd like to write a program that capture audio stream from the microphone and in the same time mix this stream with a playing audio file.
I'm lookig for library, api, etc..etc... but my concern is about the implementation, should I use threading programming? I don't know how to use a thread yet.
The operating system is... | Should I use threading programming for mixing 2 audio stream? | 0 | 0 | 0 | 1,037 |
6,469,495 | 2011-06-24T14:48:00.000 | 10 | 0 | 1 | 0 | python | 6,469,531 | 4 | true | 0 | 0 | What is the problem here? Since the dates are obviously in ISO notation you can perform a standard comparison of the dates as strings here... | 1 | 17 | 0 | I have a date in the format "2011-06-24", and a list of other date strings in the same format. For each string in the list, I want to determine if that date is in the past, compared to "2011-06-24". Is there a way to do this easily in python? | How to determine if one date is before another | 1.2 | 0 | 0 | 43,825 |
6,471,412 | 2011-06-24T17:20:00.000 | 5 | 0 | 0 | 0 | python,mercurial | 6,471,560 | 3 | false | 1 | 0 | The best approach is probably to use precommit hook to replace a designated file with the output of hg log -r tip, possibly with a --template arg to format it in a particular way.
Unfortunately, there's a bit of a chicken and egg problem. The revision is a checksum of the commited data, but the checksum is not availab... | 1 | 3 | 0 | I have application I want to print out (in "about" box) its revision/version from mercurial. Suppose it is revision deadbeef so it will know that. In old times in CVS could use something like $Revision$ to substitute automatically.
What is best practice with Mercurial for this? | Application access its own version in mercurial repository | 0.321513 | 0 | 0 | 91 |
6,471,549 | 2011-06-24T17:34:00.000 | 6 | 0 | 0 | 0 | python,mysql,sqlalchemy,flask,database-connection | 58,821,330 | 7 | false | 1 | 0 | The pessimistic approach as described by @wim
pool_pre_ping=True
can now be done for Flask-SQLAlchemy using a config var -->
SQLALCHEMY_POOL_PRE_PING = True | 2 | 64 | 0 | How can Flask / SQLAlchemy be configured to create a new database connection if one is not present?
I have an infrequently visited Python / Flask server which uses SQLAlchemy. It gets visited every couple of days, and on the first visit it often throws a "MySQL server has gone away" error. Subsequent page views are fin... | Avoiding "MySQL server has gone away" on infrequently used Python / Flask server with SQLAlchemy | 1 | 1 | 0 | 33,654 |
6,471,549 | 2011-06-24T17:34:00.000 | 2 | 0 | 0 | 0 | python,mysql,sqlalchemy,flask,database-connection | 51,015,137 | 7 | false | 1 | 0 | When I encountered this error I was storing a LONGBLOB / LargeBinary image ~1MB in size. I had to adjust the max_allowed_packet config setting in MySQL.
I used mysqld --max-allowed-packet=16M | 2 | 64 | 0 | How can Flask / SQLAlchemy be configured to create a new database connection if one is not present?
I have an infrequently visited Python / Flask server which uses SQLAlchemy. It gets visited every couple of days, and on the first visit it often throws a "MySQL server has gone away" error. Subsequent page views are fin... | Avoiding "MySQL server has gone away" on infrequently used Python / Flask server with SQLAlchemy | 0.057081 | 1 | 0 | 33,654 |
6,471,569 | 2011-06-24T17:35:00.000 | 1 | 0 | 0 | 0 | python,pyserial | 6,474,062 | 1 | true | 0 | 0 | You will find it easier to use a USB scanner. These will decode the scan, and send it as if it were typed on the keyboard, and entered with a trailing return.
The barcode is typically written with leading and trailing * characters, but these are not sent with the scan.
Thus you print "*AB123*" using a 3 of 9 font, a... | 1 | 1 | 0 | I have to read incoming data from a barcode scanner using pyserial. Then I have to store the contents into a MySQL database. I have the database part but not the serial part. can someone show me examples of how to do this. I'm using a windows machine. | Reading incoming data from barcode | 1.2 | 1 | 0 | 916 |
6,472,481 | 2011-06-24T18:56:00.000 | -1 | 0 | 1 | 0 | python | 6,472,627 | 4 | false | 0 | 0 | Remember that Python calls superclass methods from right to left. | 1 | 0 | 0 | I have a syntax question about python's super() and multiple inheritance. Say I have class A and B, both of which have a method hello(). I have a class C that inherits from both A and B, in that order.
How do I call the hello() method of B explicitly from C? Seems simple enough, but I can't seem to find the syntax for... | python super question | -0.049958 | 0 | 0 | 348 |
6,472,661 | 2011-06-24T19:13:00.000 | 0 | 0 | 1 | 1 | python,ruby,windows,windows-7 | 6,472,767 | 4 | false | 0 | 0 | Practical Programming: An Introduction to Computer Science Using Python, I have read this but it might be too easy for people with some programming experience already | 1 | 0 | 0 | I am interested in learning python and ruby, but I use Windows 7. Most online articles I have seen out there are not really helpful to me since they are all explaining about python and ruby in UNIX environment.
I'd like to know if there are any good articles/books about Ruby/python programming languages that are more f... | ruby/python learning reference for Windows user | 0 | 0 | 0 | 287 |
6,473,879 | 2011-06-24T21:19:00.000 | 1 | 0 | 0 | 0 | python,django-nonrel,django-socialauth | 6,902,951 | 1 | true | 1 | 0 | They do, the only issue you'll run into if you are using a non-rel database is that the admin modules for Social_Auth will not work. They use joins. I was considering forking the project to see if I could make them work with non-rel, but I ran out of time.
What I've done is setup two separate databases. I'm storing my ... | 1 | 1 | 0 | Anybody got Django-SocialAuth working with Django-nonrel?
Do they work together?
Please let me know if you have done it. Any gotchas to watch for? | Do Django-nonrel and Django-SocialAuth play together nicely? | 1.2 | 0 | 0 | 223 |
6,473,925 | 2011-06-24T21:25:00.000 | 99 | 0 | 0 | 0 | python,mysql,sqlalchemy,pyramid | 30,554,677 | 14 | false | 0 | 0 | There is a method in engine object to fetch the list of tables name. engine.table_names() | 1 | 133 | 0 | I couldn't find any information about this in the documentation, but how can I get a list of tables created in SQLAlchemy?
I used the class method to create the tables. | SQLAlchemy - Getting a list of tables | 1 | 1 | 0 | 133,023 |
6,478,288 | 2011-06-25T14:14:00.000 | 1 | 0 | 0 | 0 | python,udp,settimeout | 6,478,330 | 1 | true | 0 | 0 | You don't have to use synchronous communication (i.e. send packet, block and wait for results), especially not if you're using UDP. Just have one thread send out pings, and another one constantly receiving pongs on the same socket. If you have to do complicated processing with the results, you may want to use another o... | 1 | 4 | 0 | I have to query ~10000 gameservers through an UDP protocol to check if they are online on a server every 15 minutes. My code is working, but servers that are offline block threads slowing progress down enormously. I use 20 threads, more will cause the UDP sockets of Python to slow down to a crawl.
Currently I'm using a... | What is a reasonable timeout for checking if a server is online? | 1.2 | 0 | 1 | 593 |
6,481,333 | 2011-06-26T00:15:00.000 | 1 | 0 | 0 | 0 | python,opengl,fonts,bitmap,gimp | 6,481,428 | 2 | false | 0 | 1 | Generally, the way this works is you use a tool to generate the glyph images. That tool will also generate metric information for those glyphs (how big they are, etc). You shouldn't be analyzing the image to find the glyphs; you should have additional information alongside your glyphs that tell where they are, how big ... | 1 | 2 | 0 | I have all the characters of a font rendered in a PNG. I want to use the PNG for texture-mapped font rendering in OpenGL, but I need to extract the glyph information - character position and size, etc.
Are there any tools out there to assist in that process? Most tools I see generate the image file and glyph data toget... | Tools to extract glyph data from bitmap font image | 0.099668 | 0 | 0 | 1,560 |
6,483,466 | 2011-06-26T10:50:00.000 | 2 | 0 | 1 | 0 | python,user-interface,gtk,pygtk,modal-dialog | 6,483,508 | 1 | true | 0 | 0 | Would GtkDialog.run() be the method you need? You "run" the dialog, at the point where you need to ask the user, and when it returns you have your answer. | 1 | 0 | 0 | The program I am writing can edit a single project at a time. This means that opening a new file/project implies closing the previous one. Now what I want to achieve is the following workflow:
User has uncommitted changes to a project he never previously saved, so the project doesn't have a file name yet.
User presses... | How to resume program workflow at the right place after dialogue response? | 1.2 | 0 | 0 | 79 |
6,485,005 | 2011-06-26T15:55:00.000 | 3 | 0 | 0 | 0 | python,django,django-generic-views | 6,485,173 | 3 | false | 1 | 0 | Whether to use generic views or not is your prerogative. It won't cause you any trouble, although you might find yourself coding repetitious view logic. You might consider using wrapped/subclassed generic views in your views.py (frequently you'll want to customize them anyways), which would keep the boilerplate out of ... | 2 | 7 | 0 | I was going through quick poll tutorial on the Django site, and the last topic is introduction of generic views. A convenient way to bypass the need of creation of custom views for every URL pattern.
This is the main idea as far as I understand:
1) Request -> URL patterns -> View -> Template
or
2) Request -> URL patter... | Django - use generic views or not? | 0.197375 | 0 | 0 | 3,542 |
6,485,005 | 2011-06-26T15:55:00.000 | 10 | 0 | 0 | 0 | python,django,django-generic-views | 6,485,415 | 3 | true | 1 | 0 | The intention of Generic Views is to reduce boilerplate code when you repeatedly use similar code in several views. You should really use it just for that. Basically, just because django allows something you are doing generically you shouldn't do it, particularly not when your code becomes not to your like.
If you are ... | 2 | 7 | 0 | I was going through quick poll tutorial on the Django site, and the last topic is introduction of generic views. A convenient way to bypass the need of creation of custom views for every URL pattern.
This is the main idea as far as I understand:
1) Request -> URL patterns -> View -> Template
or
2) Request -> URL patter... | Django - use generic views or not? | 1.2 | 0 | 0 | 3,542 |
6,485,254 | 2011-06-26T16:42:00.000 | 2 | 0 | 1 | 0 | python,python-imaging-library,threshold | 6,485,281 | 2 | false | 0 | 0 | Try im.point(lambda p: p > 190) and post the results. | 1 | 15 | 0 | I have 8-bit greyscale TIFF images that I want to convert to Monochrome using a 75% white (decimal 190) threshold. In the Image.convert(mode) method section, the PIL manual says:
"When translating a greyscale image into a bitlevel image (mode "1"), all non-zero values are set to 255 (white). To use other thresholds, u... | How to I use PIL Image.point(table) method to apply a threshold to a 256 gray image? | 0.197375 | 0 | 0 | 16,154 |
6,486,598 | 2011-06-26T20:39:00.000 | 0 | 1 | 0 | 1 | python,egg | 6,488,633 | 1 | true | 0 | 0 | A package can specify itself using the zip_safe flag inside its setup.py file if it should be unarchived or not. In addition most installers like 'easy_install' provide options to control the unpacking explicitly (e.g. easy_install --zip-ok ...)...so it may depend on how the packages are installed under Fedora oder Cen... | 1 | 1 | 0 | I'm running fedora 32 bit on one machine and have installed several eggs using easy_install.
I've installed the same eggs using easy_install on a 64-bit centos 5 machine. The site-packages directories are different - on my fedora machine, some of the eggs have been inflated so there are directories ending .egg-info as ... | Python eggs - sometimes inflated, sometimes not | 1.2 | 0 | 0 | 133 |
6,486,738 | 2011-06-26T21:03:00.000 | 0 | 0 | 0 | 0 | python,algorithm,cluster-analysis,latent-semantic-indexing | 37,608,130 | 4 | false | 0 | 0 | The basic thing to understand here is that clustering requires your data to be present in a format and is not concerned with how did you arrive at your data. So, whether you apply clustering on the term-document matrix or on the reduced-dimension (LDA output matrix), clustering will work irrespective of that.
Just do t... | 2 | 10 | 1 | Is it possible to do clustering in gensim for a given set of inputs using LDA? How can I go about it? | Clustering using Latent Dirichlet Allocation algo in gensim | 0 | 0 | 0 | 13,867 |
6,486,738 | 2011-06-26T21:03:00.000 | 10 | 0 | 0 | 0 | python,algorithm,cluster-analysis,latent-semantic-indexing | 6,525,268 | 4 | true | 0 | 0 | LDA produces a lower dimensional representation of the documents in a corpus. To this low-d representation you could apply a clustering algorithm, e.g. k-means. Since each axis corresponds to a topic, a simpler approach would be assigning each document to the topic onto which its projection is largest. | 2 | 10 | 1 | Is it possible to do clustering in gensim for a given set of inputs using LDA? How can I go about it? | Clustering using Latent Dirichlet Allocation algo in gensim | 1.2 | 0 | 0 | 13,867 |
6,487,526 | 2011-06-26T23:49:00.000 | 0 | 0 | 1 | 0 | python,regex | 6,487,546 | 4 | false | 0 | 0 | I believe it would be r'data:(\w+)/(\w+);(\w+),(\w+)' or something beyond that. | 2 | 1 | 0 | I am trying to match a data URI pattern of data:\w+/\w+;\w+,\w+ in Python. How do I retain each match to use later (essentially, each of the w+ pieces)? | How do I get matched characters from Python regex? | 0 | 0 | 0 | 1,501 |
6,487,526 | 2011-06-26T23:49:00.000 | 0 | 0 | 1 | 0 | python,regex | 6,487,578 | 4 | false | 0 | 0 | Put them in groups. I don't know Python, but this is the same in every language.
You group things in RegEx using brackets.
data:(\w+)/(\w+);(\w+),(\w+)
Then, using Python RegExp functions, get the groups that match. | 2 | 1 | 0 | I am trying to match a data URI pattern of data:\w+/\w+;\w+,\w+ in Python. How do I retain each match to use later (essentially, each of the w+ pieces)? | How do I get matched characters from Python regex? | 0 | 0 | 0 | 1,501 |
6,488,329 | 2011-06-27T03:27:00.000 | 3 | 0 | 1 | 0 | python,import | 6,488,791 | 2 | true | 0 | 0 | These are usually solved by refactoring shared components into a third module, and each original one imports that new module. | 1 | 1 | 0 | I have a module that keep tracks of all the usage log, (usage.py)
I then created another module for drawing charts, (chart.py)
I wanna keep track of people using my chart.py, thus, I import usage.py into my chart.
Everything seems cool up to this point.
Now, I wanna display the chart of the usage in usage.py, thus, I t... | how to solve a loop import | 1.2 | 0 | 0 | 7,602 |
6,488,806 | 2011-06-27T05:10:00.000 | 2 | 1 | 0 | 1 | python | 6,531,642 | 1 | false | 1 | 0 | You don't need to spawn another process, that would complicate things a lot. Here's how I would do it based on something similar in my current project :
Create a WSGI application, which can live behind a web server.
Create a request handler (or "view") that is accessible from any URL mapping as long as the user doesn... | 1 | 1 | 0 | I need to write a cgi page which will act like a reverse proxy between the user and another page (mbean). The issue is that each mbean uses different port and I do not know ahead of time which port user will want to hit.
Therefore want I need to do is following:
A) Give user a page which will allow him to choose which... | python reverse proxy spawning via cgi | 0.379949 | 0 | 0 | 488 |
6,489,663 | 2011-06-27T07:10:00.000 | 0 | 0 | 1 | 0 | python,file,search,directory,match | 6,489,701 | 5 | false | 0 | 0 | I do not know the logic of python for this but I would do the following:
Loop through each file in the directory, get the names as strings and check to see if they begin with "myfile" by splitting the string on the "." you can compare what you are looking for with what you have. | 1 | 3 | 0 | Let's say I want to search for a file name "myfile" in a folder named "myfolder", how can I do it without knowing the format of the file?
Another question: how to list all files of a folder and all the files of it's subfolders (and so on)?
Thank you. | Find file in folder without knowing the extension? | 0 | 0 | 0 | 3,120 |
6,491,856 | 2011-06-27T11:03:00.000 | 0 | 0 | 0 | 0 | python,sqlite,memory,ubuntu,memory-leaks | 6,491,966 | 2 | true | 0 | 0 | The memory may be not assigned to a process, but it can be e.g. a file on tmpfs filesystem (/dev/shm, /tmp sometimes). You should show us the output of top or free (please note those tools do not show a single 'memory usage' value) to let us tell something more about the memory usage.
In case of inserting records to a ... | 1 | 2 | 0 | I'm dealing with some big (tens of millions of records, around 10gb) database files using SQLite. I'm doint this python's standard interface.
When I try to insert millions of records into the database, or create indices on some of the columns, my computer slowly runs out of memory. If I look at the normal system moni... | Why does running SQLite (through python) cause memory to "unofficially" fill up? | 1.2 | 1 | 0 | 1,060 |
6,493,444 | 2011-06-27T13:17:00.000 | 0 | 0 | 0 | 0 | python,real-time,comet,ajax-push | 6,529,595 | 3 | false | 1 | 0 | I think the most popular is tornado open-sourced by facebook. It also has pretty decent documentation. | 2 | 3 | 0 | I have a web application im currently working on in python. I'm using Django as my web framework currently. I intend to integrate real-time web features into the application using ajax push. However, I'm a bit confused as to what python based push server i should adopt. I've heard of a few of them, Orbited, Gevent, Tor... | What python based ajax push servers are good to work with | 0 | 0 | 0 | 1,481 |
6,493,444 | 2011-06-27T13:17:00.000 | 0 | 0 | 0 | 0 | python,real-time,comet,ajax-push | 6,494,673 | 3 | false | 1 | 0 | APE seems a cool thing.
I think it's not a problem to make it work with PDjango as a backend. | 2 | 3 | 0 | I have a web application im currently working on in python. I'm using Django as my web framework currently. I intend to integrate real-time web features into the application using ajax push. However, I'm a bit confused as to what python based push server i should adopt. I've heard of a few of them, Orbited, Gevent, Tor... | What python based ajax push servers are good to work with | 0 | 0 | 0 | 1,481 |
6,494,199 | 2011-06-27T14:11:00.000 | -4 | 0 | 0 | 0 | python,html,parsing,beautifulsoup,html-parsing | 6,494,288 | 4 | false | 1 | 0 | Well, software is like cars....different flavors about all do drive!
Go with BeautifulSoup (4). | 2 | 16 | 0 | I want to do some screen-scraping with Python 2.7, and I have no context for the differences between HTMLParser, SGMLParser, or Beautiful Soup.
Are these all trying to solve the same problem, or do they exist for different reasons? Which is simplest, which is most robust, and which (if any) is the default choice?
Als... | Parsing HTML with Python 2.7 - HTMLParser, SGMLParser, or Beautiful Soup? | -1 | 0 | 1 | 6,435 |
6,494,199 | 2011-06-27T14:11:00.000 | 6 | 0 | 0 | 0 | python,html,parsing,beautifulsoup,html-parsing | 6,494,502 | 4 | false | 1 | 0 | BeautifulSoup in particular is for dirty HTML as found in the wild. It will parse any old thing, but is slow.
A very popular choice these days is lxml.html, which is fast, and can use BeautifulSoup if needed. | 2 | 16 | 0 | I want to do some screen-scraping with Python 2.7, and I have no context for the differences between HTMLParser, SGMLParser, or Beautiful Soup.
Are these all trying to solve the same problem, or do they exist for different reasons? Which is simplest, which is most robust, and which (if any) is the default choice?
Als... | Parsing HTML with Python 2.7 - HTMLParser, SGMLParser, or Beautiful Soup? | 1 | 0 | 1 | 6,435 |
6,495,077 | 2011-06-27T15:16:00.000 | 9 | 0 | 0 | 0 | python,curl,pycurl | 6,495,548 | 2 | true | 1 | 0 | The problem is that it accepts strings, not unicode objects. Remove the u and unicode(). | 1 | 1 | 0 | I try to set the url using this code c.setopt(pycurl.URL, link), but I get the following exception
File "/home/sultan/Repository/Django/monitor/app/thread/utils.py", line 164, in perform
self.proxy_request.setopt(pycurl.URL, u'%s' % unicode(link))
TypeError: invalid arguments to setopt
What is wrong with my cod... | Python: PyCurl set URL exception | 1.2 | 0 | 0 | 5,514 |
6,496,981 | 2011-06-27T18:02:00.000 | 3 | 0 | 0 | 1 | python,c,buffer,ctypes,free | 6,497,052 | 1 | true | 0 | 0 | Try the following in the given order:
Try by all means to manage your memory in Python, for example using create_string_buffer(). If you can control the behaviour of the C function, modify it to not free() the buffer.
If the library function you call frees the buffer after using it, there must be some library functio... | 1 | 2 | 0 | I need to call a function in a C library from python, which would free() the parameter.
So I tried create_string_buffer(), but it seems like that this buffer would be freed by Python later, and this would make the buffer be freed twice.
I read on the web that Python would refcount the buffers, and free them when there ... | How can I create a buffer which Python would not free? | 1.2 | 0 | 0 | 1,077 |
6,497,690 | 2011-06-27T19:09:00.000 | 1 | 0 | 1 | 0 | javascript,jquery,python,json,flowchart | 6,499,563 | 1 | true | 0 | 0 | Wouldn't it be easiest to just define different types of nodes in the flowchart, and then define which nodes each node is connected to?
Simply display each type as different looking node and connections would simply be drawn as lines between them.
Why do loops or conditions need to be any different from the rest? They... | 1 | 0 | 0 | So recently at work I have been tasked with creating a Flowchart library. I would just like to get some general suggestions on how I should approach this. We use mongodb for persistence, and Tornado Web Server as a backend. Basically what I need is to create a library in javascript that has a means of importing JSON... | Suggestions for Making a Flowchart Library that uses JSON as Markup | 1.2 | 0 | 0 | 1,509 |
6,498,272 | 2011-06-27T20:02:00.000 | 3 | 0 | 0 | 0 | python,mysql,serial-port,realbasic | 6,498,450 | 2 | false | 0 | 0 | It's hard to imagine that Realbasic is a better choice than Python for any project. | 2 | 0 | 0 | I'm doing a project that is serial based and has to update a database when a barcode is being read. Which programming language has better tools for working with a MySQl database and Serial communication. I debating right now between python and realbasic. | What language is better for serial programming and working with MySQL database? Python? Realbasic? | 0.291313 | 1 | 0 | 1,691 |
6,498,272 | 2011-06-27T20:02:00.000 | 3 | 0 | 0 | 0 | python,mysql,serial-port,realbasic | 6,498,607 | 2 | true | 0 | 0 | Python is a general purpose language with tremendous community support and a "batteries-included" philosophy that leads to simple-designs that focus on the business problem at hand. It is a good choice for a wide variety of projects.
The only reasons not to choose Python would be:
You (or your team) have greater exper... | 2 | 0 | 0 | I'm doing a project that is serial based and has to update a database when a barcode is being read. Which programming language has better tools for working with a MySQl database and Serial communication. I debating right now between python and realbasic. | What language is better for serial programming and working with MySQL database? Python? Realbasic? | 1.2 | 1 | 0 | 1,691 |
6,498,373 | 2011-06-27T20:11:00.000 | 5 | 0 | 0 | 0 | python,django | 6,498,394 | 4 | false | 1 | 0 | I'd suggest learning the basics of Python and at least the MVC design pattern first.
From there, yes, go ahead and starting creating a project in Django, it's the best way to learn Django.
As far as "python fundamentals" that means the obvious basic syntax and keywords. From there, it's more important that you understa... | 1 | 1 | 0 | I am newbie to the Django framework. I want to learn it and use it to develop applications. I am new to python. To learn Django, do I need knowledge of python and design patterns?
I don't know whether I should learn the design patterns, e.g. MVC, and think about writing applications or instead start to learn the langu... | Getting Started With Python and Django | 0.244919 | 0 | 0 | 2,576 |
6,499,096 | 2011-06-27T21:21:00.000 | 0 | 0 | 0 | 0 | python,django | 21,431,038 | 3 | false | 1 | 0 | That is the best solution, however you could disable the button onclick by adding a disabled attribute to the button equalling 'true'
With jQuery:
$('#yourButtonId').attr("disabled", true); | 1 | 3 | 0 | There's some functionality on our Django app that displays a link to refresh some information from our version control system. This is simply a link, and when they hit that URL the actions of going to version control, getting the information, checking it against the database and updating the database are performed.
R... | Django: Is there a way to prevent a view from being called twice simultaneously? | 0 | 0 | 0 | 5,538 |
6,499,507 | 2011-06-27T22:07:00.000 | 0 | 0 | 0 | 0 | python,user-interface,programming-languages,multimedia | 6,499,936 | 1 | true | 0 | 1 | Python 3 doesn't work with wxPython right now. Python 3 does work with pyQT, but it is under GPL, so you will need to buy a license if you do not want to release your software under the GPL. | 1 | 0 | 0 | I'm going to develop a multimedia application which is running mostly on windows.
I don't know whether python is a good choice or not and which GUI library (Wxpython or pyqt) is suitable for that. Maybe pyQt is enough(like it).
The major features of the application include:
Must have a rich GUI, a great look and feel ... | A multimedia-rich application for windows, is Python enough good? | 1.2 | 0 | 0 | 288 |
6,499,829 | 2011-06-27T22:47:00.000 | 1 | 0 | 1 | 0 | python,ruby | 6,499,855 | 5 | true | 0 | 0 | As far as Python, most people are using the latest version of the 2 series. Python in general can be a nightmare as to mixing versions (at least, it used to be), but the solution is simply to deliver your software with the entire python environment it depends on. | 3 | 2 | 0 | I've heard that there are issues with the more recent versions of Python (3.x?) that have led to slower adoption. Is that true? And if so, is it an issue when different people are using different versions of the language? Which version of Python is most widespread?
Does Ruby have a similar issue, or did most people swi... | Ruby vs. Python: which one is easier to keep track of different language versions? | 1.2 | 0 | 0 | 545 |
6,499,829 | 2011-06-27T22:47:00.000 | 3 | 0 | 1 | 0 | python,ruby | 6,499,934 | 5 | false | 0 | 0 | The issues aren't with Python 3.x, but the lack of a reasonable transition path from 2.x to 3.x causing most people to stay on 2.x.
It was a serious blunder, but an isolated one: aside from that, Python updates are very straightforward. | 3 | 2 | 0 | I've heard that there are issues with the more recent versions of Python (3.x?) that have led to slower adoption. Is that true? And if so, is it an issue when different people are using different versions of the language? Which version of Python is most widespread?
Does Ruby have a similar issue, or did most people swi... | Ruby vs. Python: which one is easier to keep track of different language versions? | 0.119427 | 0 | 0 | 545 |
6,499,829 | 2011-06-27T22:47:00.000 | 1 | 0 | 1 | 0 | python,ruby | 6,499,998 | 5 | false | 0 | 0 | Reminds me of the days I spent coding for Python 1.5.2 because 2.x had not had deep enough deployment to use any of the newer features -- it was a choice between customers and nice features.
It feels to me like Ruby users are more accustomed to having multiple versions installed simultaneously for the different levels ... | 3 | 2 | 0 | I've heard that there are issues with the more recent versions of Python (3.x?) that have led to slower adoption. Is that true? And if so, is it an issue when different people are using different versions of the language? Which version of Python is most widespread?
Does Ruby have a similar issue, or did most people swi... | Ruby vs. Python: which one is easier to keep track of different language versions? | 0.039979 | 0 | 0 | 545 |
6,500,216 | 2011-06-27T23:51:00.000 | 1 | 0 | 1 | 0 | python,setuptools,easy-install | 6,510,669 | 2 | true | 0 | 0 | I found a quick workaround via the dependency_links option of setuptools.
Upload Y's tarball to some url http://URL_Y.
Add the line: dependency_links = ['http://URL_Y'], to my setup.py.
Now easy_install X[Y] works and I didn't have to register Y anywhere. I will delete it from URL_Y as soon as I have a proper fix. | 1 | 6 | 0 | setup.py of my package X uses setuptools to optionally install an extra package Y, via the extras_require parameter.
Now package Y disappeared from PyPi and, as far as I can tell, from the visible Internet. easy_install X[Y] fails with error: Could not find suitable distribution for Y.
However, I still have a local cop... | Install local extras in Python | 1.2 | 0 | 0 | 1,020 |
6,500,878 | 2011-06-28T02:16:00.000 | 2 | 0 | 0 | 1 | python,google-app-engine,queue,task,task-queue | 9,361,730 | 3 | false | 1 | 0 | You can use memcache. Use a unique key specific to this task group. Set a count when you kick off your tasks, and have each task atomically decrement it. When the value is 0, your tasks are complete. The task that finds this value to be 0 can call your callback. | 1 | 9 | 0 | I'm putting several tasks into a task queue and would like to know when the specific tasks are done. I haven't found anything in the API about call backs, or checking the status of a task, so I thought I'd see what other people do, or if there's a work around (or official) way to check. I don't care about individual ta... | Checking status of Task Queue in Google App Engine | 0.132549 | 0 | 0 | 4,031 |
6,503,861 | 2011-06-28T08:44:00.000 | -1 | 0 | 0 | 0 | python,html,templates,plone,zope | 6,503,962 | 2 | false | 1 | 0 | Perhaps you could approach this from a Javascript way? A lot of applications have like a global js file, that's included in all pages. Starting from that you could modify the DOM easily. | 1 | 1 | 0 | My goal is to inject some HTML-Code in front of every Plone article (between the page's header and the first paragraph)? I'm running Plone 4. Does anyone have a hint on how to realize that?
The other question is: is it possible to place some HTML code randomly in every Plone article? | How to inject template code in Plone? | -0.099668 | 0 | 0 | 667 |
6,503,920 | 2011-06-28T08:50:00.000 | 2 | 0 | 1 | 0 | python,syntax | 6,504,081 | 5 | false | 0 | 0 | If you don't mind prefixing, you can "prefix" with an underscore. Sure it'll actually be part of the variable's name, but it'll look like a prefixed reserved word. Other than that, it is not possible. | 1 | 9 | 0 | It may not be a good idea to name a variable after a reserved word, but I am curious:
Is there any escape syntax in Python to allow you to use a reserved word as the name of a variable?
For example, in C# this can be done by prefixing the reserved word with @ | Is it possible to escape a reserved word in Python? | 0.07983 | 0 | 0 | 14,481 |
6,503,927 | 2011-06-28T08:51:00.000 | 0 | 0 | 1 | 0 | python | 6,509,943 | 3 | false | 0 | 0 | Python is much better choice,since Python is used extensively in youtube to do automation work,Python is also used in robotics,so python is right choice, it would be much easier for us to help if you can share what type of automation you are speaking about. | 1 | 0 | 0 | I would like to automate nightly builds using python. I am new to python and will need guidance from the programmers who can help me. | I want to perform build automation using python, and it should be cross platform. Is python a good choice? | 0 | 0 | 0 | 3,310 |
6,504,182 | 2011-06-28T09:13:00.000 | 1 | 0 | 0 | 0 | python,django,nginx,uwsgi | 6,504,717 | 2 | false | 1 | 0 | You don't state your OS, so... having deployed django behind both apache and nginx in Windows, I have to say that I found nginx to be infinitely easier. However, since nginx is more of a static file server with excellent proxying capability, I ran a separate wsgi server for the django app. After trying several (and f... | 1 | 1 | 0 | I have done the nginx configuration for serving django app .i am able to serve the django site using proxy pass for that i have to run the server manualy and then nginx serves the site.I want to execute the site using nginx but the server should get start automaticaly it shoud not be go through proxy_pass is this possi... | Serve Django site using Nginx without proxy_pass | 0.099668 | 0 | 0 | 855 |
6,504,482 | 2011-06-28T09:39:00.000 | 0 | 0 | 0 | 0 | python,forms,selenium-rc,field,autofill | 6,510,614 | 2 | false | 1 | 0 | Hi i got a solution for this i think,
problem is with generating the user interactions to the addition field.
use these statements
focus("form:addition");
keyPressNative("10") //this is ENTER command
it should work | 2 | 0 | 0 | I am running an automated test to test a webform for my company. They have just installed a zipcode service which automatically adds the Street and City/Region when you fill in the Address and housenumber.
This autofill appears when you deselect the last form element (e.g. that of the housenumber).
This is the order o... | Selecting the next formfield with Selenium RC and python | 0 | 0 | 1 | 385 |
6,504,482 | 2011-06-28T09:39:00.000 | 0 | 0 | 0 | 0 | python,forms,selenium-rc,field,autofill | 6,531,214 | 2 | false | 1 | 0 | Yesterday I found out that the zipcode service uses an Ajax call to retrieve the information. This call is executed when the zipcode and housenumber fields are both 'out of focus' (i.e. deselected).
The right statement I found to use this in my advantage is this;
selenium.fireEvent('form:number', 'blur') which deselect... | 2 | 0 | 0 | I am running an automated test to test a webform for my company. They have just installed a zipcode service which automatically adds the Street and City/Region when you fill in the Address and housenumber.
This autofill appears when you deselect the last form element (e.g. that of the housenumber).
This is the order o... | Selecting the next formfield with Selenium RC and python | 0 | 0 | 1 | 385 |
6,506,064 | 2011-06-28T11:59:00.000 | 0 | 0 | 0 | 0 | python,django | 6,506,217 | 1 | false | 1 | 0 | Are you actually sending the video, or are you sending an HTML page with an embedded video (either with Flash or HTML5)? If the former, showing other output would be impossible. If the latter, you can have it anywhere else on the page. | 1 | 1 | 0 | I need to display a streaming video and also the output of a python code running simultaneously. What is the best framework to go about designing it. | Display streaming video and result of a python code at the same time in a web-browser | 0 | 0 | 0 | 297 |
6,506,372 | 2011-06-28T12:28:00.000 | 0 | 0 | 0 | 0 | python,xpath,selenium,beautifulsoup,lxml | 6,506,453 | 3 | false | 1 | 0 | There is no way to exclude unexpected attributes with XPath.
So you must find a safer way to locate elements you want. Things that you should consider:
In a form, each input should have a distinct name. The same is true for the form itself. So you can try //form[@name='...']/input[@name='...']
Add a class to the field... | 1 | 1 | 0 | I'm working through a Selenium test where I want to assert a particular HTML node is an exact match as far as what attributes are present and their values (order is unimportant) and also that no other attributes are present. For example given the following fragment:
<input name="test" value="something"/>
I am trying t... | Finding Only HTML Nodes Whose Attributes Match Exactly | 0 | 0 | 1 | 146 |
6,507,708 | 2011-06-28T14:04:00.000 | 10 | 1 | 0 | 0 | python,amazon-ec2 | 6,508,616 | 1 | true | 0 | 0 | The big advantage of libcloud is that it provides a unified interface to multiple providers, which is a big plus in my mind. You won't have to rewrite everything if you plan to migrate some instances to Rackspace later, or mix and match, etc. I haven't used it extensively but it looks fairly complete as far as EC2 goes... | 1 | 9 | 0 | What is the recommended library for python to do everything that is Amazon EC2 related?
I came across boto and libcloud. Which one is easier to use? does libcloud offer the same functionality as boto? | Python & Amazon EC2 -- Recommended Library? | 1.2 | 0 | 1 | 933 |
6,508,456 | 2011-06-28T14:54:00.000 | 0 | 0 | 1 | 0 | python,python-2.6,pyobjc,activepython | 6,540,385 | 2 | true | 0 | 0 | I ended up installing it with easy install:
easy_install-2.6 pyobjc==2.2
That worked. | 1 | 1 | 0 | I need json, pyobjc and ideally psyco as well.
I got all but pyobjc working on active python 2.6. How do I successfully install pyobjc properly?
Thank you. | How to install pyobjc on activepython 2.6 for snow leopard? | 1.2 | 0 | 0 | 165 |
6,509,571 | 2011-06-28T16:10:00.000 | 4 | 0 | 0 | 0 | python,django,apache,wsgi | 6,514,333 | 2 | true | 1 | 0 | To answer the specific question, no it is not possible to make a mod_wsgi installation compiled for one Python version to use a different version at run time.
Why don't you create a separate question for the actual problem you are having with compiling from source code. Better still ask it on the mod_wsgi mailing list ... | 1 | 3 | 0 | My WSGI installation uses python2.6 and my django project requires python 2.7 to work properly. Is is possible to relink the python version WSGI uses without recompiling wsgi? I've been having some odd errors trying to compile wsgi and I'd prefer to sidestep that whole troubleshooting process if possible.
Thanks | Apache mod_wsgi and python 2.7 | 1.2 | 0 | 0 | 8,016 |
6,510,064 | 2011-06-28T16:45:00.000 | 0 | 0 | 1 | 0 | python | 6,510,160 | 3 | false | 0 | 0 | You could use a sed/awk script to do the batch renaming. | 1 | 0 | 0 | I have a rather large personal python library that I use for projects. I want to release it to the public, but first I wanted to change the name to something a little less silly then the personal anecdote that I named it after.
Lets say I have a library name "FooBarLib" and it is contained within the folder "FooBarLib... | Changing a library's name in Python | 0 | 0 | 0 | 84 |
6,510,075 | 2011-06-28T16:45:00.000 | 3 | 0 | 0 | 0 | php,asp.net,python,ruby-on-rails,ruby | 6,510,307 | 3 | true | 0 | 0 | I generally wouldnt ever store this information in a file - you run the risk of potentially swapping this file in and out of memory (yes it could be cached at times) but I would rather use an in memory mechanism designed as such and you are then using something that is fairly nonstandard.
In ASP.Net
you can use in in... | 2 | 7 | 0 | When building a website, one have to decide how to store the session info, when a user is logged in.
What is a pros and cons of storing each session in its own file versus storing it in a database? | What is the pros/cons of storing session data in file vs database? | 1.2 | 1 | 0 | 2,180 |
6,510,075 | 2011-06-28T16:45:00.000 | 1 | 0 | 0 | 0 | php,asp.net,python,ruby-on-rails,ruby | 6,527,272 | 3 | false | 0 | 0 | I'm guessing, based on your previous questions, that this is being asked in the context of using perl's CGI::Application module, with CGI::Application::Plugin::Session. If you use that module with the default settings, it will write the session data into files stored in the /tmp directory - which is very similar to wha... | 2 | 7 | 0 | When building a website, one have to decide how to store the session info, when a user is logged in.
What is a pros and cons of storing each session in its own file versus storing it in a database? | What is the pros/cons of storing session data in file vs database? | 0.066568 | 1 | 0 | 2,180 |
6,510,517 | 2011-06-28T17:19:00.000 | 0 | 0 | 0 | 0 | python,django,arrays,list | 54,308,907 | 5 | false | 1 | 0 | I know it seems counter intuitive, but you definitely want to use something general like a many to one (foreign key) from your answers table to your poll table. You want your app to easily grow to support future ideas, like associating metadata with those answer-poll pairings, and being able to efficiently do queries o... | 1 | 4 | 0 | I need to make a model that stores the historical data of a Field, for example a poll that has a Field of its answers so it can make things with that.
I was looking to the ManytoMany field but its too general, it feels like im doing too much for something easy. | Making an array Field in Django | 0 | 0 | 0 | 6,477 |
6,511,633 | 2011-06-28T18:53:00.000 | 0 | 1 | 0 | 0 | python,authentication,twitter,oauth | 6,533,687 | 2 | false | 0 | 0 | If you want to access resources at Twitter, even if they are your own, and even if it is just for a "personal script" -> you have to use oAuth. | 1 | 1 | 0 | To use OAUTH with python-twitter I need to register a web app, website etc. The program I have is for personal use though. Since basic auth is now defunct and Oauth is not an option due to the requirements is there a work around to log in to twitter using a script?
I can't imagine that Twitter would alienate everyone w... | How to log in to twitter without Oauth for a script? | 0 | 0 | 1 | 881 |
6,512,047 | 2011-06-28T19:27:00.000 | 4 | 0 | 1 | 0 | python,chess | 10,352,479 | 4 | false | 0 | 0 | I can't give you any Python-specific directions, but I wrote a PGN converter recently in java, so I'll try offer some advice. The main disadvantage of Miku's link is the site doesn't allow for variance in .pgn files, which every site seems to vary slightly on the exact format.
Some .pgn have the move number attached t... | 1 | 9 | 0 | How do I go about extracting move information from a pgn file on Python? I'm new to programming and any help would be appreciated. | Extracting move information from a pgn file on Python | 0.197375 | 0 | 0 | 5,405 |
6,513,725 | 2011-06-28T22:16:00.000 | 4 | 0 | 1 | 0 | python,python-imaging-library,virtualenv,pip | 6,513,788 | 1 | true | 0 | 0 | You can put a PIL.pth file in the virtualenv's site-packages (or wherever on the sys.path) to add the name of the PIL directory, which will be appended to sys.path. Here on linux PIL already uses a .pth file, so it's just a matter of copying it and making the path absolute. | 1 | 1 | 0 | So I'm working on migrating a Django project to virtualenv/pip. I'd like to use --no-site-packages for the most control over the environment, but the sticking point appears to be PIL. Given that PIL is notoriously difficult to install with pip, especially as there are Windows users on the team, I'd rather use that one ... | Can I cherry-pick packages from site-packages in a virtualenv? | 1.2 | 0 | 0 | 267 |
6,514,812 | 2011-06-29T01:19:00.000 | 1 | 0 | 0 | 0 | javascript,python,firefox,canvas,selenium | 6,520,796 | 1 | true | 0 | 0 | Since your communication between Selenium and the browser through getEval is string based, I think that there is no escape from base64 encoding the image data. sending raw binary data will probably not be possible.
You can probably devise your own string encoding scheme, but it'll probably be as effective as the built... | 1 | 3 | 0 | I am accessing image data on Javascript. Now I'd like to pass this to Python process through Selenium API in the most efficient possible manner.
Passing canvas data is easy with canvas.toDataURL() method, but the downside is that the image is encoded and decoded to PNG, adding substantial overhead to the process.
I wa... | Firefox, Selenium, toDataURL, Uint8ClampedArray and Python | 1.2 | 0 | 1 | 1,163 |
6,514,971 | 2011-06-29T01:53:00.000 | 3 | 1 | 0 | 0 | python,redis,tornado,hebrew | 6,518,345 | 2 | true | 0 | 0 | Read the articles given in the comments.
Short answer though, store unicode in Redis, and if you're using Python 2.x, use unicode strings (u"") throughout. You may have to convert to unicode (unicode()) after retrieval from Redis, depending on what it gives you. | 1 | 1 | 0 | I've read through many of the related questions and am a bit unsure as to how to handle this situation.
The Basic Question: What is the best way to handle "foreign" (Hebrew, Greek, Aramaic?, etc.) characters in a website?
I get that I need to use UTF-8 encoding but the mechanics behind it are lost on me.
I am using tor... | Handling foreign characters in website running on python, tornado and redis | 1.2 | 0 | 0 | 920 |
6,515,160 | 2011-06-29T02:30:00.000 | 2 | 1 | 0 | 0 | python,mongodb,pyramid | 6,934,811 | 1 | false | 0 | 0 | Just create a database in your TestCase.setUp and delete in TestCase.tearDown
You need mongodb running because there is no mongolite3 like sqlite3 for sql
I doubt that django is able to create a temporary file to store a mongodb database. It probably just use sqlite:/// which create a database with a memory storage. | 1 | 2 | 0 | I have a pyramid project that uses mongodb for storage. Now I'm trying to write a test but how do I specify connection to the mongodb?
More specifically, which database should I connect to (test?) and how do I use fixtures? In Django it creates a temporary database but how does it work in pyramid? | How do i create unittest in pyramid with mongodb? | 0.379949 | 1 | 0 | 594 |
6,515,166 | 2011-06-29T02:31:00.000 | 0 | 1 | 0 | 0 | python,xml,nosetests | 6,517,155 | 1 | true | 0 | 0 | Why not trying to create a base_test_class.py with a base test class class BaseSQLTest(unittest.TestCase) that contains all your tests, and 2 other files mysqltest.py and psqltest.py that contains 2 inherited classes (class MySQLTest(BaseSQLTest) and class PSQLTest(BaseSQLTest)) for your MySQL and PSQL tests.
Doing th... | 1 | 0 | 0 | I have a test footest.py which runs with mysql database, and the same test runs on psql database, is there a way to distinguish this difference in an XML result file between the two tests. | How can i distinguish the XML results of two python tests (using nosetests as test runner) with the same name but with different context | 1.2 | 0 | 0 | 63 |
6,515,477 | 2011-06-29T03:33:00.000 | 0 | 1 | 0 | 0 | python,twitter,module | 6,515,489 | 2 | false | 0 | 0 | OAuth is a generic protocol; any well-behaved library that implements it should work with any site's API (this is the whole point of having a standard...) | 1 | 0 | 0 | I checked the documentation for Python-Twitter and I couldn't find any methods for OAuthentication. There is a methods for Basic Auth, but I obviously can't use that any more.
If I get a separate module for Oauth can I still use methods in Python-Twitter that require Oauth or does the Oauth only support methods from ... | Do I need a specific Python module Oauthentication? | 0 | 0 | 1 | 66 |
6,516,179 | 2011-06-29T05:37:00.000 | 0 | 0 | 1 | 1 | python,macos | 48,994,064 | 5 | false | 0 | 0 | python 2.7 is bundled with OS X Mountain Lion (10.8) and onwards, so it is likely that most Macs running today (2018) will have python 2.7 without any further effort. | 1 | 14 | 0 | How can I upgrade Python from 2.6 to 2.7 on osx ? | Upgrading Python to 2.7 on OSX | 0 | 0 | 0 | 60,074 |
6,523,883 | 2011-06-29T16:18:00.000 | 0 | 0 | 0 | 1 | c++,python,postgresql,process,cross-platform | 6,524,149 | 2 | false | 0 | 0 | The C++ standard does not know of multiprocess systems. There is, therefore, no API for interacting with processes. (After all, how would the standard mandate a multiprocess system on an 8 bit microcontroller?)
Moreover, some platforms (e.g. the Win32 Subsystem on Windows NT) do not keep track of process parent child r... | 1 | 1 | 0 | I have a long-running Python program that starts and stops a Postgres server as part of its operation. I stop the server by using subprocess to spawn pg_ctl -m fast. As a fall-back, I check the return code and, if it failed, I then run pg_ctl -m immediate.
The problem is that sometimes both fail. I haven't been able... | How can one identify children of a child process? | 0 | 0 | 0 | 369 |
6,524,104 | 2011-06-29T16:33:00.000 | 1 | 1 | 1 | 1 | python,installation | 6,524,127 | 3 | false | 0 | 0 | You specify all dependent packages in the 'install_requires' option within your setup.py - that's it.
If this is not sufficient or good enough (for whatever reason): look into zc.buildout giving your more options installing and configuring external dependencies. | 1 | 1 | 0 | I have created a Python-based GUI application which has certain dependencies such as the "request" and "psycopg2" modules among others.
I want to create a setup script that will install all such dependencies when run, so that a user can run the GUI application without having any missing package errors.
I did try lookin... | Installing dependencies for Python program | 0.066568 | 0 | 0 | 1,635 |
6,525,148 | 2011-06-29T17:59:00.000 | 3 | 0 | 1 | 0 | python,sockets,gtk,pygtk | 6,533,338 | 2 | false | 0 | 0 | Ok ... I can't seem to find any real life application which is already there but I can think of an example( which has been in my wishlist and to-do list since some time now ) .
Suppose you are using stackoverflow and you want to type a reply to a question. And suppose you are also a vim user. So wouldn't you just love... | 1 | 2 | 0 | I'm just learning PyGTK and I came across the plug and sockets section. I don't really understand what they are used for - could anyone give me a real life example of a program where they would be used to illustrate what it is that they do? | Plugs and Sockets in python PyGTK | 0.291313 | 0 | 0 | 428 |
6,526,500 | 2011-06-29T19:59:00.000 | 3 | 1 | 1 | 0 | c++,python,name-mangling | 6,526,604 | 2 | true | 0 | 0 | You most likely don't want to be doing this in Python. As an aside you probably shouldn't be exporting mangled names from your DLLs since it makes it hard to use for anyone with a different compiler.
If you have to use mangled names then just hard code them in your Python code. If you were going to do mangling in Pytho... | 1 | 13 | 0 | I'd like to mangle and demangle C++ function names in a Python program.
Is there anything like that available? I searched for hours now, perhaps I'm lucky here... | C++ Name Mangling Library for Python | 1.2 | 0 | 0 | 5,841 |
6,527,640 | 2011-06-29T21:45:00.000 | 0 | 0 | 0 | 0 | python,grid,wxpython,wxwidgets | 6,539,871 | 2 | false | 0 | 1 | I agree with Mike. Unfortunately wx.grid.Grid.Get[Col|Row]GridLinePen() isn't hooked to the wxPython level, so you can't override those functions in your code. I had been hopeful that returning None would result in the line not being drawn. | 2 | 3 | 0 | On the wxwidgets docs, I only found the EnableGridLines, which is set to false, removes both the horizontal and vertical lines, what I wish, is to remove only the horizontal lines on the grid. Is there a possible way to do this? | Remove horizontal grid lines only on wxgrid | 0 | 0 | 0 | 656 |
6,527,640 | 2011-06-29T21:45:00.000 | 3 | 0 | 0 | 0 | python,grid,wxpython,wxwidgets | 6,535,996 | 2 | false | 0 | 1 | As far as I can tell, you either have all the lines or none of them. Feel free to try cross-posting on the wxPython mailing list to make doubly sure though. | 2 | 3 | 0 | On the wxwidgets docs, I only found the EnableGridLines, which is set to false, removes both the horizontal and vertical lines, what I wish, is to remove only the horizontal lines on the grid. Is there a possible way to do this? | Remove horizontal grid lines only on wxgrid | 0.291313 | 0 | 0 | 656 |
6,528,059 | 2011-06-29T22:36:00.000 | 0 | 1 | 0 | 0 | python,unit-testing,excel,testing | 6,528,157 | 1 | false | 0 | 0 | One of the unit testing frameworks you list is just what you need. Testing is hard and takes time. If you try to do it without putting in sufficient time and thought your testing won't be worth very much.
It sounds like you are wanting a list of inputs and outputs that your test loops through. That's easy. Just declare... | 1 | 0 | 0 | I have a python project that takes in two Excel spreadsheets with various data as input, and depending on given parameters in a python 'run' type module, produces several spreadsheets which contain statistical information as outputs. I have several versions of this project released already to a few clients, but testin... | Simple test tool for python projects | 0 | 0 | 0 | 202 |
6,530,663 | 2011-06-30T06:16:00.000 | -1 | 1 | 1 | 0 | php,python,import | 6,530,718 | 2 | false | 0 | 0 | Elaborate. Is the PHP file local? On a webserver? Where's the python file?
If the php file is on a server with the python file, use an exec statement.
If the python file is local and the php file is on a server, then you need to use urllib.
If both are local, write an interpreter... | 1 | 1 | 0 | How can I access my php script from a Python script?
I need my Python script to be able to access the variables within the php script. (By the way, I'm new to php and Python.)
Thanks in advance. | How to access variable values of a php script from a python script? | -0.099668 | 0 | 0 | 1,637 |
6,532,213 | 2011-06-30T08:43:00.000 | 7 | 1 | 0 | 1 | python,linux,posix,signals | 6,534,882 | 1 | true | 0 | 0 | There is a standard module called, unsurprisingly, signal. This seems to carry out the functionality of sigaction(2). However I'm guessing that what you really need is the siginfo_t struct, which gives the PID of the source of the signal, which is not part of the module at the moment (possibly because it is not imple... | 1 | 4 | 0 | Is there an equivalent to the POSIX sigaction available through Python? I realize python has traditional support for signals, but I need sigaction.
I'm trying to identify the pid of a process that is the source of a signal being issued. From what I can see from the documentation, there isn't a way to do this.
I'm only ... | Python, sigaction(2) available? | 1.2 | 0 | 0 | 2,124 |
6,532,744 | 2011-06-30T09:31:00.000 | 0 | 0 | 0 | 0 | python,django,daemon,daemons,python-daemon | 6,577,278 | 3 | false | 1 | 0 | I previously used a cron job but I telling you, you will switch to celery after a while.
Celery is the way to go. Plus you can tasked long async process so you can speed up the request/response time. | 1 | 16 | 0 | I'm using mod_wsgi to serve a django site through Apache. I also have some Python code that runs as a background process (dameon?). It keeps polling a server and inserts data into one of the Django models. This works fine but can I have this code be a part of my Django application and yet able to constantly run in the ... | Can I have some code constantly run inside Django like a daemon | 0 | 0 | 0 | 8,945 |
6,534,038 | 2011-06-30T11:31:00.000 | 3 | 0 | 0 | 0 | python,django | 6,534,100 | 3 | false | 1 | 0 | The save method should be used when you modify an object that you got by any other means than create, such as .objects.get. Otherwise, your modifications are lost. | 1 | 6 | 0 | Should the save method be called after every create method or does calling the create method automatically call the save method?
If the save method is called automatically after creating an object then what would be a good use-case for the save method?
Thanks. | When should the save method be called in Django? | 0.197375 | 0 | 0 | 2,139 |
6,534,117 | 2011-06-30T11:37:00.000 | 1 | 0 | 1 | 0 | python,multithreading | 6,534,936 | 2 | false | 0 | 0 | Can I continue to modifying the buffer in the calling thread without worrying if it will be affected in the saving thread?
You can if you use multiprocessing.Process instead of threading.Thread ... the process get's the data at the time of the Process.start() call via fork -- the data in one process cannot modify the ... | 2 | 4 | 0 | What are the semantics of data passed to threading.Thread.__init__()? Are they copied over and made local to the thread? Or, do they continue to be shared with the creating thread? The docs say that args is a tuple, so I assume it will be deep copied, but would like to make sure.
Basically, I'd like to dump a buffer pe... | Semantics of args passed to python threading.Thread __init__ | 0.099668 | 0 | 0 | 241 |
6,534,117 | 2011-06-30T11:37:00.000 | 3 | 0 | 1 | 0 | python,multithreading | 6,534,161 | 2 | true | 0 | 0 | Data are generally shared in Python unless you explicitly copy. Dumping a buffer from one thread while modifying it in another is not a safe operation unless the buffer itself has a thread-safe design. You need to synchronise access to the buffer somehow. | 2 | 4 | 0 | What are the semantics of data passed to threading.Thread.__init__()? Are they copied over and made local to the thread? Or, do they continue to be shared with the creating thread? The docs say that args is a tuple, so I assume it will be deep copied, but would like to make sure.
Basically, I'd like to dump a buffer pe... | Semantics of args passed to python threading.Thread __init__ | 1.2 | 0 | 0 | 241 |
6,535,062 | 2011-06-30T12:53:00.000 | 2 | 0 | 0 | 0 | python,google-app-engine,google-cloud-datastore,models | 6,543,279 | 3 | true | 1 | 0 | Adding methods to db.Model subclasses is perfectly fine practice. There's only any point in having your actual model subclass something that is itself a db.Model subclass if you have common functionality you want shared by several model classes - just like in standard inheritance.
I'm not sure how your proposed approac... | 1 | 1 | 0 | When working with classes that inherit db.Model, is it better practice to add methods, or should I instead create a separate class?
E.g., if I want to store information on posts, should I have Post extend db.Model, or should I have PostData extend db.Model and Post extend (or even reference?) PostData?
The difference, ... | Should I add methods to my classes that inherit db.Model, or should I inherit those classes into a new class? | 1.2 | 0 | 0 | 335 |
6,535,333 | 2011-06-30T13:16:00.000 | 0 | 0 | 0 | 0 | python,django,apache | 6,535,604 | 5 | false | 1 | 0 | When using apachectl graceful, you minimize the time the website is unavailable when 'restarting' Apache. All children are 'kindly' requested to restart and get their new configuration when they're not doing anything.
The USR1 or graceful signal causes the parent process to advise the children to exit after their curr... | 4 | 2 | 0 | I've a server when I run a Django application but I've a little problem:
when with mercurial I commit and pushing new changes on the server, there's a micro time (like 1 microsec) where the home page is unreachable.
I have apache on the server.
How can I solve this? | A question about sites downtime updates | 0 | 0 | 0 | 109 |
6,535,333 | 2011-06-30T13:16:00.000 | -1 | 0 | 0 | 0 | python,django,apache | 6,535,372 | 5 | false | 1 | 0 | i think it's normal, since django may be needing to restart its server after your update | 4 | 2 | 0 | I've a server when I run a Django application but I've a little problem:
when with mercurial I commit and pushing new changes on the server, there's a micro time (like 1 microsec) where the home page is unreachable.
I have apache on the server.
How can I solve this? | A question about sites downtime updates | -0.039979 | 0 | 0 | 109 |
6,535,333 | 2011-06-30T13:16:00.000 | 0 | 0 | 0 | 0 | python,django,apache | 6,538,942 | 5 | false | 1 | 0 | If you're at the point of complaining about a 1/1,000,000th of a second outage, then I suggest the following approach:
Front end load balancers pointing to multiple backend servers.
Remove one backend server from the loadbalancer to ensure no traffic will go to it.
Wait for all traffic that the server was processing ha... | 4 | 2 | 0 | I've a server when I run a Django application but I've a little problem:
when with mercurial I commit and pushing new changes on the server, there's a micro time (like 1 microsec) where the home page is unreachable.
I have apache on the server.
How can I solve this? | A question about sites downtime updates | 0 | 0 | 0 | 109 |
6,535,333 | 2011-06-30T13:16:00.000 | 1 | 0 | 0 | 0 | python,django,apache | 6,535,569 | 5 | false | 1 | 0 | If you have any significant traffic in time that is measured in microsecond it's probably best to push new changes to your web servers one at a time, and remove the machine from load balancer rotation for the moment you're doing the upgrade there. | 4 | 2 | 0 | I've a server when I run a Django application but I've a little problem:
when with mercurial I commit and pushing new changes on the server, there's a micro time (like 1 microsec) where the home page is unreachable.
I have apache on the server.
How can I solve this? | A question about sites downtime updates | 0.039979 | 0 | 0 | 109 |
6,535,373 | 2011-06-30T13:19:00.000 | 5 | 0 | 1 | 0 | python | 6,535,397 | 2 | false | 0 | 0 | Use >>. You are removing the sign anyway with the & 0xFF. Note, that you cannot leave out the & part, i.e., (n >> 8) & 0xff, or you'll get the wrong result, as you have already noted. | 1 | 0 | 0 | I'm 'hacking' my router, and I need to rewrite one JS function that takes date in hexdec format and convert it into Y m d
JS code looks like:
return [(((n >> 16) & 0xFF) + 1900), ((n >>> 8) & 0xFF), (n & 0xFF)];
where n is variable in format 0x123456 (e.g. 6 hexdec digits after 0x sign)
found that python has operator... | Special JS operators in python | 0.462117 | 0 | 0 | 664 |
6,536,862 | 2011-06-30T15:04:00.000 | 4 | 1 | 0 | 1 | python,fabric | 6,605,088 | 1 | true | 0 | 0 | you can just local() out and use rsync any way you want to. | 1 | 1 | 0 | Currently Fabric's 'rsync_projecct' requires a user and a host parameter to be specified. I'having a lot of issues copying user@127.0.0.1 because it is still asking me for the password for rsync. I've spent hours on this and am wondering if there is just a way to use the rsync [src] [dest] without having to specify... | Python's Fabric to use rsync locally, is it possible? | 1.2 | 0 | 0 | 1,806 |
6,537,727 | 2011-06-30T16:04:00.000 | 0 | 0 | 0 | 0 | python,file | 6,537,812 | 3 | false | 0 | 0 | You will have to read and write the whole file, since the rest of the contents of the file will have to be moved to accomodate for the differences in header size. | 2 | 8 | 0 | I am trying to write a python script to update the header (only the first line) of some huge files, but as the new header is not necessary to be the same size (in bytes) as the original one, is there anyway I could change the header without touching the rest of the huge file? or I have to read through them all and writ... | efficient way to change the header of a file in Python | 0 | 0 | 0 | 2,611 |
6,537,727 | 2011-06-30T16:04:00.000 | 1 | 0 | 0 | 0 | python,file | 6,537,804 | 3 | false | 0 | 0 | I'm not familiar with any OS that lets you remove arbitrary chunks of a file, so Python cannot give you that feature. I'm afraid you are stuck touching the rest of the huge file. | 2 | 8 | 0 | I am trying to write a python script to update the header (only the first line) of some huge files, but as the new header is not necessary to be the same size (in bytes) as the original one, is there anyway I could change the header without touching the rest of the huge file? or I have to read through them all and writ... | efficient way to change the header of a file in Python | 0.066568 | 0 | 0 | 2,611 |
6,538,018 | 2011-06-30T16:29:00.000 | 0 | 0 | 0 | 0 | python,security,apache,server-side | 6,538,060 | 1 | true | 0 | 0 | it is usually a good idea to put such information in an external config file which can't be served by the webserver directly and read this file in your script. in case of a configuration error the client might see your sourcecode but not the sensitive information | 1 | 0 | 0 | I've written a python script using selenium to imitate a browser logging in and buying some stuff from a website. Therefore, the python script contains log-in information along with payment information (checking account info, etc). If i configure my apache webserver to be able to execute python scripts, so that when ... | Security question relating to executing server-side script | 1.2 | 0 | 1 | 189 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.