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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9,958,102 | 2012-03-31T17:33:00.000 | 0 | 0 | 1 | 0 | python,regex | 14,452,880 | 4 | false | 0 | 0 | We can use this
re.split(" ", "fat-free milk") | 1 | 3 | 0 | In Python, re.split("\W+", "fat-free milk") yields ['fat', 'free', 'milk'].
How do I produce ['fat-free', 'milk'] from re.split()?
I understand the problem to be that hyphens are not alphanumeric characters, but I'm not sure how to incorporate this fact into the regex. I have tried re.split("[(^\-)\W]+", "fat-free milk... | How do I split words in Python while keeping in consideration words with hyphens? | 0 | 0 | 0 | 1,856 |
9,960,524 | 2012-03-31T23:12:00.000 | 2 | 0 | 0 | 0 | python,django,django-views | 9,960,664 | 4 | false | 1 | 0 | You could subclass RequestContext in django.template.context and redefine its __init__ method. You can then use this modified RequestContext in those particular views. The __init__ of RequestContext currently looks like this:
def __init__(self, request, dict=None, processors=None, current_app=None, use_l10n=None):
... | 1 | 0 | 0 | I have a website with a menu. To generate the menu, I need some queries in the database. So I created a context processor to do it in all my views.
Some of the views I have are actually forms. I get them using ajax and display them with jquery ui dialog, when my users click on some buttons.
I can't remove all context p... | Django, exclude a context processor in a view | 0.099668 | 0 | 0 | 2,637 |
9,960,583 | 2012-03-31T23:24:00.000 | 3 | 0 | 1 | 1 | python,installation,cross-platform,python-3.2 | 9,960,652 | 5 | false | 0 | 0 | Python is an interpreted, not a compiled language. So any standalone program you may want to distribute must bundle the entire interpreter inside it plus the libraries you used. This will result in an enormous file size for a single program. Also, this huge install cannot be used to run other python programs. An only m... | 1 | 15 | 0 | Im new to python, but I was thinking about making a program with python to give to my friends.
They don't know much about computers so if I asked them to install python by them selves they couldn't do it, but what if I could make an installer that downloads some version of python that only has what is needed for my fil... | How do you make an installer for your python program | 0.119427 | 0 | 0 | 28,302 |
9,960,675 | 2012-03-31T23:45:00.000 | 11 | 0 | 1 | 0 | python,dictionary,namedtuple | 9,960,784 | 2 | true | 0 | 0 | From an API viewpoint, probably not much, though:
namedtuple keys are always strings with some limitations:
Any valid Python identifier may be used for a fieldname except for
names starting with an underscore. Valid identifiers consist of
letters, digits, and underscores but do not start with a digit or
unders... | 1 | 5 | 0 | I know there is no frozen dict data type but If there was one how would it be different from namedtuple. It seems to me that namedtuple performs the required operations but obviously it does not. So what are the differences? | Difference between namedtuple and a frozen dict | 1.2 | 0 | 0 | 1,536 |
9,961,190 | 2012-04-01T01:28:00.000 | 5 | 1 | 1 | 0 | python,eclipse,pydev | 9,961,465 | 1 | false | 0 | 0 | File > Import > "General" Folder > "File System" Folder > "Browse" button | 1 | 3 | 0 | I've recently started using eclipse for my class over IDLE. So far I have no problems writing new code and creating new projects in eclipse.
However, when I open older code that was not originally written in my current project, eclipse seems to only open it as a text file.
For example, when I want to run a piece of co... | Python: Import Source Code into Eclipse | 0.761594 | 0 | 0 | 5,598 |
9,961,357 | 2012-04-01T02:03:00.000 | 12 | 0 | 0 | 1 | python,reload,tornado,restart | 9,961,405 | 2 | true | 0 | 0 | If you are looking for automatic reloading of .py files during development. In your tornado.web.Application() put debug=True after your handlers.
I don't think you should do this in production environment, because such implementation typically use a background thread to actively scan files for changes, which may slow d... | 1 | 12 | 0 | I just start learning Python + Tornado for my web servers. Every time I modify some code on my python scripts or templates I have to stop the in my terminal (CTRL+C) and restart it (python server.py) and I want a more effective way to do this, that after modifying code in some files the server automatically restarts.
P... | Python + Tornado Restart after editing files | 1.2 | 0 | 0 | 6,556 |
9,961,456 | 2012-04-01T02:30:00.000 | 0 | 0 | 0 | 0 | python,wxpython,wxwidgets | 9,963,895 | 2 | false | 0 | 1 | Create a new control by inheritance from the slider. The only change from the base slider control is that you override the method that handles mouse click events, Your method needs to do two things: call the routine that you use to 'skip the video to the mouse click' and call the base slider control mouse click handl... | 1 | 3 | 0 | I wish to emulate or most media players' sliders - where clicking anywhere on the slider widget skips the video to that position. How can I get the slider's value under the mouse click and set the value to that?
By default, when clicked on the slider, it only scrolls by a Pagesize at a time, not scrolls to the position... | Get wxpython slider's value under mouse click | 0 | 0 | 0 | 1,615 |
9,963,806 | 2012-04-01T10:51:00.000 | 0 | 0 | 0 | 0 | python | 9,965,553 | 1 | false | 0 | 1 | Import tkinter as you would usually do so, and create your popup. It would be best to stay within pygame though, using tkinter and pygame would end up being pretty complicated. | 1 | 0 | 0 | I need to have a pygame window check if the user right clicked (I can do) and then make a popup menu to display options using TKinter (?). Is this possible? | Pygame using TKinter to make a popup menu? | 0 | 0 | 0 | 338 |
9,965,062 | 2012-04-01T14:18:00.000 | 1 | 0 | 0 | 0 | python,treeview,web | 9,965,972 | 2 | true | 1 | 0 | This isn't really a python or django issue: presentation on the web is done using (X)HTML, other types of XML (such as SVG), and javascript to automate the client side.
Go ahead and use django for your project, but understand that to do this, you will need to also get the hang of (at least) a javascript library for thi... | 2 | 0 | 0 | I'm new to Python and web development (although I have development experience with Client/Server apps .. a little rusty), and I need to build a Python web application that populates an interactive tree from a database (for my PG degree).
I've tried PyQT4 which contains a QTreeView/QTreeWidget but couldn't run this form... | Building a tree in a web app using Python | 1.2 | 0 | 0 | 1,635 |
9,965,062 | 2012-04-01T14:18:00.000 | 0 | 0 | 0 | 0 | python,treeview,web | 9,965,636 | 2 | false | 1 | 0 | google django treeview for a few implementations. Alternativly use JavaScript. Django and Javascript play nicely and there are loads of JavaScript Treeview implementations. | 2 | 0 | 0 | I'm new to Python and web development (although I have development experience with Client/Server apps .. a little rusty), and I need to build a Python web application that populates an interactive tree from a database (for my PG degree).
I've tried PyQT4 which contains a QTreeView/QTreeWidget but couldn't run this form... | Building a tree in a web app using Python | 0 | 0 | 0 | 1,635 |
9,965,725 | 2012-04-01T15:41:00.000 | 0 | 0 | 1 | 1 | python,google-app-engine,shared-libraries | 9,965,775 | 2 | false | 0 | 0 | The deploy tools for Google App Engine (in the Python world at least) don't know anything about shared projects in Eclipse. You point the deploy script to a folder and that's about it.
You can create a script that will copy the projects into a deploy folder and deploy that folder. | 2 | 2 | 0 | I want to share some modules between a python GAE project, and another python project but want to use the same source files so that I can change them without having to worry about keeping the source files in each project up to date.
Is there a way to let two python projects share the same source files outside of their ... | Is it possible to have shared python library in GAE? | 0 | 0 | 0 | 161 |
9,965,725 | 2012-04-01T15:41:00.000 | 4 | 0 | 1 | 1 | python,google-app-engine,shared-libraries | 9,968,299 | 2 | true | 0 | 0 | IF your dev environment is linux, you can use symlinks in your project folder to the shared source. The deployment will treat the symlinks as actual files/folders. | 2 | 2 | 0 | I want to share some modules between a python GAE project, and another python project but want to use the same source files so that I can change them without having to worry about keeping the source files in each project up to date.
Is there a way to let two python projects share the same source files outside of their ... | Is it possible to have shared python library in GAE? | 1.2 | 0 | 0 | 161 |
9,965,881 | 2012-04-01T16:02:00.000 | 3 | 0 | 1 | 1 | python | 9,965,932 | 4 | false | 0 | 0 | You cannot do this without cooperation with operating system. Whatever you do, Ctrl-Alt-Del will allow the user to circumvent your lock. | 3 | 0 | 0 | Is there any way I can create a UAC-like environment in Python? I want to basically lock the workstation without actually using the Windows lock screen. The user should not be able to do anything except, say, type a password to unlock the workstation. | Take all input in Python (like UAC) | 0.148885 | 0 | 0 | 507 |
9,965,881 | 2012-04-01T16:02:00.000 | 1 | 0 | 1 | 1 | python | 9,968,755 | 4 | false | 0 | 0 | I would try with pygame, because it can lock mouse to itself and thus keep all input to itself, but i wouldn't call this secure without much testing, ctr-alt-del probably escape it, can't try on windows right now.
(not very different of Bryan Oakley's answer, except with pygame) | 3 | 0 | 0 | Is there any way I can create a UAC-like environment in Python? I want to basically lock the workstation without actually using the Windows lock screen. The user should not be able to do anything except, say, type a password to unlock the workstation. | Take all input in Python (like UAC) | 0.049958 | 0 | 0 | 507 |
9,965,881 | 2012-04-01T16:02:00.000 | 1 | 0 | 1 | 1 | python | 9,966,066 | 4 | true | 0 | 0 | You might be able to get the effect you desire using a GUI toolkit that draws a window that covers the entire screen, then do a global grab of the keyboard events. I'm not sure if it will catch something like ctrl-alt-del on windows, however.
For example, with Tkinter you can create a main window, then call the overrid... | 3 | 0 | 0 | Is there any way I can create a UAC-like environment in Python? I want to basically lock the workstation without actually using the Windows lock screen. The user should not be able to do anything except, say, type a password to unlock the workstation. | Take all input in Python (like UAC) | 1.2 | 0 | 0 | 507 |
9,968,040 | 2012-04-01T20:29:00.000 | 4 | 0 | 0 | 0 | python,google-app-engine,video,mp3 | 9,968,088 | 3 | true | 1 | 0 | You don't want todo this in Python, video convert requires working native modules which the App Engine doesn't support.
You can try to work 3rd party web service that do the convert for you, or send the convert task to an external server. | 2 | 3 | 0 | I'm working on a project, using Python running on Google App Engine. The project must allow users to upload video file then convert these files into mp3 audio file. Is there a way to convert this video to mp3/wav audio?
Could anyone offer a solution to this? Thanks in advance. | Convert video(any type) to audio -mp3 format- using python | 1.2 | 0 | 0 | 3,509 |
9,968,040 | 2012-04-01T20:29:00.000 | 2 | 0 | 0 | 0 | python,google-app-engine,video,mp3 | 9,968,089 | 3 | false | 1 | 0 | You're going to have trouble doing this on GAE, as libraries with native components aren't necessarily available there; it may well not be possible at all.
If targeting a more typical Python app server environment, rather than GAE, I would do this using the GStreamer Python bindings; GStreamer lets you set up a media p... | 2 | 3 | 0 | I'm working on a project, using Python running on Google App Engine. The project must allow users to upload video file then convert these files into mp3 audio file. Is there a way to convert this video to mp3/wav audio?
Could anyone offer a solution to this? Thanks in advance. | Convert video(any type) to audio -mp3 format- using python | 0.132549 | 0 | 0 | 3,509 |
9,969,649 | 2012-04-02T00:38:00.000 | 2 | 0 | 1 | 0 | list,python-3.x,tuples | 67,201,077 | 3 | false | 0 | 0 | In Python, there are two types of data structures: list and tuple. The list has dynamic properties, while the tuple has static ones.
In other languages, lists are declared similarly to arrays. Lists don't have to be homogeneous all of the time, which makes it Python's most effective tool. The list is a type of containe... | 2 | 8 | 0 | I have known for a while that the primary difference between lists and tuples in Python is that lists are mutable and tuples are not. Beyond that and the different methods available to them, I know very little about lists and tuples. Is there any other difference between them? Are there any advantages/disadvantages ... | Difference between list and tuple (minus immutability) in Python? | 0.132549 | 0 | 0 | 3,307 |
9,969,649 | 2012-04-02T00:38:00.000 | 7 | 0 | 1 | 0 | list,python-3.x,tuples | 10,296,694 | 3 | true | 0 | 0 | Both lists and tuples are internally implemented as arrays of references to the element objects. This way, both can be indexed and both require the same amount of memory for each element. Internally, they are both homogeneous (untyped references). Logically, they are both heterogeneous (automatic dereferencing, the ... | 2 | 8 | 0 | I have known for a while that the primary difference between lists and tuples in Python is that lists are mutable and tuples are not. Beyond that and the different methods available to them, I know very little about lists and tuples. Is there any other difference between them? Are there any advantages/disadvantages ... | Difference between list and tuple (minus immutability) in Python? | 1.2 | 0 | 0 | 3,307 |
9,969,863 | 2012-04-02T01:17:00.000 | 5 | 0 | 1 | 0 | python | 9,969,876 | 3 | true | 0 | 0 | If it requires a filename, then you're going to have to create a file. (And that's poor design on the part of the library creators.) | 1 | 5 | 0 | I am beginner in python, and I need to use some thirdparty function which basically has one input - name of a file on a hard drive. This function parses file and then proceses it.
I am generating file contents in my code (it's CSV file which I generate from a list) and want to skip actual file creation. Is there any wa... | python: pass string instead of file as function parameter | 1.2 | 0 | 0 | 4,431 |
9,970,598 | 2012-04-02T03:35:00.000 | 0 | 0 | 0 | 0 | python,django,apache2,mod-wsgi | 9,971,145 | 4 | false | 1 | 0 | Delete any .pyc files from your code base directory, and restart the server. | 3 | 1 | 0 | I'm running mod_wsgi on apache2. It's running Django and for some reason, after I change my code, old versions are sometimes shown along with new code.
For example, after creating a view that simply returns an Http Response with "Hi", I get either the Django start page or "Hi".
Any ideas what would cause this?
Thanks. | mod_wsgi showing old code | 0 | 0 | 0 | 559 |
9,970,598 | 2012-04-02T03:35:00.000 | 2 | 0 | 0 | 0 | python,django,apache2,mod-wsgi | 9,970,706 | 4 | true | 1 | 0 | apache2/mod_wsgi keeps parts of the application loaded between requests. You have to restart the server after code updates. | 3 | 1 | 0 | I'm running mod_wsgi on apache2. It's running Django and for some reason, after I change my code, old versions are sometimes shown along with new code.
For example, after creating a view that simply returns an Http Response with "Hi", I get either the Django start page or "Hi".
Any ideas what would cause this?
Thanks. | mod_wsgi showing old code | 1.2 | 0 | 0 | 559 |
9,970,598 | 2012-04-02T03:35:00.000 | 0 | 0 | 0 | 0 | python,django,apache2,mod-wsgi | 9,970,690 | 4 | false | 1 | 0 | This could possibly be your browser caching responses from the server. Try disabling caching to see if that has any affect. Even if it doesn't now, doing so can potentially save you a lot of grief and confusion in the future. | 3 | 1 | 0 | I'm running mod_wsgi on apache2. It's running Django and for some reason, after I change my code, old versions are sometimes shown along with new code.
For example, after creating a view that simply returns an Http Response with "Hi", I get either the Django start page or "Hi".
Any ideas what would cause this?
Thanks. | mod_wsgi showing old code | 0 | 0 | 0 | 559 |
9,974,465 | 2012-04-02T10:09:00.000 | 2 | 0 | 0 | 0 | python,django,wsgi,django-wsgi | 9,974,529 | 2 | true | 1 | 0 | Run the app inside a virtualenv. | 1 | 0 | 0 | I have an application that uses Django 1.3 installed in python's site-packages. I want to create another copy of it (WSGI under Apache) but make it use a newer version of Django I've unpacked alongside to see if any input is required before I'm able to migrate to 1.4.
Is there a way to somehow specify where WSGI should... | Running WSGI application with a different version of Django to what's installed in python site-packages? | 1.2 | 0 | 0 | 181 |
9,974,611 | 2012-04-02T10:18:00.000 | 1 | 1 | 1 | 0 | python,zeromq,pyzmq | 9,975,162 | 2 | false | 0 | 0 | Are you sure that zmq is installed on computer?
If not then try installing it. In ubuntu it is quite easy
sudo apt-get install python-zmq | 1 | 0 | 0 | I have a zmq directory in cwd . when i import zmq from a python file running under apache it gives me import error. but when i import zmq using console from current directory it imports.
How to make this import possible from anywhere in my server? | python import error when importing zmq | 0.099668 | 0 | 0 | 2,387 |
9,976,293 | 2012-04-02T12:19:00.000 | 0 | 0 | 1 | 0 | python,algorithm | 9,978,452 | 2 | false | 0 | 0 | How about representing the times a switch is enabled as a list of minutes of the day when a switch is enabled, e.g. A=[600, 601, 602, ..., 659, ..., ], where 10am corresponds to minute 600 in the day. Convert the lists to sets and use a sum of the intersections. | 1 | 2 | 0 | I've been thinking hard for a long time but couldn't work this out. Consider the following sequences over time, which records the status of switches:
A = [(10:00, 1), (11:00, 0), (12:00, 1), (12:30, 0),..., (23:00, 1)] # switch A is on at 10:00, off at 11:00 and so on
B = [(10:30, 1), (11:15, 0), (11:30, 1), (12:15, 0)... | calculate amount of time intersection when all sequences fulfill certain criteria? | 0 | 0 | 0 | 163 |
9,977,888 | 2012-04-02T14:00:00.000 | 0 | 0 | 0 | 0 | php,python,database,windows,linux | 9,978,197 | 2 | false | 0 | 0 | You can't.
It looks that there is no way to identify the file: neither by content nor by pathname.
One workaround might be: use path as id (and use them as reference in the DB) and do not use system tools (like mv) to move files but your own script which updates the file system and the database. | 1 | 0 | 0 | I'm trying to implement an script that reads the content(files and folders) of a certain directory and writes it in a database. My goal is create an software that allows me to organize those files and folders relating description and tags to them, without affecting the correspondig physical files in the disk.
But for n... | How to link a file to a database? | 0 | 1 | 0 | 114 |
9,978,862 | 2012-04-02T15:08:00.000 | 0 | 0 | 0 | 0 | javascript,python,ironpython,client-side | 9,979,094 | 3 | false | 1 | 0 | Given the server limitation, I would run those scripts locally to generate HTML, and push that static output onto your server. | 1 | 0 | 0 | I have a small website hosted by my university. The policy is that no server side scripting language (e.g. PHP, etc.) is enabled, hence websites are either static or can use client side scripting (e.g. javascript, etc.). I also can't touch the server/configure it/install things.
Anyway, I wanted to add some data from o... | Alternative to a server side scripting language for scraping | 0 | 0 | 1 | 682 |
9,979,326 | 2012-04-02T15:38:00.000 | 0 | 0 | 0 | 0 | python,frameworks,web-frameworks | 9,979,501 | 8 | false | 1 | 0 | Python works well using CGI.
that's the simplest thing you can do: it only needs apache and a working python environment, and is the closest to a standard php setup.
remember that, when using CGI, your python script is responsible for outputting the necessary HTTP headers (sys.stdout.write('Content-Type: text/html\n\n... | 3 | 8 | 0 | I would like to know if there is a way to create web pages without a huge framework in python.
I think of something like PHP/Apache, which comes just as a language and not with to much overhead (but I don't like PHP...). In PHP there is no ORM, no template engine, etc. But it is very very easy to just print a Hello Wor... | Python: How to create simple web pages without a huge framework? | 0 | 0 | 0 | 18,361 |
9,979,326 | 2012-04-02T15:38:00.000 | 1 | 0 | 0 | 0 | python,frameworks,web-frameworks | 9,979,395 | 8 | false | 1 | 0 | I'm not sure what's wrong with django flatpages for your purposes.
Another alternative would be to replace the django template system with something more powerful, like jinja, so you can write your tag soup and do processing there, with minimal logic in the view.
In practice (given that you already know django), that i... | 3 | 8 | 0 | I would like to know if there is a way to create web pages without a huge framework in python.
I think of something like PHP/Apache, which comes just as a language and not with to much overhead (but I don't like PHP...). In PHP there is no ORM, no template engine, etc. But it is very very easy to just print a Hello Wor... | Python: How to create simple web pages without a huge framework? | 0.024995 | 0 | 0 | 18,361 |
9,979,326 | 2012-04-02T15:38:00.000 | 4 | 0 | 0 | 0 | python,frameworks,web-frameworks | 9,979,487 | 8 | false | 1 | 0 | I've used Flask (and bottle.py) in the past, but these days I actually prefer Pyramid, from the Pylons folks.
Pyramid is capable of being a large, full-fledged framework, is designed for flexibility, and has no shortage of plugins and extensions available adding additional functionality -- but it also is capable of sma... | 3 | 8 | 0 | I would like to know if there is a way to create web pages without a huge framework in python.
I think of something like PHP/Apache, which comes just as a language and not with to much overhead (but I don't like PHP...). In PHP there is no ORM, no template engine, etc. But it is very very easy to just print a Hello Wor... | Python: How to create simple web pages without a huge framework? | 0.099668 | 0 | 0 | 18,361 |
9,979,602 | 2012-04-02T15:55:00.000 | 23 | 0 | 1 | 0 | python | 9,979,626 | 10 | true | 0 | 0 | Put them in a list, sort them, pick the middle one. | 1 | 8 | 0 | Given 3 numbers, I need to find which number lies between the two others.
ie,given 3,5,2
I need 3 to be returned.
I tried to implement this by going thru all three and using if else conditions to check if each is between the other two.But this seems a naive way to do this.Is there a better way? | how to find the middle number in python | 1.2 | 0 | 0 | 55,236 |
9,980,270 | 2012-04-02T16:37:00.000 | 1 | 0 | 0 | 0 | python,image-processing,binary | 9,982,670 | 4 | false | 0 | 0 | A combination of erosion and dilation (and vice versa) on a binary image can help to get rid of salt n pepper like noise leaving small lines intact. Keywords are 'rank order filters' and 'morphological filters'. | 1 | 0 | 1 | I have a binary image with contour lines and need to purify each contour line of all unnecessary pixels, leaving behind a minimally connected line.
Can somebody give me a source, code example or further information for this kind of problem and where to search for help, please? | Thinning contour lines in a binary image | 0.049958 | 0 | 0 | 6,610 |
9,980,517 | 2012-04-02T16:57:00.000 | 1 | 0 | 1 | 0 | python,web-crawler,python-2.7 | 9,980,811 | 3 | true | 0 | 0 | You could create a class that has an index number of the line from seed_list.txt, the URL, and where the data from the web. An object of this type can be created with the line number and URL, then it is passed to the worker thread which will put the data into the object, and then the object is passed to a write thread ... | 3 | 2 | 0 | I am writing a web crawler that processes multiple URLs at the same time and works in the following way:
It gets a URL from a list of URLs included in seed_list.txt,
It crawls it and write the data into data.txt;
just like how most of web crawlers work.
When I make it single-threaded, I can get the data in data.txt ... | Processing Order of Python's Threading Module | 1.2 | 0 | 1 | 167 |
9,980,517 | 2012-04-02T16:57:00.000 | 2 | 0 | 1 | 0 | python,web-crawler,python-2.7 | 9,980,555 | 3 | false | 0 | 0 | Create an additional thread that is responsible for enumerating results from each of the crawler threads. | 3 | 2 | 0 | I am writing a web crawler that processes multiple URLs at the same time and works in the following way:
It gets a URL from a list of URLs included in seed_list.txt,
It crawls it and write the data into data.txt;
just like how most of web crawlers work.
When I make it single-threaded, I can get the data in data.txt ... | Processing Order of Python's Threading Module | 0.132549 | 0 | 1 | 167 |
9,980,517 | 2012-04-02T16:57:00.000 | 1 | 0 | 1 | 0 | python,web-crawler,python-2.7 | 9,980,948 | 3 | false | 0 | 0 | You can run a special thread which outputs data and interact with it through a queue. I mean your 'crawling' thread will not write a result to a text file but put it to the queue.
This 'output' thread can sort/filter your results. | 3 | 2 | 0 | I am writing a web crawler that processes multiple URLs at the same time and works in the following way:
It gets a URL from a list of URLs included in seed_list.txt,
It crawls it and write the data into data.txt;
just like how most of web crawlers work.
When I make it single-threaded, I can get the data in data.txt ... | Processing Order of Python's Threading Module | 0.066568 | 0 | 1 | 167 |
9,986,059 | 2012-04-03T01:38:00.000 | 0 | 1 | 0 | 1 | python,security,passwords,pipe | 9,986,152 | 2 | false | 0 | 0 | Tough problem. If you have access to source code of the program in question, you can change argv[0] after startup. On most flavors of *nix, this will work.
The config file approach may be better from a security perspective.
If the config file can be specified at run time, you could generate a temp file (see mkstemp), w... | 2 | 0 | 0 | I have a program (not written by me) that I would like to use. It authenticates to an online service using a username and password that I would like to keep private. The authentication information may be passed to the program in two ways: either directly as command-line arguments or via a plaintext configuration file, ... | Securely passing credentials to a program via plaintext file or command line | 0 | 0 | 0 | 1,344 |
9,986,059 | 2012-04-03T01:38:00.000 | 0 | 1 | 0 | 1 | python,security,passwords,pipe | 9,986,183 | 2 | false | 0 | 0 | About the only thing you can do in this situation is store the credentials in a text file and then deny all other users of the machine permissions to read or write it. Create a user just for this script, in fact. Encrypting doesn't do much because you still have to have the key in the script, or somewhere the script ca... | 2 | 0 | 0 | I have a program (not written by me) that I would like to use. It authenticates to an online service using a username and password that I would like to keep private. The authentication information may be passed to the program in two ways: either directly as command-line arguments or via a plaintext configuration file, ... | Securely passing credentials to a program via plaintext file or command line | 0 | 0 | 0 | 1,344 |
9,987,913 | 2012-04-03T06:06:00.000 | -6 | 0 | 1 | 0 | python,regex | 9,987,948 | 5 | false | 0 | 0 | Use [a-zA-Z] to match all the alphabet characters. | 1 | 8 | 0 | I'm looking for the equivalent of [\w]&&[^\d] (Of course && is not a regex operator).
The regex needs to match ONLY words made up of UTF8 "alphabet" characters. Does anyone have any ideas? | What Python regex matches all alphabet characters but no numbers? [unicode aware] | -1 | 0 | 0 | 16,695 |
9,988,578 | 2012-04-03T07:01:00.000 | 2 | 1 | 1 | 0 | python | 9,988,597 | 2 | true | 0 | 0 | can mighty Python do it for me?
No, you have to do it yourself (by having every instance of B keep a reference to the corresponding instance of A). | 1 | 1 | 0 | Assuming I have a instance of class A (name it AI)
that has an instance of class B (name it BI).
Can a reference to BI (somewhere else) tell me that it is part of AI?
I don't talk about inheritance/parent class.
I know I can do this by implementing a reference to A
in the constructor of B - but can mighty Python do it ... | Get containing python class from element | 1.2 | 0 | 0 | 429 |
9,990,358 | 2012-04-03T09:15:00.000 | 1 | 0 | 0 | 1 | python,dll,windows-7,pylucene | 10,012,400 | 1 | true | 0 | 0 | The answer is probably, that if something like that happens to you, there is a wrong DLL somewhere in the path that is called first (and puttting the DLL in system32 ensures it is first).
So if you put the relevant DLL in your PATH - make sure it is the first (or look into each element to find out who is getting ahead ... | 1 | 0 | 0 | Finally I managed to get pylucene working on my windows7 machine,
Which raised a more general question:
How come that when I have a dll on a directory in the path, python couldn't find it,
and when I put the dll in c:\windows\system32 - it did work?
Using windows 7 32 bit | dll in a different directory than c:\windows\system32 | 1.2 | 0 | 0 | 239 |
9,991,838 | 2012-04-03T10:56:00.000 | 4 | 0 | 1 | 0 | python,linux,shell,ipython,line-breaks | 9,991,864 | 3 | true | 0 | 0 | Nothing is the problem. Python code is executed line-by-line.
If your code does not work when executed line-by-line, it should not work when loaded from a file (assuming in both cases a "clean" environment). | 2 | 8 | 0 | Hi I'm new to Linux and I really like the idea of writing and testing python code in a shell. But my problem is how can I do line breaks in IPython. Every time I use the (I think) "normal" shortcut shift+enter the code gets executed. Function keys are disabled and keyboard layout works fine on my laptop, what could be ... | Linux - Linebreak in IPython | 1.2 | 0 | 0 | 7,327 |
9,991,838 | 2012-04-03T10:56:00.000 | 7 | 0 | 1 | 0 | python,linux,shell,ipython,line-breaks | 9,992,118 | 3 | false | 0 | 0 | If you want to do a line-break, you end the line with the \ escape character, same as you do in a Python file. Shift+Enter doesn't have any special meaning in ipython, and indeed most over places in the shell. It doesn't have special meaning in Python, either.
It does have special meaning in some text editors and word ... | 2 | 8 | 0 | Hi I'm new to Linux and I really like the idea of writing and testing python code in a shell. But my problem is how can I do line breaks in IPython. Every time I use the (I think) "normal" shortcut shift+enter the code gets executed. Function keys are disabled and keyboard layout works fine on my laptop, what could be ... | Linux - Linebreak in IPython | 1 | 0 | 0 | 7,327 |
9,991,854 | 2012-04-03T10:57:00.000 | 0 | 0 | 0 | 0 | python,unicode,utf-8,sqlite | 9,991,929 | 1 | false | 1 | 0 | You should .decode with the correct encoding. In this case Latin 1 or CP1252. »ö« is obviously not 0xf6 in UTF-8 so why should it work? | 1 | 0 | 0 | I am requesting a web page and want to cache the page data as a raw html string. (First I escaped the data string) I use sqlite3 to save my data on. When I tried give the byte_string in dictionary, or tuple, using placeholders in request, it raise "Programming Error" saying to convert the application to use unicode str... | How to convert a stringbyte(raw html string) to sqlite3 TEXT supporting unicode in Python | 0 | 1 | 0 | 241 |
9,993,899 | 2012-04-03T13:06:00.000 | 1 | 1 | 1 | 0 | python,plugins,adhoc | 9,993,949 | 2 | true | 0 | 0 | You can simply import the modules (use the __import__ function), and reload them when they change.
Note that you will still have the issue that existing instances of classes will not automagically change to reflect the new class definition. | 1 | 0 | 0 | I currently have a python script that runs every few minutes and picks up "rules", in my case python classes, within files in a directory tree. for each class it can load it runs "execute()" and in this way lets me do useful things like monitor log files and so on.
I'm now revisiting the script to make it self document... | Can someone recommend a pythonic approach to loading adhoc code? | 1.2 | 0 | 0 | 134 |
9,994,397 | 2012-04-03T13:33:00.000 | 2 | 0 | 1 | 0 | python,eclipse,pydev | 9,995,341 | 3 | false | 0 | 0 | While I don't know how to increase the delay, here's a throwing-the-baby-out-with-the-bathwater workaround:
In Preferences/Pydev/Editor/Hover, uncheck Show docstrings?. Then you won't get any popups when hovering. | 2 | 2 | 0 | When moving the mouse cursor over the python source in Pydev/eclipse, a hint-window emerges with short documentation of the function or variable hovered over. While in itself this is a handy function, it is way to fast and causing me difficulties to position the cursor for inserting code. How can I increase the delay a... | pyDev-Eclipse: how to delay the hints | 0.132549 | 0 | 0 | 195 |
9,994,397 | 2012-04-03T13:33:00.000 | 0 | 0 | 1 | 0 | python,eclipse,pydev | 10,009,926 | 3 | false | 0 | 0 | This is a system wide setting.
On Windows it can be modifying by editing registry entry HKEY_CURRENT_USER\Control Panel\Mouse\MouseHoverTime. | 2 | 2 | 0 | When moving the mouse cursor over the python source in Pydev/eclipse, a hint-window emerges with short documentation of the function or variable hovered over. While in itself this is a handy function, it is way to fast and causing me difficulties to position the cursor for inserting code. How can I increase the delay a... | pyDev-Eclipse: how to delay the hints | 0 | 0 | 0 | 195 |
9,994,566 | 2012-04-03T13:43:00.000 | 4 | 0 | 1 | 0 | python,multiprocessing,zeromq,gevent,pyzmq | 10,001,944 | 2 | false | 0 | 0 | Multiprocessing will clearly have much higher memory overhead but will utilize another core (and you don't have to worry about lack of pre-emption) so.. it depends on your needs.
It's likely that multiple processes using gevent will get you the highest throughput / lowest latency. | 2 | 4 | 0 | Currently I am using zeromq with pub-sub pattern, I have single worker to publish and many(8) subscriber (all will subscribe) to same pattern.
Now I tried multiprocessing to spawn subscribers it works. I am missing few messages.
Why I am using multiprocessing is to handle each message as it arrives and process them, ... | Multiprocessing vs gevent | 0.379949 | 0 | 0 | 2,824 |
9,994,566 | 2012-04-03T13:43:00.000 | 4 | 0 | 1 | 0 | python,multiprocessing,zeromq,gevent,pyzmq | 10,206,276 | 2 | false | 0 | 0 | I am answering my own question
I choose multiprocessing over gevent
Server had 8 cores
Parallelism was needed
Choose ZMQ over multiprocessing queue or gevent queue. | 2 | 4 | 0 | Currently I am using zeromq with pub-sub pattern, I have single worker to publish and many(8) subscriber (all will subscribe) to same pattern.
Now I tried multiprocessing to spawn subscribers it works. I am missing few messages.
Why I am using multiprocessing is to handle each message as it arrives and process them, ... | Multiprocessing vs gevent | 0.379949 | 0 | 0 | 2,824 |
9,995,041 | 2012-04-03T14:10:00.000 | 1 | 0 | 0 | 0 | python,django | 9,995,337 | 3 | false | 1 | 0 | I certainly use class methods, and I have found that where there are similar operations to be performed on classes, it is possible (and easy) to factor the classmethods into base classes (use the self parameter of your class method to write generic code).
Probably the best way to manage broken-up views, etc is to repla... | 2 | 4 | 0 | I have a Django project which is getting more and more complex. I started off with the traditional files: models, views, and forms.py. The issue I have right now is that those files are getting bigger and bigger and I'd like to break them into manageable parts. What are the best practices around that?
In addition, I am... | How to structure complex Django project? | 0.066568 | 0 | 0 | 1,093 |
9,995,041 | 2012-04-03T14:10:00.000 | 2 | 0 | 0 | 0 | python,django | 9,997,876 | 3 | true | 1 | 0 | I find refactoring can really help. Are there a lot of similar views that just have different templates or querysets? Make a more generic view that accepts multiple template names, records, etc.
Anything that requires extensive calculations gets moved to a utils.py in the same directory.
Class methods are for actions t... | 2 | 4 | 0 | I have a Django project which is getting more and more complex. I started off with the traditional files: models, views, and forms.py. The issue I have right now is that those files are getting bigger and bigger and I'd like to break them into manageable parts. What are the best practices around that?
In addition, I am... | How to structure complex Django project? | 1.2 | 0 | 0 | 1,093 |
9,996,095 | 2012-04-03T15:05:00.000 | 0 | 0 | 1 | 0 | python | 14,462,682 | 5 | false | 0 | 0 | If in case you can use sed then you can do this way from command line
sed -re 's/,*$//g' temp.csv | 1 | 4 | 0 | I've got a csv file and whenever i access the elements it gets me
aapl,2001-12-4,,,,,
The commas at the end is causing my functions to not work properly for my other application. How can I remove this in order to get rid of any additional commas after elements?
for example the above after correction would be
aaple,2001... | Get rid of extra commas from excel file with python | 0 | 0 | 0 | 3,966 |
9,996,105 | 2012-04-03T15:06:00.000 | 0 | 1 | 0 | 0 | python,python-imaging-library,python-c-extension | 9,996,422 | 2 | false | 0 | 1 | C-level bindings for PIL are available, but there is very little documentation for them. You will need to consult the source for usage information. | 1 | 4 | 0 | What is the most efficient way in terms of speed to access the pixel data of a PIL image from a C extension? I only need read-only access to it, if that makes a difference. | Accessing PIL image data from C extension | 0 | 0 | 0 | 456 |
9,996,435 | 2012-04-03T15:23:00.000 | 1 | 1 | 0 | 0 | c#,.net,python,user-interface | 9,999,447 | 2 | true | 0 | 1 | It sounds like you might be looking for a test automation tool, to script GUI events. I looked into using Ranorex for that a while back, and it looked very capable, but it was too expensive and overkill for my needs. | 1 | 0 | 0 | I am writing my own GUI with .NET (C#) and I want to use a python script to click buttons for me automatically and read from text boxes etc. I've tried the Google searches but nothing really helpful. Is there a library that I need to download for .NET or is there a module in python that will do what i"m looking for. I'... | Python script to control GUI? | 1.2 | 0 | 0 | 793 |
9,998,274 | 2012-04-03T17:23:00.000 | 5 | 0 | 0 | 0 | python,tkinter,keyboardinterrupt | 10,067,034 | 1 | true | 0 | 1 | from the newsgroups:
I'm using Python 1.5 under Redhat Linux 5.0. I'm trying to figure out
the best way to trap a SIGINT (or Ctrl-C) when using tkinter. To
illustrate the problem I have, do the following ...
-- Build Python-1.5 with tkinter enabled.
-- Go into the Demo/tkinter/guido directory under the Python-1.5 ... | 1 | 6 | 0 | I have a GUI application written with python+tkinter. In my workflow, I generally start the gui from the commandline, do some things in the gui and then I find myself navigating to other terminal windows to do some work. Inevitably, I want to shut down the GUI at some point, and out of habit I often just navigate to ... | tkinter keyboard interrupt isn't handled until tkinter frame is raised | 1.2 | 0 | 0 | 2,414 |
9,998,488 | 2012-04-03T17:38:00.000 | 0 | 0 | 1 | 0 | python | 9,998,527 | 5 | false | 0 | 0 | This is because 'string' is a string. So is 'list'
To get a similar result for lists, try help([]) | 2 | 1 | 0 | When I type help('string') in the python interpreter I get information about the string class. There,upper() is indicated as a function. Yet I can only call it as a method like "hi".upper() instead of upper("hi").
So one could assume that any method will be indicated as a function in the docstrings of the built in ... | Inconsistency in python help('string') versus help(list)? | 0 | 0 | 0 | 427 |
9,998,488 | 2012-04-03T17:38:00.000 | 2 | 0 | 1 | 0 | python | 9,998,583 | 5 | false | 0 | 0 | You mean to do help('str'), not help('string'). str is a type, string is a module providing functions for working with strings. | 2 | 1 | 0 | When I type help('string') in the python interpreter I get information about the string class. There,upper() is indicated as a function. Yet I can only call it as a method like "hi".upper() instead of upper("hi").
So one could assume that any method will be indicated as a function in the docstrings of the built in ... | Inconsistency in python help('string') versus help(list)? | 0.07983 | 0 | 0 | 427 |
9,999,005 | 2012-04-03T18:16:00.000 | 2 | 0 | 0 | 0 | python,django | 9,999,509 | 2 | false | 1 | 0 | There's no such thing as a "global variable" in Python that is available from everywhere. You need to import all names before you can use them.
Even if you did this, though, it wouldn't actually work on production. Not only is there no command that you run to start up the production server (it's done automatically by A... | 1 | 0 | 0 | I have this kind of setup :
Overridden BaseRunserverCommand that adds another option (--token) that would get a string token.
Store it in the app called "vault" as a global variable
Then continue executing the BaseRunserverCommand
Now later when I try to get the value of this global variable after the server started,... | Creating an in memory constant when django starts | 0.197375 | 0 | 0 | 92 |
9,999,618 | 2012-04-03T18:59:00.000 | 10 | 1 | 0 | 0 | python,maven | 9,999,984 | 4 | true | 1 | 0 | It is the good news: you do not need any tool. You can organise your source code in any way you want.
Let recap why we need tools in the java world:
In java you want to generate directories upfront because the namespace system dictates that each class must live in one file in a directory structure that reflects that ... | 1 | 16 | 0 | Are there any tools which generate a project layout for python specific projects, much similar to what maven accomplishes with mvn archetype:generate for java projects. | Project structure for python projects with maven | 1.2 | 0 | 0 | 15,040 |
10,000,256 | 2012-04-03T19:46:00.000 | 2 | 0 | 0 | 0 | python,sql-server,py2exe,pyodbc | 10,001,004 | 2 | false | 0 | 0 | In the last project I worked on, I found that DRIVER={SQL Server};SERVER=SERVERNAME;DATABASE=DBName is sufficient to initiate a db connection in trusted mode.
If it still does not work, it is probably either
1) the account DEEPTHOUGHT on mssql server is not set up properly.
2) the runAs in the service is not set up p... | 1 | 4 | 0 | Ok so I have a script that connects to a mssql db and i need to run as a service which I have already accomplished but when I run it as a service it overrides my credentials that I have put in when i connect to the db with the ad computer account.
It runs perfect when i run it on its own and not as a service.
My Connec... | Failed to Login as 'Domain\ComputerName' pyodbc with py2exe | 0.197375 | 1 | 0 | 7,735 |
10,000,504 | 2012-04-03T20:03:00.000 | 0 | 0 | 0 | 0 | python,django,sorl-thumbnail | 10,002,629 | 2 | false | 1 | 0 | I'd recommend you look at the source for sorl-thumbnail. Really all sorl-thumbnail is, is a wrapper around PIL (python imaging library). Although I'm sure you can figure out a way possibly to uncouple sorl-thumbnail from django it's going to be nontrivial. That said if you say set it up as a management command (with... | 1 | 0 | 0 | In my case I have an opportunity to generate image thumbnails and do some post-processing before they are uploaded to a server (Amazon S3) on administrators computer.
I know that sorl checks if thumbnail exists before generating it, but utilize kinda complicated naming scheme, so I hope there is a way to access sorl di... | How to use sorl-thumbnail without django? | 0 | 0 | 0 | 350 |
10,000,524 | 2012-04-03T20:04:00.000 | 1 | 1 | 1 | 0 | c++,parallel-processing,boost-python,cpython | 10,002,004 | 1 | false | 0 | 1 | As of today, you cannot avoid GIL interactions when using python threads in the same process.
You may want to have a look at multiprocessing module which is meant to easily spawn Python processes, thus not interacting with GIL.
Another option is to explicitly release the GIL when its not needed in your wrapped C/C++ fu... | 1 | 2 | 0 | I'm having a problem with my (game) application, which is using Boost.Python, when it comes to the scripting part. I have a client thread and a server thread that runs in the same process if you do not connect to an external server.
This is where my problems arise: It seems like the Python interpreter can't execute scr... | Running two python scripts parallel with boost::python | 0.197375 | 0 | 0 | 624 |
10,001,529 | 2012-04-03T21:17:00.000 | 0 | 0 | 1 | 0 | python,pdf | 10,004,090 | 1 | true | 0 | 0 | from the command line:python /path/to/pdf2txt.py -o text.txt /path/to/yourpdf.pdf
You can then just take the text file it makes and use for line in file:
If you want to be efficient you would have to change pdf2txt.py, and have outfp be a python iostring, which would avoid the making a file and then reading from it. | 1 | 0 | 0 | How can I get the content of pdf file line by line in python? I have searched in stackoverflow but could not find any good answer. Notes: pyPdf gives assertion erro, if possible something with slate and pdfminer. | python pdf line by line | 1.2 | 0 | 0 | 472 |
10,002,209 | 2012-04-03T22:13:00.000 | 2 | 0 | 0 | 1 | python,google-app-engine,authentication | 10,023,490 | 1 | true | 1 | 0 | User.federated_identity() "Returns the user's OpenID identifier.", which is unique by definition (it's a URL that uniquely identifies the user). | 1 | 2 | 0 | I need a unique datastore key for users authenticated via openid with the python 2.7 runtime for the google apps engine.
Should I use User.federated_identity() or User.federated_provider() + User.federated_identity()?
In other words is User.federated_identity() unique for ALL providers or just one specific provider... | Generating a unique data store key from a federated identity | 1.2 | 1 | 0 | 194 |
10,002,771 | 2012-04-03T23:09:00.000 | 2 | 1 | 0 | 0 | python,django,ssh | 10,003,264 | 1 | false | 1 | 0 | You're close. The problem here is probably that your web server runs as a non-privileged user (NOT root), like www or www-data or nobody (depending on your operating system). While that user can probably run the SSH binary, when doing so as nobody, it probably doesn't have a home directory, can't find your .ssh direc... | 1 | 0 | 0 | I acquired a python script that will either telnet to some equipment, or if the equipment is in a lab, ssh to a firewall machine and then it will telnet to the equipment, and run a command, returning the output for more processing.
I took this script and tied it into a Django web app so that I could, from a browser, fi... | need to ssh to remote machine from web page with python/django | 0.379949 | 0 | 0 | 2,644 |
10,003,152 | 2012-04-03T23:57:00.000 | 0 | 1 | 0 | 0 | python,matplotlib | 10,003,436 | 1 | false | 0 | 0 | Did you try to remove the pyc file ?
It may happen as the pyc file exists that PyLab keeps reading it without reloading the file. | 1 | 0 | 0 | I have a simple question. I am in the process of debugging some code. I am using Enthought Python, with the "PyLab" program. I edit my code using gEdit. I am using Ubuntu 10.04.4 LTS.
I use "run myfile.py" to run the program. Then I test myfile(somearguments), and see where the bugs are.
However, when I make changes to... | Python "run" and "reload" not showing the changes to my code | 0 | 0 | 0 | 233 |
10,003,232 | 2012-04-04T00:08:00.000 | 6 | 0 | 1 | 0 | python,matrix,linear-algebra | 10,003,296 | 2 | false | 0 | 0 | The rule of Sarrus is only a mnemonic for solving 3x3 determinants, and won't be as helpful moving beyond that size.
You should investigate the Leibniz formula for calculating the determinant of an arbitrarily large square matrix. The nice thing about this formula is that the determinant of an n*n matrix is that it can... | 1 | 3 | 1 | I'm making a small matrix operations library as a programming challenge to myself(and for the purpose of learning to code with Python), and I've come upon the task of calculating the determinant of 2x2, 3x3 and 4x4 matrices.
As far as my understanding of linear algebra goes, I need to implement the Rule of Sarrus in or... | Python determinant calculation(without the use of external libraries) | 1 | 0 | 0 | 3,244 |
10,004,987 | 2012-04-04T04:34:00.000 | 3 | 0 | 1 | 0 | python,comparison,tuples | 10,005,224 | 3 | false | 0 | 0 | As Dougal says in his comment, is tests that the two things you are comparing are the in the same place in memory. For things like numbers, strings, booleans and the empty tuple, Python reuses objects by default (interning) so is will often produce the same behaviour as ==. This also means that you can get some perform... | 1 | 12 | 0 | Why is () is () true, yet (0,) is (0,) is false?
I thought they would be the same object. However, I'm apparently missing something. | The Python "is" statement and tuples | 0.197375 | 0 | 0 | 445 |
10,006,017 | 2012-04-04T06:34:00.000 | 2 | 0 | 1 | 0 | python,logging | 10,023,080 | 2 | false | 0 | 0 | I think there is no magic scanning here.
Try to test it this way in a separate test directory:
test/main.py:
import logging
logging.info('test')
test/any.py:
import logging
logging.basicConfig(filename='test.log', level=logging.INFO)
python main.py
Result: NO test.log file.
Now let's update the test:... | 1 | 2 | 0 | I used to Python logging, it works fine. The logging.basicConfig(...) set in one module (a some.py file), then we can use logging every where. Obviously, logging is global.
The question is how logging find it's settings, when we not call the module where basicConfig(...) appeared (in some.py file )? Is logging scan ... | How python logging get it's configuration | 0.197375 | 0 | 0 | 727 |
10,006,467 | 2012-04-04T07:11:00.000 | 1 | 0 | 1 | 0 | python,nlp,nltk | 10,054,525 | 2 | true | 0 | 0 | You don't need to input the files yourself or to provide words and sents methods.
Read in your corpus with PlaintextCorpusReader, and it will provide those for you.
The corpus reader constructor accepts arguments for the path and filename pattern of the files, and for the input encoding (be sure to specify it).
The c... | 1 | 0 | 1 | I have hundreds of files containing text I want to use with NLTK. Here is one such file:
বে,বচা ইয়াণ্ঠা,র্চা ঢার্বিত তোখাটহ নতুন, অ প্রবঃাশিত।
তবে ' এ বং মুশায়েরা ' পত্রিব্যায় প্রকাশিত তিনটি লেখাই বইযে
সংব্যজান ব্যরার জনা বিশেষভাবে পরিবর্ধিত। পাচ দাপনিকেব
ড:বন নিয়ে এই বই তৈরি বাবার পরিব্যল্পনাও ম্ভ্রাসুনতন
সামন্তে... | Creating a corpus from data in a custom format | 1.2 | 0 | 0 | 272 |
10,009,660 | 2012-04-04T10:53:00.000 | 9 | 0 | 0 | 1 | python,installation,py2exe | 10,009,715 | 2 | false | 0 | 0 | Py2exe has to run on Windows, you can not run it in Linux. (Maybe wine can help, but I'm not sure) | 1 | 9 | 0 | I downloaded the actual py2exe package.
But I've no idea how to get it in my system. I mean I can follow the tutorial a 100% but I can't find anything how to install py2exe to my kubuntu 11.10.
I also can't find a py2exe.py which I could include to my workingfolder.
Could some please help me the project has to be fini... | How to install the py2exe modul in Linux | 1 | 0 | 0 | 23,189 |
10,012,741 | 2012-04-04T14:04:00.000 | 1 | 0 | 1 | 0 | python,converter,python-sphinx,docstring,epydoc | 13,075,229 | 4 | false | 0 | 0 | In theory you could write a Sphinx extension which would catch whatever event gets fired when a docstring gets read (source_read, maybe?) and translate the docstrings on the fly.
I say in theory because:
I've been meaning to write such a thing for a very long time, but haven't managed to get around to it yet.
Translat... | 1 | 10 | 0 | I've got a project which I documented using epydoc. Now I'm trying to switch to sphinx. I formatted all my docstrings for epydocs, using B{}, L{} etc for bolding, linking and the like, and using @param, @return, @raise etc to explain input, output, exceptions and the likes.
So now that I'm switching to sphinx it loses... | Automated way to switch from epydoc's docstring formatting to sphinx docstring formatting? | 0.049958 | 0 | 0 | 2,578 |
10,012,968 | 2012-04-04T14:16:00.000 | 4 | 0 | 1 | 0 | python,optimization,parallel-processing | 10,013,025 | 6 | false | 0 | 0 | Starting independent Python processes is ideal. There will be no lock contentions between the processes, and the OS will schedule them to run concurrently.
You may want to experiment to see what the ideal number of instances is - it may be more or less than the number of cores. There will be contention for the disk and... | 2 | 11 | 0 | We have a about 500GB of images in various directories we need to process. Each image is about 4MB in size and we have a python script to process each image one at a time (it reads metadata and stores it in a database). Each directory can take 1-4 hours to process depending on size.
We have at our disposal a 2.2Ghz qua... | Fastest way to process large files in Python | 0.132549 | 0 | 0 | 4,472 |
10,012,968 | 2012-04-04T14:16:00.000 | 0 | 0 | 1 | 0 | python,optimization,parallel-processing | 10,014,037 | 6 | false | 0 | 0 | If you are reading a large number of files and saving metadata to a database you program does not need more cores.
Your process is likely IO bound not CPU bound. Using twisted with proper defereds and callbacks would likely outperform any solution that sought to enlist 4 cores. | 2 | 11 | 0 | We have a about 500GB of images in various directories we need to process. Each image is about 4MB in size and we have a python script to process each image one at a time (it reads metadata and stores it in a database). Each directory can take 1-4 hours to process depending on size.
We have at our disposal a 2.2Ghz qua... | Fastest way to process large files in Python | 0 | 0 | 0 | 4,472 |
10,013,904 | 2012-04-04T15:06:00.000 | 2 | 0 | 0 | 0 | python,user-interface | 10,014,865 | 4 | false | 0 | 1 | You think absolutely right. There are loads of python-based frameworks, just choose the right one: pyramid, pylons, django are the most popular and widely-used.
I suggest you to outsource HTML/CSS slicing to some professional instead of doing it by yourself. You can face up quite a lot of browser-specific things, which... | 2 | 5 | 0 | I have a GUI project which I am about to start. GUI requirement is simple ( though not as simple as tkinter will suffice). So I need to use a GUI toolkit for python (which will be wxpython if I have to go for GUI). Now I am thinking, why cannot I use simple web-framework such as cherrypy or bottlepy (sorry, if I am not... | Using web-server to substitute for GUI in python | 0.099668 | 0 | 0 | 6,264 |
10,013,904 | 2012-04-04T15:06:00.000 | 1 | 0 | 0 | 0 | python,user-interface | 10,013,987 | 4 | false | 0 | 1 | No, you are thinking of this correctly. HTML/CSS is very simple it can lend to rapid development. Additionally python micro frameworks will make creating your business logic a breeze. This is a very straight forward sipmle route to take. | 2 | 5 | 0 | I have a GUI project which I am about to start. GUI requirement is simple ( though not as simple as tkinter will suffice). So I need to use a GUI toolkit for python (which will be wxpython if I have to go for GUI). Now I am thinking, why cannot I use simple web-framework such as cherrypy or bottlepy (sorry, if I am not... | Using web-server to substitute for GUI in python | 0.049958 | 0 | 0 | 6,264 |
10,017,645 | 2012-04-04T19:06:00.000 | 1 | 1 | 0 | 0 | python,database,django,apache,mod-wsgi | 10,020,054 | 1 | true | 1 | 0 | First up, look at daemon mode of mod_wsgi and don't use embedded mode as then you can control separate to Apache child processes the number of Python WSGI application processes. Secondly, you would be better off putting the memory hungry bits in a separate backend process. You might use XML-RPC or other message queuein... | 1 | 2 | 0 | I'm writing a Oracle of Bacon type website that involves a breadth first search on a very large directed graph (>5 million nodes with an average of perhaps 30 outbound edges each). This is also essentially all the site will do, aside from display a few mostly text pages (how it works, contact info, etc.). I currently h... | Maximizing apache server instances with large mod_wsgi application | 1.2 | 1 | 0 | 214 |
10,018,055 | 2012-04-04T19:35:00.000 | 0 | 0 | 0 | 0 | python,django,mysql-python | 10,192,810 | 1 | false | 1 | 0 | I would think this would be more inline with setting a read_timeout on your front-facing webserver. Any number of reasons could exist to hold up your django app indefinitely. While you have found one specific case there could be many more (code errors, cache difficulties, etc). | 1 | 2 | 0 | I've been doing some HA testing of our database and in my simulation of server death I've found an issue.
My test uses Django and does this:
Connect to the database
Do a query
Pull out the network cord of the server
Do another query
At this point everything hangs indefinitely within the mysql_ping function. As far as... | How can I detect total MySQL server death from Python? | 0 | 1 | 0 | 181 |
10,018,767 | 2012-04-04T20:29:00.000 | 0 | 0 | 0 | 0 | python,pygtk | 10,057,082 | 1 | false | 0 | 1 | If you want to display an image and allow the user to select and move parts of it, you best look for a ready-made image editing widget. GTK doesn't come with one.
To roll your own you can use an image widget for display, but it doesn't care about the mouse, so you can place it inside an event box and connect to button ... | 1 | 0 | 0 | What I'm wanting to do is create a selection tool (like what you see in most paint programs) using PyGtk. I've seen a previous question that asked something similar, but they already seemed to know what they were doing to make the selection itself. That user said he was using an eventbox, but I don't know how I would... | How do I create a canvas selection tool? | 0 | 0 | 0 | 212 |
10,019,043 | 2012-04-04T20:50:00.000 | 1 | 0 | 1 | 0 | python,exception,python-3.x,assert,software-design | 10,038,223 | 2 | false | 0 | 0 | assert statements are for things that you use while developing and debugging the code, not to guarantee critical API constraints.
For your positive number example, test the value and raise ValueError with a useful error message if using a negative value within your code would have bad consequences.
I tell people never ... | 1 | 2 | 0 | The best practice seems to be to use assert for a condition that should never happen if the code is correct, and an exception for a condition that is a bit unusual but can happen (e.g., when memory runs out, or user input is invalid, or external connections are broken). I understand the rationale behind this practice a... | Python assert statement and code reusability | 0.099668 | 0 | 0 | 1,765 |
10,019,456 | 2012-04-04T21:22:00.000 | 2 | 0 | 1 | 0 | python,sys | 51,362,095 | 6 | false | 0 | 0 | As per my understanding sys.stdout.flush() pushes out all the data that has been buffered to that point to a file object.
While using stdout, data is stored in buffer memory (for some time or until the memory gets filled) before it gets written to terminal. Using flush() forces to empty the buffer and write to terminal... | 1 | 217 | 0 | What does sys.stdout.flush() do? | Usage of sys.stdout.flush() method | 0.066568 | 0 | 0 | 230,848 |
10,020,073 | 2012-04-04T22:18:00.000 | 0 | 0 | 0 | 0 | django,ldap,django-authentication,python-ldap | 10,024,636 | 1 | true | 1 | 0 | For those that are interested, the solution was that there is a setting in the LDAP module called AUTH_LDAP_ALWAYS_UPDATE_USER which you need to set to False to make sure it doesn't update every time. | 1 | 1 | 0 | I have a Django app which uses LDAP as the authentication backend.
I'm not sure whether it's the LDAP module or just Django itself but, if a user changes their email address, first name or last name and then logs out and back in again, the values revert to their original values (ie. the ones obtained from the LDAP reco... | User login overwrites user fields | 1.2 | 0 | 0 | 80 |
10,020,389 | 2012-04-04T22:52:00.000 | -1 | 0 | 0 | 1 | winapi,windows-7,python-3.x,block,pywin32 | 28,282,261 | 1 | false | 0 | 0 | write a while loop
Into the while loop write the command to taskkill dwm.exe
It's a poor solution, but the only one I know.
Regards! | 1 | 0 | 0 | This might be a more difficult question since I don't even know how to do it outside of Python...
I want to write a terminal program that completely locks up my PC until a password is entered. In the locked state no one should be able to do anything outside the terminal. In it, the user may rampage and write silly comm... | Completely locking down Windows 7 using Python 3.2? | -0.197375 | 0 | 0 | 545 |
10,020,528 | 2012-04-04T23:08:00.000 | 0 | 0 | 0 | 0 | python,sqlite,wxpython,wxwidgets | 10,021,932 | 2 | false | 0 | 1 | In different scenarios, the strategies will be different. The assumption is that you just use wxPython for presentation purpose, and you have a separate module/package dealing with the data. wxPython controls get data only from the data abstraction layer.
Scenario I: load all the log data into the memory and use wx.lis... | 1 | 1 | 0 | I have a large data set (log data) that is stored in a SQLite3 database. I created a Python GUI using Wx.listctrl that displays that data from a query. It works fine for small amounts of data but obviously hangs on larger sets.. therefore I would like to implement one of two things:
-paging were the first 5000 records ... | Display large dataset from Sqlite database in Python wx | 0 | 0 | 0 | 1,254 |
10,020,908 | 2012-04-04T23:55:00.000 | 0 | 0 | 0 | 0 | python,ruby-on-rails,numpy | 10,021,813 | 2 | false | 1 | 0 | I assume that the Python part is a stack of back-end libraries/modules of scientific functions while the Ruby-on-Rail part is mostly as front-end. Then an relatively simple solution would be wrap those Python modules/libraries into services and let the Ruby-on-Rail-built front-end functions call those services.
To bui... | 1 | 4 | 0 | I'm a fan of using the right tool for the job.
At my company, the data analysts (incl myself) primarily use Python because of the powerful scientific libraries; the web people downstairs use Ruby on Rails for building our own HR management webapp as well as maintaining our online presence.
We would like to have the tw... | Integrating scientific python into an existing Rails webapp | 0 | 0 | 0 | 917 |
10,021,846 | 2012-04-05T02:21:00.000 | 0 | 0 | 0 | 0 | python,django | 10,022,609 | 2 | false | 1 | 0 | If you put some data in request.session it automatically creates a record in django_session on process_response of session middleware. So if you put nothing in the session, and it stores only login data - then it will be number of logins (also by the same user - logount clears session data so it's being recreated if an... | 2 | 0 | 0 | I am looking at my table for django_session and would like to know what this essentially means.
If I have 100 session entries in the past hour, does that mean 100 people have logged in in the past hour? Or does it mean something else? | Interpreting session activity | 0 | 0 | 0 | 56 |
10,021,846 | 2012-04-05T02:21:00.000 | 0 | 0 | 0 | 0 | python,django | 10,030,017 | 2 | false | 1 | 0 | It means there are 100 unique visting during which the request.session got modified. The unique visiting is based on per-user-browser: a user who uses Firefox and then Chrome to access your site AND having request.session modified during the process will be identified as two or more visting. Normally, there is no modif... | 2 | 0 | 0 | I am looking at my table for django_session and would like to know what this essentially means.
If I have 100 session entries in the past hour, does that mean 100 people have logged in in the past hour? Or does it mean something else? | Interpreting session activity | 0 | 0 | 0 | 56 |
10,023,418 | 2012-04-05T06:05:00.000 | 0 | 0 | 0 | 0 | python | 10,023,435 | 3 | false | 1 | 0 | Examine the Content-Disposition header of the response to discover what the server wants you to call the file. | 1 | 2 | 0 | I am having a problem and not sure if this is possible at all, so if someone could point me in the right direction.
I need to open a file from a webpage, open it in excel and save the file.
The problem I am running into the file name on the website has a file name ( not an active link ) and then it will have a "downloa... | Python File Download | 0 | 1 | 0 | 1,137 |
10,023,941 | 2012-04-05T06:57:00.000 | 0 | 0 | 0 | 0 | python,web2py,web2py-modules | 42,826,179 | 3 | false | 1 | 0 | You should mention your directory name in environmental variable PYTHONPATH so that it will locate your directory.
Hopes this will help you :) | 2 | 0 | 0 | I have to develop web2py app and have to use Facebook sdk in that. I have downloaded facebook sdk zip folder to my windows pc and extarct it and uploaded facebook.py module to my web2py application and using statement "from applications.modules.facebook import * " in controller/default.py and when i run the application... | Getting error No module named modules.facebook | 0 | 0 | 0 | 9,533 |
10,023,941 | 2012-04-05T06:57:00.000 | 0 | 0 | 0 | 0 | python,web2py,web2py-modules | 10,024,541 | 3 | false | 1 | 0 | What is the folder structure of the facebook sdk? If it facebook/ and facebook/__init__.py is a file within it, then you can import it using import facebook or from facebook import * from the directory where you have facebook folder. If you are importing it from within modules, then make sure that you have placed the f... | 2 | 0 | 0 | I have to develop web2py app and have to use Facebook sdk in that. I have downloaded facebook sdk zip folder to my windows pc and extarct it and uploaded facebook.py module to my web2py application and using statement "from applications.modules.facebook import * " in controller/default.py and when i run the application... | Getting error No module named modules.facebook | 0 | 0 | 0 | 9,533 |
10,025,521 | 2012-04-05T08:53:00.000 | 1 | 0 | 1 | 0 | python,list,python-3.x | 10,026,199 | 3 | false | 0 | 0 | As the other answers say you don't need to know and you shouldn't care. In general empty lists and dictionaries are just like any other list or dictionary: indeed since you can mutate an empty list/dictionary it may later become non-empty.
However, the empty tuple is slightly different as in at least some implementatio... | 2 | 1 | 0 | I am new to python programming, as per OOps Concepts memory will allocated for every Object,
in python programming, how the memory is allocated for [ ], { }, ( ) objects without elements?
Thanks
Mukthayr | How is memory allocated for empty list, tuple, dictionary? | 0.066568 | 0 | 0 | 577 |
10,025,521 | 2012-04-05T08:53:00.000 | 4 | 0 | 1 | 0 | python,list,python-3.x | 10,025,587 | 3 | false | 0 | 0 | If you're worrying about memory allocation for empty elements in Python, you're doing it wrong.
Python is a high-level language with automatic memory management. Unless you're trying to deal with huge amounts of data in a severely memory-restricted environment, you should not be thinking about this. | 2 | 1 | 0 | I am new to python programming, as per OOps Concepts memory will allocated for every Object,
in python programming, how the memory is allocated for [ ], { }, ( ) objects without elements?
Thanks
Mukthayr | How is memory allocated for empty list, tuple, dictionary? | 0.26052 | 0 | 0 | 577 |
10,028,006 | 2012-04-05T11:48:00.000 | 0 | 0 | 1 | 0 | python,generator | 10,028,242 | 3 | false | 0 | 0 | I thinks there is an error in your code.
As you can see, float() is a function, and the statement float(i.dist) -= float(base) means assigning to function call, so it will be a syntax error :) | 2 | 0 | 0 | a short question: is it possible to assign the result of a calculation within a generator expression to a referrer?
Let's assume I have an expression like this:
m = (float(i.dist) - float(base) for i in met_obj if str(i.code) != '90')
i.dist is an attribute of an object which I want to chance. I tried:
m = (float(i.di... | Assign calculated value to variable within generator expression? | 0 | 0 | 0 | 1,169 |
10,028,006 | 2012-04-05T11:48:00.000 | 0 | 0 | 1 | 0 | python,generator | 10,028,687 | 3 | true | 0 | 0 | A short answer: no, it is not possible. | 2 | 0 | 0 | a short question: is it possible to assign the result of a calculation within a generator expression to a referrer?
Let's assume I have an expression like this:
m = (float(i.dist) - float(base) for i in met_obj if str(i.code) != '90')
i.dist is an attribute of an object which I want to chance. I tried:
m = (float(i.di... | Assign calculated value to variable within generator expression? | 1.2 | 0 | 0 | 1,169 |
10,029,190 | 2012-04-05T13:06:00.000 | 6 | 0 | 0 | 0 | python,django,amazon-ec2,wsgi | 10,029,391 | 1 | true | 1 | 0 | Yes you can have as many different django sites as your server can handle! You can set up separate virtual hosts pointing to the appropriate wsgi for each site you want.
Remember just because it is possible doesn't mean it's a good idea, keep in mind the resources each site is consuming. | 1 | 2 | 0 | I intend to have many python with django applications on my server,
is it ok to have django with wsgi and many sites on the one server?
thanks! | django multiple sites wsgi is enough? | 1.2 | 0 | 0 | 191 |
10,029,355 | 2012-04-05T13:16:00.000 | 0 | 0 | 0 | 0 | python,linux,firefox,gnu | 10,029,542 | 1 | true | 0 | 0 | You might have some luck with DBus, although I don't know if it is provided in a standard install. | 1 | 1 | 0 | I need to get the content of URL bar (of currently opened tab) of Firefox using Python. I've found few solutions for Windows (using libraries such as pywin32) but I need it for GNU/Linux (if available then multi-platform way is the most preferred, of course). I have also found ways doing it by installing add-on for Fir... | Python - How to get the Firefox's URL bar content in GNU/Linux? | 1.2 | 0 | 1 | 283 |
10,029,641 | 2012-04-05T13:36:00.000 | 0 | 0 | 0 | 0 | python,excel,xlrd | 10,029,868 | 1 | false | 0 | 0 | As per the link for your question,I have posted above, the author of xlrd says, 'The work is 'in-progress' but is not likely to be available soon as the focus of xlrd lies elsewhere". By this, I assume that there is nothing much you can do about it. Note: this is based on author's comment on Jan, 2011. | 1 | 2 | 0 | I am trying to do a parser, that reads several excel files. I need values usually at the bottom of a row where you find a sum of all upper elements. So the cell value is actually "=sum()" or "A5*0.5" lets say... To a user that opens this file with excel it appears like a number, which is fine. But if I try to read thi... | how to read formulas with xlrd | 0 | 1 | 0 | 2,953 |
10,029,823 | 2012-04-05T13:47:00.000 | 3 | 0 | 1 | 1 | python,path,directory,java | 10,029,856 | 1 | true | 0 | 0 | You can check for JAVA_HOME or JDK_HOME system variables. But there is no guarantee that there are no other JDKs installed. You have to be more specific what you are willing to achieve. | 1 | 0 | 0 | I'm currently writing a program in Python, and I would like to determine the path to the JDK install directory if it's on the system. Is there a way of doing this in Python? If not, is there a way of doing it in Java (or another language)? If it is the latter, I could open a subprocess from within Python to obtain i... | Determine a JDK install directory through Python | 1.2 | 0 | 0 | 970 |
10,031,427 | 2012-04-05T15:22:00.000 | 5 | 1 | 1 | 0 | python,python-idle | 10,031,501 | 1 | true | 0 | 0 | The reason why this is sensible with LISP is that every LISP programs is just a bunch of macros and functions and the s-expressions can be formatted automatically into a nice representation.
This isn't the case in Python, where you have more complex syntax (significant whitespace, decorators, lots of control structure... | 1 | 3 | 0 | I'm not sure if I worded the subject correctly but essentially I'm curious if someone can develop code in the Python IDLE, or a similar tool, and then through some command spit out the current code in memory. I believe I did this previously when going through a Lisp book and recall it being a very different approach th... | Can a python IDLE be used for iterative/in-memory development? | 1.2 | 0 | 0 | 199 |
10,032,077 | 2012-04-05T16:07:00.000 | 2 | 0 | 0 | 0 | python,django | 10,033,919 | 2 | false | 1 | 0 | Have you left any debug prints in your view? That will cause a conversion to the console's encoding, which may be ascii causing this error. | 2 | 2 | 0 | Sometimes I m getting unicode errors like below in my django site when user submit form data.
"'ascii' codec can't encode character u'\u2014' in position 109: ordinal not in range(128)"
How can i reproduce the unicode error in my system
Many Thanks. | reproduce unicode error in django | 0.197375 | 0 | 0 | 309 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.