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
101,569
2008-09-19T12:47:00.000
3
0
1
0
python,algorithm,diff
101,623
10
false
0
0
You need to make your question more concrete. If you've already read the fingerprinting papers, you already know the principles at work, so describing common approaches here would not be beneficial. If you haven't, you should also check out papers on "duplicate detection" and various web spam detection related papers...
2
10
0
I need to write a module to detect similar documents. I have read many papers of fingerprints of documents techniques and others, but I do not know how to write code or implement such a solution. The algorithm should work for Chinese, Japanese, English and German language or be language independent. How can I accomplis...
Algorithm to detect similar documents in python script
0.059928
0
0
13,411
102,535
2008-09-19T14:58:00.000
2
0
1
0
python,generator
102,701
16
false
0
0
I use generators when our web server is acting as a proxy: The client requests a proxied url from the server The server begins to load the target url The server yields to return the results to the client as soon as it gets them
1
229
0
I'm starting to learn Python and I've come across generator functions, those that have a yield statement in them. I want to know what types of problems that these functions are really good at solving.
What can you use generator functions for?
0.024995
0
0
95,625
104,983
2008-09-19T19:53:00.000
3
0
1
0
python,multithreading,thread-local
105,058
6
false
0
0
Just like in every other language, every thread in Python has access to the same variables. There's no distinction between the 'main thread' and child threads. One difference with Python is that the Global Interpreter Lock means that only one thread can be running Python code at a time. This isn't much help when it com...
3
123
0
In Python specifically, how do variables get shared between threads? Although I have used threading.Thread before I never really understood or saw examples of how variables got shared. Are they shared between the main thread and the children or only among the children? When would I need to use thread local storage to ...
What is "thread local storage" in Python, and why do I need it?
0.099668
0
0
68,654
104,983
2008-09-19T19:53:00.000
1
0
1
0
python,multithreading,thread-local
70,450,414
6
false
0
0
Worth mentioning threading.local() is not a singleton. You can use more of them per thread. It is not one storage.
3
123
0
In Python specifically, how do variables get shared between threads? Although I have used threading.Thread before I never really understood or saw examples of how variables got shared. Are they shared between the main thread and the children or only among the children? When would I need to use thread local storage to ...
What is "thread local storage" in Python, and why do I need it?
0.033321
0
0
68,654
104,983
2008-09-19T19:53:00.000
1
0
1
0
python,multithreading,thread-local
60,241,832
6
false
0
0
I may be wrong here. If you know otherwise please expound as this would help explain why one would need to use thread local(). This statement seems off, not wrong: "If you want to atomically modify anything that another thread has access to, you have to protect it with a lock." I think this statement is ->effectively<-...
3
123
0
In Python specifically, how do variables get shared between threads? Although I have used threading.Thread before I never really understood or saw examples of how variables got shared. Are they shared between the main thread and the children or only among the children? When would I need to use thread local storage to ...
What is "thread local storage" in Python, and why do I need it?
0.033321
0
0
68,654
105,095
2008-09-19T20:07:00.000
1
0
1
0
python,multithreading,locking
105,127
9
false
0
0
You still need to use locks (your code could be interrupted at any time to execute another thread and this can cause data inconsistencies). The problem with GIL is that it prevents Python code from using more cores at the same time (or multiple processors if they are available).
2
79
0
If you are relying on an implementation of Python that has a Global Interpreter Lock (i.e. CPython) and writing multithreaded code, do you really need locks at all? If the GIL doesn't allow multiple instructions to be executed in parallel, wouldn't shared data be unnecessary to protect? sorry if this is a dumb question...
Are locks unnecessary in multi-threaded Python code because of the GIL?
0.022219
0
0
10,397
105,095
2008-09-19T20:07:00.000
25
0
1
0
python,multithreading,locking
105,145
9
false
0
0
No - the GIL just protects python internals from multiple threads altering their state. This is a very low-level of locking, sufficient only to keep python's own structures in a consistent state. It doesn't cover the application level locking you'll need to do to cover thread safety in your own code. The essence of l...
2
79
0
If you are relying on an implementation of Python that has a Global Interpreter Lock (i.e. CPython) and writing multithreaded code, do you really need locks at all? If the GIL doesn't allow multiple instructions to be executed in parallel, wouldn't shared data be unnecessary to protect? sorry if this is a dumb question...
Are locks unnecessary in multi-threaded Python code because of the GIL?
1
0
0
10,397
106,725
2008-09-20T01:39:00.000
1
0
1
1
python,tkinter,packaging
106,731
7
false
0
0
py2exe is the best way to do this. It's a bit of a PITA to use, but the end result works very well.
2
61
0
I need to package my Python application, its dependencies and Python into a single MSI installer. The end result should desirably be: Python is installed in the standard location the package and its dependencies are installed in a separate directory (possibly site-packages) the installation directory should contain th...
How to bundle a Python application including dependencies?
0.028564
0
0
58,009
106,725
2008-09-20T01:39:00.000
5
0
1
1
python,tkinter,packaging
114,717
7
false
0
0
My company uses the free InnoSetup tool. It is a moderately complex program that has tons of flexibility for building installers for windows. I believe that it creates .exe and not .msi files, however. InnoSetup is not python specific but we have created an installer for one of our products that installs python alon...
2
61
0
I need to package my Python application, its dependencies and Python into a single MSI installer. The end result should desirably be: Python is installed in the standard location the package and its dependencies are installed in a separate directory (possibly site-packages) the installation directory should contain th...
How to bundle a Python application including dependencies?
0.141893
0
0
58,009
106,766
2008-09-20T01:56:00.000
7
1
0
0
python,linux,unit-testing
106,780
6
false
0
0
You have two levels of testing. Filtering and Modifying content. These are "low-level" operations that don't really require physical file I/O. These are the tests, decision-making, alternatives, etc. The "Logic" of the application. File system operations. Create, copy, rename, delete, backup. Sorry, but those are...
3
23
0
A common task in programs I've been working on lately is modifying a text file in some way. (Hey, I'm on Linux. Everything's a file. And I do large-scale system admin.) But the file the code modifies may not exist on my desktop box. And I probably don't want to modify it if it IS on my desktop. I've read about unit tes...
Unit Testing File Modifications
1
0
0
4,799
106,766
2008-09-20T01:56:00.000
2
1
0
0
python,linux,unit-testing
106,772
6
false
0
0
When I touch files in my code, I tend to prefer to mock the actual reading and writing of the file... so then I can give my classes exact contents I want in the test, and then assert that the test is writing back the contents I expect. I've done this in Java, and I imagine it is quite simple in Python... but it may req...
3
23
0
A common task in programs I've been working on lately is modifying a text file in some way. (Hey, I'm on Linux. Everything's a file. And I do large-scale system admin.) But the file the code modifies may not exist on my desktop box. And I probably don't want to modify it if it IS on my desktop. I've read about unit tes...
Unit Testing File Modifications
0.066568
0
0
4,799
106,766
2008-09-20T01:56:00.000
1
1
0
0
python,linux,unit-testing
106,781
6
false
0
0
You might want to setup the test so that it runs inside a chroot jail, so you have all the environment the test needs, even if paths and file locations are hardcoded in the code [not really a good practice, but sometimes one gets the file locations from other places...] and then check the results via the exit code.
3
23
0
A common task in programs I've been working on lately is modifying a text file in some way. (Hey, I'm on Linux. Everything's a file. And I do large-scale system admin.) But the file the code modifies may not exist on my desktop box. And I probably don't want to modify it if it IS on my desktop. I've read about unit tes...
Unit Testing File Modifications
0.033321
0
0
4,799
106,896
2008-09-20T03:07:00.000
10
0
1
0
python,class,project-structure
8,098,533
6
false
0
0
I find myself splitting things up when I get annoyed with the bigness of files and when the desirable structure of relatedness starts to emerge naturally. Often these two stages seem to coincide. It can be very annoying if you split things up too early, because you start to realise that a totally different ordering of...
4
294
0
I'm used to the Java model where you can have one public class per file. Python doesn't have this restriction, and I'm wondering what's the best practice for organizing classes.
Possibilities for Python classes organized across files?
1
0
0
104,646
106,896
2008-09-20T03:07:00.000
29
0
1
0
python,class,project-structure
7,879,007
6
false
0
0
I happen to like the Java model for the following reason. Placing each class in an individual file promotes reuse by making classes easier to see when browsing the source code. If you have a bunch of classes grouped into a single file, it may not be obvious to other developers that there are classes there that can be r...
4
294
0
I'm used to the Java model where you can have one public class per file. Python doesn't have this restriction, and I'm wondering what's the best practice for organizing classes.
Possibilities for Python classes organized across files?
1
0
0
104,646
106,896
2008-09-20T03:07:00.000
41
0
1
0
python,class,project-structure
106,909
6
false
0
0
Since there is no artificial limit, it really depends on what's comprehensible. If you have a bunch of fairly short, simple classes that are logically grouped together, toss in a bunch of 'em. If you have big, complex classes or classes that don't make sense as a group, go one file per class. Or pick something in be...
4
294
0
I'm used to the Java model where you can have one public class per file. Python doesn't have this restriction, and I'm wondering what's the best practice for organizing classes.
Possibilities for Python classes organized across files?
1
0
0
104,646
106,896
2008-09-20T03:07:00.000
7
0
1
0
python,class,project-structure
106,903
6
false
0
0
I would say to put as many classes as can be logically grouped in that file without making it too big and complex.
4
294
0
I'm used to the Java model where you can have one public class per file. Python doesn't have this restriction, and I'm wondering what's the best practice for organizing classes.
Possibilities for Python classes organized across files?
1
0
0
104,646
107,405
2008-09-20T06:38:00.000
1
1
0
0
python,python-2.7,http,http-headers,content-type
779,985
11
false
0
0
As an aside, when using the httplib (at least on 2.5.2), trying to read the response of a HEAD request will block (on readline) and subsequently fail. If you do not issue read on the response, you are unable to send another request on the connection, you will need to open a new one. Or accept a long delay between req...
2
117
0
What I'm trying to do here is get the headers of a given URL so I can determine the MIME type. I want to be able to see if http://somedomain/foo/ will return an HTML document or a JPEG image for example. Thus, I need to figure out how to send a HEAD request so that I can read the MIME type without having to download th...
How do you send a HEAD HTTP request in Python 2?
0.01818
0
1
72,799
107,405
2008-09-20T06:38:00.000
1
1
0
0
python,python-2.7,http,http-headers,content-type
2,630,687
11
false
0
0
I have found that httplib is slightly faster than urllib2. I timed two programs - one using httplib and the other using urllib2 - sending HEAD requests to 10,000 URL's. The httplib one was faster by several minutes. httplib's total stats were: real 6m21.334s ...
2
117
0
What I'm trying to do here is get the headers of a given URL so I can determine the MIME type. I want to be able to see if http://somedomain/foo/ will return an HTML document or a JPEG image for example. Thus, I need to figure out how to send a HEAD request so that I can read the MIME type without having to download th...
How do you send a HEAD HTTP request in Python 2?
0.01818
0
1
72,799
107,705
2008-09-20T09:17:00.000
68
0
0
1
python,stdout,buffered
107,720
16
false
0
0
Yes, it is. You can disable it on the commandline with the "-u" switch. Alternatively, you could call .flush() on sys.stdout on every write (or wrap it with an object that does this automatically)
3
621
0
Is output buffering enabled by default in Python's interpreter for sys.stdout? If the answer is positive, what are all the ways to disable it? Suggestions so far: Use the -u command line switch Wrap sys.stdout in an object that flushes after every write Set PYTHONUNBUFFERED env var sys.stdout = os.fdopen(sys.stdout.fi...
Disable output buffering
1
0
0
341,073
107,705
2008-09-20T09:17:00.000
12
0
0
1
python,stdout,buffered
107,721
16
false
0
0
Yes, it is enabled by default. You can disable it by using the -u option on the command line when calling python.
3
621
0
Is output buffering enabled by default in Python's interpreter for sys.stdout? If the answer is positive, what are all the ways to disable it? Suggestions so far: Use the -u command line switch Wrap sys.stdout in an object that flushes after every write Set PYTHONUNBUFFERED env var sys.stdout = os.fdopen(sys.stdout.fi...
Disable output buffering
1
0
0
341,073
107,705
2008-09-20T09:17:00.000
3
0
0
1
python,stdout,buffered
17,047,064
16
false
0
0
(I've posted a comment, but it got lost somehow. So, again:) As I noticed, CPython (at least on Linux) behaves differently depending on where the output goes. If it goes to a tty, then the output is flushed after each '\n' If it goes to a pipe/process, then it is buffered and you can use the flush() based solutions or...
3
621
0
Is output buffering enabled by default in Python's interpreter for sys.stdout? If the answer is positive, what are all the ways to disable it? Suggestions so far: Use the -u command line switch Wrap sys.stdout in an object that flushes after every write Set PYTHONUNBUFFERED env var sys.stdout = os.fdopen(sys.stdout.fi...
Disable output buffering
0.037482
0
0
341,073
108,822
2008-09-20T17:34:00.000
1
0
0
1
python,google-app-engine
8,444,988
19
false
1
0
Yes you can: Go to Datastore Admin, and then select the Entitiy type you want to delete and click Delete. Mapreduce will take care of deleting!
3
45
0
I would like to wipe out all data for a specific kind in Google App Engine. What is the best way to do this? I wrote a delete script (hack), but since there is so much data is timeout's out after a few hundred records.
Delete all data for a kind in Google App Engine
0.010526
0
0
29,003
108,822
2008-09-20T17:34:00.000
0
0
0
1
python,google-app-engine
2,245,189
19
false
1
0
You can use the task queues to delete chunks of say 100 objects. Deleting objects in GAE shows how limited the Admin capabilities are in GAE. You have to work with batches on 1000 entities or less. You can use the bulkloader tool that works with csv's but the documentation does not cover java. I am using GAE Java and m...
3
45
0
I would like to wipe out all data for a specific kind in Google App Engine. What is the best way to do this? I wrote a delete script (hack), but since there is so much data is timeout's out after a few hundred records.
Delete all data for a kind in Google App Engine
0
0
0
29,003
108,822
2008-09-20T17:34:00.000
3
0
0
1
python,google-app-engine
109,018
19
false
1
0
Unfortunately, there's no way to easily do a bulk delete. Your best bet is to write a script that deletes a reasonable number of entries per invocation, and then call it repeatedly - for example, by having your delete script return a 302 redirect whenever there's more data to delete, then fetching it with "wget --max-r...
3
45
0
I would like to wipe out all data for a specific kind in Google App Engine. What is the best way to do this? I wrote a delete script (hack), but since there is so much data is timeout's out after a few hundred records.
Delete all data for a kind in Google App Engine
0.031568
0
0
29,003
110,186
2008-09-21T03:41:00.000
6
0
0
1
python,django,google-app-engine
2,462,266
11
false
1
0
This question has been fully answered. Which is good. But one thing perhaps is worth mentioning. The google app engine has a plugin for the eclipse ide which is a joy to work with. If you already do your development with eclipse you are going to be so happy about that. To deploy on the google app engine's web site a...
4
126
0
Looking to do a very small, quick 'n dirty side project. I like the fact that the Google App Engine is running on Python with Django built right in - gives me an excuse to try that platform... but my question is this: Has anyone made use of the app engine for anything other than a toy problem? I see some good example a...
Feedback on using Google App Engine?
1
0
0
10,614
110,186
2008-09-21T03:41:00.000
36
0
0
1
python,django,google-app-engine
566,481
11
false
1
0
I am using GAE to host several high-traffic applications. Like on the order of 50-100 req/sec. It is great, I can't recommend it enough. My previous experience with web development was with Ruby (Rails/Merb). Learning Python was easy. I didn't mess with Django or Pylons or any other framework, just started from the...
4
126
0
Looking to do a very small, quick 'n dirty side project. I like the fact that the Google App Engine is running on Python with Django built right in - gives me an excuse to try that platform... but my question is this: Has anyone made use of the app engine for anything other than a toy problem? I see some good example a...
Feedback on using Google App Engine?
1
0
0
10,614
110,186
2008-09-21T03:41:00.000
23
0
0
1
python,django,google-app-engine
110,299
11
false
1
0
One of the compelling reasons I have come across for using Google App Engine is its integration with Google Apps for your domain. Essentially it allows you to create custom, managed web applications that are restricted to the (controlled) logins of your domain. Most of my experience with this code was building a simpl...
4
126
0
Looking to do a very small, quick 'n dirty side project. I like the fact that the Google App Engine is running on Python with Django built right in - gives me an excuse to try that platform... but my question is this: Has anyone made use of the app engine for anything other than a toy problem? I see some good example a...
Feedback on using Google App Engine?
1
0
0
10,614
110,186
2008-09-21T03:41:00.000
12
0
0
1
python,django,google-app-engine
110,225
11
false
1
0
The "App Engine running Django" idea is a bit misleading. App Engine replaces the entire Django model layer so be prepared to spend some time getting acclimated with App Engine's datastore which requires a different way of modeling and thinking about data.
4
126
0
Looking to do a very small, quick 'n dirty side project. I like the fact that the Google App Engine is running on Python with Django built right in - gives me an excuse to try that platform... but my question is this: Has anyone made use of the app engine for anything other than a toy problem? I see some good example a...
Feedback on using Google App Engine?
1
0
0
10,614
110,803
2008-09-21T11:27:00.000
-1
0
0
0
python,django
1,030,155
10
false
1
0
for everyone's information, muhuk's solution fails under python2.6 as it raises an exception stating 'object.__ init __()' accepts no argument... edit: ho! apparently it might've been me misusing the the mixin... I didnt pay attention and declared it as the last parent and because of that the call to init ended up in...
1
36
0
In my app i need to save changed values (old and new) when model gets saved. Any examples or working code? I need this for premoderation of content. For example, if user changes something in model, then administrator can see all changes in separate table and then decide to apply them or not.
Dirty fields in django
-0.019997
0
0
28,215
111,945
2008-09-21T20:11:00.000
8
0
0
0
python,http,put
114,648
14
false
0
0
I needed to solve this problem too a while back so that I could act as a client for a RESTful API. I settled on httplib2 because it allowed me to send PUT and DELETE in addition to GET and POST. Httplib2 is not part of the standard library but you can easily get it from the cheese shop.
1
225
0
I need to upload some data to a server using HTTP PUT in python. From my brief reading of the urllib2 docs, it only does HTTP POST. Is there any way to do an HTTP PUT in python?
Is there any way to do HTTP PUT in python
1
0
1
174,987
112,263
2008-09-21T21:45:00.000
2
0
0
0
python,tkinter,geometry,pack
112,337
4
true
0
1
The answer to your specific question is no. You can't have two states or otherwise use pack two different ways in the same parent. However, what I think you want to accomplish is simple. Use the built-in features of the canvas to create an image item that is part of the canvas, then pack things into the canvas as if i...
2
2
0
I want to put a Canvas with an image in my window, and then I want to pack widgets on top of it, so the Canvas acts as a background. Is it possible to have two states for the pack manager: one for one set of widgets and another for another set?
How do I overlap widgets with the Tkinter pack geometry manager?
1.2
0
0
3,016
112,263
2008-09-21T21:45:00.000
0
0
0
0
python,tkinter,geometry,pack
112,432
4
false
0
1
Not without swapping widget trees in and out, which I don't think can be done cleanly with Tk. Other toolkits can do this a little more elegantly. COM/VB/MFC can do this with an ActiveX control - you can hide/show multiple ActiveX controls in the same region. Any of the containers will let you do this by changing th...
2
2
0
I want to put a Canvas with an image in my window, and then I want to pack widgets on top of it, so the Canvas acts as a background. Is it possible to have two states for the pack manager: one for one set of widgets and another for another set?
How do I overlap widgets with the Tkinter pack geometry manager?
0
0
0
3,016
112,483
2008-09-21T23:10:00.000
1
0
0
0
python,qt,gtk,desktop
302,298
5
false
0
1
If you consider Qt, consider also throwing in kdelibs dependency, then you'll have marble widget, which handles maps in neat way. Thanks for advertizing Marble. But you are incorrect: The Marble Widget doesn't depend on kdelibs at all. It just depends on Qt (>=4.3). Additionally Marble also has just received Pytho...
3
1
0
I'm specifically looking for one that lets me display a map of US states with each one as it's own "object" in the sense that I can control the color, on click, and on mouseover of each one individually. GTK is my personal preference, but at this point I'd settle for just about anything. The application itself will b...
Does anyone know of a widget for a desktop toolkit(GTK, Qt, WX) for displaying a map of US states?
0.039979
0
0
906
112,483
2008-09-21T23:10:00.000
2
0
0
0
python,qt,gtk,desktop
146,015
5
false
0
1
If you consider Qt, consider also throwing in kdelibs dependency, then you'll have marble widget, which handles maps in neat way. If you stick only to Qt, then QGraphicsView is a framework to go. (note: kdelibs != running whole kde desktop)
3
1
0
I'm specifically looking for one that lets me display a map of US states with each one as it's own "object" in the sense that I can control the color, on click, and on mouseover of each one individually. GTK is my personal preference, but at this point I'd settle for just about anything. The application itself will b...
Does anyone know of a widget for a desktop toolkit(GTK, Qt, WX) for displaying a map of US states?
0.07983
0
0
906
112,483
2008-09-21T23:10:00.000
0
0
0
0
python,qt,gtk,desktop
122,701
5
false
0
1
Quick tip, if you color each state differently you can identify which one to pick from the color under mouse cursor rather than doing a complex point in polygon routine.
3
1
0
I'm specifically looking for one that lets me display a map of US states with each one as it's own "object" in the sense that I can control the color, on click, and on mouseover of each one individually. GTK is my personal preference, but at this point I'd settle for just about anything. The application itself will b...
Does anyone know of a widget for a desktop toolkit(GTK, Qt, WX) for displaying a map of US states?
0
0
0
906
112,532
2008-09-21T23:28:00.000
8
0
1
0
python,list,dictionary
112,557
16
false
0
0
One of the best ways to do this is to use a directed graph to store your dictionary. It takes a little bit of setting up, but once done it is fairly easy to then do the type of searches you are talking about. The nodes in the graph correspond to a letter in your word, so each node will have one incoming link and up to...
4
7
0
How would a go about making a program where the user enters a string, and the program generates a list of words beginning with that string? Ex: User: "abd" Program:abdicate, abdomen, abduct... Thanks! Edit: I'm using python, but I assume that this is a fairly language-independent problem.
List all words in a dictionary that start with
1
0
0
7,082
112,532
2008-09-21T23:28:00.000
1
0
1
0
python,list,dictionary
112,541
16
false
0
0
Try using regex to search through your list of words, e.g. /^word/ and report all matches.
4
7
0
How would a go about making a program where the user enters a string, and the program generates a list of words beginning with that string? Ex: User: "abd" Program:abdicate, abdomen, abduct... Thanks! Edit: I'm using python, but I assume that this is a fairly language-independent problem.
List all words in a dictionary that start with
0.012499
0
0
7,082
112,532
2008-09-21T23:28:00.000
1
0
1
0
python,list,dictionary
112,562
16
false
0
0
If you need to be really fast, use a tree: build an array and split the words in 26 sets based on the first letter, then split each item in 26 based on the second letter, then again. So if your user types "abd" you would look for Array[0][1][3] and get a list of all the words starting like that. At that point your list...
4
7
0
How would a go about making a program where the user enters a string, and the program generates a list of words beginning with that string? Ex: User: "abd" Program:abdicate, abdomen, abduct... Thanks! Edit: I'm using python, but I assume that this is a fairly language-independent problem.
List all words in a dictionary that start with
0.012499
0
0
7,082
112,532
2008-09-21T23:28:00.000
0
0
1
0
python,list,dictionary
112,843
16
false
0
0
If your dictionary is really big, i'd suggest indexing with a python text index (PyLucene - note that i've never used the python extension for lucene) The search would be efficient and you could even return a search 'score'. Also, if your dictionary is relatively static you won't even have the overhead of re-indexing ...
4
7
0
How would a go about making a program where the user enters a string, and the program generates a list of words beginning with that string? Ex: User: "abd" Program:abdicate, abdomen, abduct... Thanks! Edit: I'm using python, but I assume that this is a fairly language-independent problem.
List all words in a dictionary that start with
0
0
0
7,082
112,970
2008-09-22T03:04:00.000
2
0
1
0
python,file
112,993
6
false
0
0
According to Mr Van Rossum, although open() is currently an alias for file() you should use open() because this might change in the future.
3
140
0
What's the difference between file and open in Python? When should I use which one? (Say I'm in 2.5)
Python - When to use file vs open
0.066568
0
0
89,995
112,970
2008-09-22T03:04:00.000
4
0
1
0
python,file
112,990
6
false
0
0
Only ever use open() for opening files. file() is actually being removed in 3.0, and it's deprecated at the moment. They've had a sort of strange relationship, but file() is going now, so there's no need to worry anymore. The following is from the Python 2.6 docs. [bracket stuff] added by me. When opening a file, it’s...
3
140
0
What's the difference between file and open in Python? When should I use which one? (Say I'm in 2.5)
Python - When to use file vs open
0.132549
0
0
89,995
112,970
2008-09-22T03:04:00.000
33
0
1
0
python,file
112,989
6
false
0
0
Two reasons: The python philosophy of "There ought to be one way to do it" and file is going away. file is the actual type (using e.g. file('myfile.txt') is calling its constructor). open is a factory function that will return a file object. In python 3.0 file is going to move from being a built-in to being implemented...
3
140
0
What's the difference between file and open in Python? When should I use which one? (Say I'm in 2.5)
Python - When to use file vs open
1
0
0
89,995
114,283
2008-09-22T11:11:00.000
2
0
0
0
python,django
114,373
3
false
1
0
You could overload the get_form method of your model admin and add an extra checkbox to the generated form that has to be ticket. Alternatively you can override change_view and intercept the request.
2
9
0
I want to emulate the delete confirmation page behavior before saving certain models in the admin. In my case if I change one object, certain others should be deleted as they depend upon the object's now out-of-date state. I understand where to implement the actual cascaded updates (inside the parent model's save...
Where can a save confirmation page be hooked into the Django admin? (similar to delete confirmation)
0.132549
0
0
2,618
114,283
2008-09-22T11:11:00.000
1
0
0
0
python,django
114,348
3
false
1
0
I'm by no means a Django expert, so this answer might misguide you. Start looking somewhere around django.contrib.admin.options.ModelAdmin, especially render_change_form and response_change. I guess you would need to subclass ModelAdmin for your model and provide required behavior around those methods.
2
9
0
I want to emulate the delete confirmation page behavior before saving certain models in the admin. In my case if I change one object, certain others should be deleted as they depend upon the object's now out-of-date state. I understand where to implement the actual cascaded updates (inside the parent model's save...
Where can a save confirmation page be hooked into the Django admin? (similar to delete confirmation)
0.066568
0
0
2,618
116,139
2008-09-22T17:08:00.000
0
0
1
0
python,ms-word,openxml,docx
116,199
10
false
0
0
You should be able to use the MSWord ActiveX interface to extract the text to search (or, possibly, do the search). I have no idea how you access ActiveX from Python though.
4
51
0
I'd like to search a Word 2007 file (.docx) for a text string, e.g., "some special phrase" that could/would be found from a search within Word. Is there a way from Python to see the text? I have no interest in formatting - I just want to classify documents as having or not having "some special phrase".
How can I search a word in a Word 2007 .docx file?
0
0
0
47,992
116,139
2008-09-22T17:08:00.000
35
0
1
0
python,ms-word,openxml,docx
116,217
10
true
0
0
More exactly, a .docx document is a Zip archive in OpenXML format: you have first to uncompress it. I downloaded a sample (Google: some search term filetype:docx) and after unzipping I found some folders. The word folder contains the document itself, in file document.xml.
4
51
0
I'd like to search a Word 2007 file (.docx) for a text string, e.g., "some special phrase" that could/would be found from a search within Word. Is there a way from Python to see the text? I have no interest in formatting - I just want to classify documents as having or not having "some special phrase".
How can I search a word in a Word 2007 .docx file?
1.2
0
0
47,992
116,139
2008-09-22T17:08:00.000
4
0
1
0
python,ms-word,openxml,docx
116,194
10
false
0
0
A docx is just a zip archive with lots of files inside. Maybe you can look at some of the contents of those files? Other than that you probably have to find a lib that understands the word format so that you can filter out things you're not interested in. A second choice would be to interop with word and do the search ...
4
51
0
I'd like to search a Word 2007 file (.docx) for a text string, e.g., "some special phrase" that could/would be found from a search within Word. Is there a way from Python to see the text? I have no interest in formatting - I just want to classify documents as having or not having "some special phrase".
How can I search a word in a Word 2007 .docx file?
0.07983
0
0
47,992
116,139
2008-09-22T17:08:00.000
2
0
1
0
python,ms-word,openxml,docx
116,197
10
false
0
0
a docx file is essentially a zip file with an xml inside it. the xml contains the formatting but it also contains the text.
4
51
0
I'd like to search a Word 2007 file (.docx) for a text string, e.g., "some special phrase" that could/would be found from a search within Word. Is there a way from Python to see the text? I have no interest in formatting - I just want to classify documents as having or not having "some special phrase".
How can I search a word in a Word 2007 .docx file?
0.039979
0
0
47,992
116,657
2008-09-22T18:35:00.000
7
0
1
1
python,macos,packaging
116,901
1
false
0
0
I don't know the correct way to do it, but this manual method is the approach I've used for simple scripts which seems to have preformed suitably. I'll assume that whatever directory I'm in, the Python files for my program are in the relative src/ directory, and that the file I want to execute (which has the proper she...
1
25
0
I want to create a mac osx application from python package and then put it in a disk image. Because I load some resources out of the package, the package should not reside in a zip file. The resulting disk image should display the background picture to "drag here -> applications" for installation.
How do you create an osx application/dmg from a python package?
1
0
0
16,311
117,800
2008-09-22T21:37:00.000
1
0
0
0
python,django,autofield
118,331
8
false
1
0
The auto fields depend, to an extent, on the database driver being used. You'll have to look at the objects actually created for the specific database to see what's happening.
1
25
0
For our Django App, we'd like to get an AutoField to start at a number other than 1. There doesn't seem to be an obvious way to do this. Any ideas?
How to get Django AutoFields to start at a higher number
0.024995
0
0
14,912
118,221
2008-09-22T23:28:00.000
0
0
1
0
python
118,228
4
false
0
0
What platform are you running under? GObject is the basis of the GTK GUI that's widely-used under Linux, and it supports event loops with prioritizable events like this.
2
2
0
I need to allow other Python applications to register callback functions for events in my application. These need to have priorities associated with them (so a callback with a priority of 10 runs before a callback with a priority of 1) and callback functions need to be able to signal errors to the dispatcher. These ar...
What's the best dispatcher/callback library in Python?
0
0
0
1,912
118,221
2008-09-22T23:28:00.000
0
0
1
0
python
1,140,282
4
false
0
0
Try Twisted for anything network-related. Its perspective broker is quite nice to use.
2
2
0
I need to allow other Python applications to register callback functions for events in my application. These need to have priorities associated with them (so a callback with a priority of 10 runs before a callback with a priority of 1) and callback functions need to be able to signal errors to the dispatcher. These ar...
What's the best dispatcher/callback library in Python?
0
0
0
1,912
118,643
2008-09-23T01:33:00.000
3
0
1
0
python,accessibility
236,957
11
false
0
0
I use eclipse with the pydev extensions since it's an IDE I have a lot of experience with. I also appreciate the smart indentation it offers for coding if statements, loops, etc. I have configured the pindent.py script as an external tool that I can run on the currently focused python module which makes my life easier ...
3
83
0
I am a totally blind programmer who would like to learn Python. Unfortunately the fact that code blocks are represented with different levels of indentation is a major stumbling block. I was wondering if there were any tools available that would allow me to write code using braces or some other code block delimiter and...
Is there a way to convert indentation in Python code to braces?
0.054491
0
0
11,197
118,643
2008-09-23T01:33:00.000
4
0
1
0
python,accessibility
11,996,920
11
false
0
0
Searching an accessible Python IDE, found this and decided to answer. Under Windows with JAWS: Go to Settings Center by pressing JawsKey+6 (on the number row above the letters) in your favorite text editor. If JAWS prompts to create a new configuration file, agree. In the search field, type "indent" There will be only...
3
83
0
I am a totally blind programmer who would like to learn Python. Unfortunately the fact that code blocks are represented with different levels of indentation is a major stumbling block. I was wondering if there were any tools available that would allow me to write code using braces or some other code block delimiter and...
Is there a way to convert indentation in Python code to braces?
0.072599
0
0
11,197
118,643
2008-09-23T01:33:00.000
1
0
1
0
python,accessibility
453,806
11
false
0
0
There are various answers explaining how to do this. But I would recommend not taking this route. While you could use a script to do the conversion, it would make it hard to work on a team project. My recommendation would be to configure your screen reader to announce the tabs. This isn't as annoying as it sounds, sin...
3
83
0
I am a totally blind programmer who would like to learn Python. Unfortunately the fact that code blocks are represented with different levels of indentation is a major stumbling block. I was wondering if there were any tools available that would allow me to write code using braces or some other code block delimiter and...
Is there a way to convert indentation in Python code to braces?
0.01818
0
0
11,197
118,654
2008-09-23T01:37:00.000
5
0
0
0
.net,python,ironpython
118,680
9
false
1
0
If BeautifulSoup doesn't work on IronPython, it's because IronPython doesn't implement the whole Python language (the same way CPython does). BeautifulSoup is pure-python, no C-extensions, so the only problem is the compatibility of IronPython with CPython in terms of Python source code.There shouldn't be one, but if t...
5
21
0
Does beautiful soup work with iron python? If so with which version of iron python? How easy is it to distribute a windows desktop app on .net 2.0 using iron python (mostly c# calling some python code for parsing html)?
Iron python, beautiful soup, win32 app
0.110656
0
0
8,742
118,654
2008-09-23T01:37:00.000
-2
0
0
0
.net,python,ironpython
119,713
9
false
1
0
If you have the complete standard library and the real re module (google for IronPython community edition) it might work. But IronPython is an incredible bad python implementation, I wouldn't count on that. Besides, give html5lib a try. That parser parses with the same rules firefox parses documents.
5
21
0
Does beautiful soup work with iron python? If so with which version of iron python? How easy is it to distribute a windows desktop app on .net 2.0 using iron python (mostly c# calling some python code for parsing html)?
Iron python, beautiful soup, win32 app
-0.044415
0
0
8,742
118,654
2008-09-23T01:37:00.000
8
0
0
0
.net,python,ironpython
118,713
9
false
1
0
I've tested and used BeautifulSoup with both IPy 1.1 and 2.0 (forget which beta, but this was a few months back). Leave a comment if you are still having trouble and I'll dig out my test code and post it.
5
21
0
Does beautiful soup work with iron python? If so with which version of iron python? How easy is it to distribute a windows desktop app on .net 2.0 using iron python (mostly c# calling some python code for parsing html)?
Iron python, beautiful soup, win32 app
1
0
0
8,742
118,654
2008-09-23T01:37:00.000
0
0
0
0
.net,python,ironpython
118,671
9
false
1
0
I haven't tested it, but I'd say it'll most likely work with the latest IPy2. As for distribution, it's very simple. Use the -X:SaveAssemblies option to compile your Python code down to a binary and then ship it with your other DLLs and the IPy dependencies.
5
21
0
Does beautiful soup work with iron python? If so with which version of iron python? How easy is it to distribute a windows desktop app on .net 2.0 using iron python (mostly c# calling some python code for parsing html)?
Iron python, beautiful soup, win32 app
0
0
0
8,742
118,654
2008-09-23T01:37:00.000
1
0
0
0
.net,python,ironpython
287,247
9
false
1
0
We are distributing a 40k line IronPython application. We have not been able to compile the whole thing into a single binary distributable. Instead we have been distributing it as a zillion tiny dlls, one for each IronPython module. This works fine though. However, on the newer release, IronPython 2.0, we have a recent...
5
21
0
Does beautiful soup work with iron python? If so with which version of iron python? How easy is it to distribute a windows desktop app on .net 2.0 using iron python (mostly c# calling some python code for parsing html)?
Iron python, beautiful soup, win32 app
0.022219
0
0
8,742
118,813
2008-09-23T02:38:00.000
3
0
1
1
python,macos,osx-leopard,macports
2,621,262
7
false
0
0
The current Macports installer does the .profile PATH modification automatically.
3
19
0
I want to use the macports version of python instead of the one that comes with Leopard.
How do I uninstall python from OSX Leopard so that I can use the MacPorts version?
0.085505
0
0
22,721
118,813
2008-09-23T02:38:00.000
29
0
1
1
python,macos,osx-leopard,macports
118,824
7
false
0
0
Don't. Apple ships various system utilities that rely on the system Python (and particularly the Python "framework" build); removing it will cause you problems. Instead, modify your PATH environ variable in your ~/.bash_profile to put /opt/local/bin first.
3
19
0
I want to use the macports version of python instead of the one that comes with Leopard.
How do I uninstall python from OSX Leopard so that I can use the MacPorts version?
1
0
0
22,721
118,813
2008-09-23T02:38:00.000
4
0
1
1
python,macos,osx-leopard,macports
118,821
7
false
0
0
Instead of uninstalling the built-in Python, install the MacPorts version and then modify your $PATH to have the MacPorts version first. For example, if MacPorts installs /usr/local/bin/python, then modify your .bashrc to include PATH=/usr/local/bin:$PATH at the end.
3
19
0
I want to use the macports version of python instead of the one that comes with Leopard.
How do I uninstall python from OSX Leopard so that I can use the MacPorts version?
0.113791
0
0
22,721
119,198
2008-09-23T04:53:00.000
2
0
1
0
c#,python
119,386
8
false
1
0
Never stop learning! That said, how can you compare the two? How good is Python support in .Net? Is there C# support in Google App Engine? It really depends what your target system is. Therefore, the more languages you have the better equipped you will be to tackle different challenges.
6
3
0
Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better?
Is it good to switch from c# to python?
0.049958
0
0
5,513
119,198
2008-09-23T04:53:00.000
1
0
1
0
c#,python
119,208
8
false
1
0
Both are useful for different purposes. C# is a pretty good all-rounder, python's dynamic nature makes it more suitable for RAD experiences such as site building. I don't think your career will suffer if you were competant in both. To get going with Python consider an IDE with Python support such as Eclipse+PyDev o...
6
3
0
Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better?
Is it good to switch from c# to python?
0.024995
0
0
5,513
119,198
2008-09-23T04:53:00.000
1
0
1
0
c#,python
119,215
8
false
1
0
What's better is inherently subjective. If you like Python's syntax - learn it. It will probably be harder to find a Python job, C# and .NET in general seem to be more popular, but this may change. I also think it's worth to know at least one scripting language, even if your main job doesn't require it. Python is not a...
6
3
0
Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better?
Is it good to switch from c# to python?
0.024995
0
0
5,513
119,198
2008-09-23T04:53:00.000
3
0
1
0
c#,python
119,224
8
false
1
0
It can't hurt to learn Python, especially considering some of the heavy weights (Google) are really getting behind it. As for the actual use, it all depends on the application. Use the best tool for the job.
6
3
0
Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better?
Is it good to switch from c# to python?
0.07486
0
0
5,513
119,198
2008-09-23T04:53:00.000
0
0
1
0
c#,python
30,671,567
8
false
1
0
I have been thinking about this same question myself. I believe however there is still a lot of stuff C# can offer that I want to get good at before I job into Python. Because Python is easier to learn it. One advantage I have found in languages is not the language itself but the materials available to learning them...
6
3
0
Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better?
Is it good to switch from c# to python?
0
0
0
5,513
119,198
2008-09-23T04:53:00.000
1
0
1
0
c#,python
119,205
8
false
1
0
Depends on what you will use it for. If you're making enterprise Windows forms applications, I don't think switching to Python would be a good idea. Also, it is possible to still use Python on the .NET CLR with IronPython.
6
3
0
Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better?
Is it good to switch from c# to python?
0.024995
0
0
5,513
120,250
2008-09-23T10:35:00.000
3
0
1
0
python,memory-management,short
120,454
6
false
0
0
Armin's suggestion of the array module is probably best. Two possible alternatives: You can create an extension module yourself that provides the data structure that you're after. If it's really just something like a collection of shorts, then that's pretty simple to do. You can cheat and manipulate bits, so that yo...
2
27
0
Python allocates integers automatically based on the underlying system architecture. Unfortunately I have a huge dataset which needs to be fully loaded into memory. So, is there a way to force Python to use only 2 bytes for some integers (equivalent of C++ 'short')?
Short Integers in Python
0.099668
0
0
53,804
120,250
2008-09-23T10:35:00.000
3
0
1
0
python,memory-management,short
60,190,871
6
false
0
0
You can use NumyPy's int as np.int8 or np.int16.
2
27
0
Python allocates integers automatically based on the underlying system architecture. Unfortunately I have a huge dataset which needs to be fully loaded into memory. So, is there a way to force Python to use only 2 bytes for some integers (equivalent of C++ 'short')?
Short Integers in Python
0.099668
0
0
53,804
120,657
2008-09-23T12:28:00.000
1
0
0
1
python,windows,subprocess,command-line-arguments
120,992
6
false
0
0
"escaping the ampersand with ^" Are you sure ^ is an escape character to Windows? Shouldn't you use \?
3
5
0
I'm currently having a major issue with a python script. The script runs arbitrary commands through a handler to convert incorrect error reporting into correct error reporting. The issue I'm having is getting the script to work correctly on windows with a command that contains ampersands in it's path. I've attempted qu...
Python subprocess issue with ampersands
0.033321
0
0
5,909
120,657
2008-09-23T12:28:00.000
0
0
0
1
python,windows,subprocess,command-line-arguments
120,782
6
false
0
0
To answer my own question: Quoting the actual command when passing the parameters as a list doesn't work correctly (command is first item of list) so to solve the issue I turned the list into a space separated string and passed that into subprocess instead. Better solutions still welcomed.
3
5
0
I'm currently having a major issue with a python script. The script runs arbitrary commands through a handler to convert incorrect error reporting into correct error reporting. The issue I'm having is getting the script to work correctly on windows with a command that contains ampersands in it's path. I've attempted qu...
Python subprocess issue with ampersands
0
0
0
5,909
120,657
2008-09-23T12:28:00.000
1
0
0
1
python,windows,subprocess,command-line-arguments
120,705
6
false
0
0
A proper answer will need more information than that. What are you actually doing? How does it fail? Are you using the subprocess module? Are you passing a list of arguments and shell=False (or no shell argument) or are you actually invoking the shell?
3
5
0
I'm currently having a major issue with a python script. The script runs arbitrary commands through a handler to convert incorrect error reporting into correct error reporting. The issue I'm having is getting the script to work correctly on windows with a command that contains ampersands in it's path. I've attempted qu...
Python subprocess issue with ampersands
0.033321
0
0
5,909
121,439
2008-09-23T14:39:00.000
11
0
0
0
python,django,templates,stack-trace
122,482
5
false
1
0
As @zacherates says, you really don't want to display a stacktrace to your users. The easiest approach to this problem is what Django does by default if you have yourself and your developers listed in the ADMINS setting with email addresses; it sends an email to everyone in that list with the full stack trace (and mor...
2
25
0
I'm running Django 1.0 and I'm close to deploying my app. As such, I'll be changing the DEBUG setting to False. With that being said, I'd still like to include the stacktrace on my 500.html page when errors occur. By doing so, users can copy-and-paste the errors and easily email them to the developers. Any thoughts o...
How do I include a stacktrace in my Django 500.html page?
1
0
0
10,099
121,439
2008-09-23T14:39:00.000
1
0
0
0
python,django,templates,stack-trace
121,487
5
false
1
0
You could call sys.exc_info() in a custom exception handler. But I don't recommend that. Django can send you emails for exceptions.
2
25
0
I'm running Django 1.0 and I'm close to deploying my app. As such, I'll be changing the DEBUG setting to False. With that being said, I'd still like to include the stacktrace on my 500.html page when errors occur. By doing so, users can copy-and-paste the errors and easily email them to the developers. Any thoughts o...
How do I include a stacktrace in my Django 500.html page?
0.039979
0
0
10,099
122,327
2008-09-23T17:04:00.000
13
0
1
0
python,installation
122,387
22
false
0
0
An additional note to the get_python_lib function mentioned already: on some platforms different directories are used for platform specific modules (eg: modules that require compilation). If you pass plat_specific=True to the function you get the site packages for platform specific packages.
1
1,238
0
How do I find the location of my site-packages directory?
How do I find the location of my Python site-packages directory?
1
0
0
1,306,364
123,198
2008-09-23T19:23:00.000
-4
0
1
0
python,file,copy,filesystems,file-copying
69,868,767
21
false
0
0
shutil.copy(src, dst, *, follow_symlinks=True)
1
3,318
0
How do I copy a file in Python?
How to copy files?
-1
0
0
2,844,364
124,604
2008-09-23T23:50:00.000
11
1
1
0
python,perl,raku
124,804
8
false
0
0
In my opinion, Python's syntax is much cleaner, simpler, and consistent. You can define nested data structures the same everywhere, whether you plan to pass them to a function (or return them from one) or use them directly. I like Perl a lot, but as soon as I learned enough Python to "get" it, I never turned back. In...
4
26
0
Coming from a Perl 5 background, what are the advantages of moving to Perl 6 or Python?
I know Perl 5. What are the advantages of learning Perl 6, rather than moving to Python?
1
0
0
3,114
124,604
2008-09-23T23:50:00.000
25
1
1
0
python,perl,raku
124,797
8
false
0
0
There is no advantage to be gained by switching from Perl to Python. There is also no advantage to be gained by switching from Python to Perl. They are both equally capable. Choose your tools based on what you know and the problem you are trying to solve rather than on some sort of notion that one is somehow inherently...
4
26
0
Coming from a Perl 5 background, what are the advantages of moving to Perl 6 or Python?
I know Perl 5. What are the advantages of learning Perl 6, rather than moving to Python?
1
0
0
3,114
124,604
2008-09-23T23:50:00.000
4
1
1
0
python,perl,raku
127,627
8
false
0
0
You have not said why you want to move away from Perl*. If my crystal ball is functioning today then it is because you do not fully know the language and so it frustrates you. Stick with Perl and study the language well. If you do then one day you will be a guru and know why your question is irrelevant. Enlightment com...
4
26
0
Coming from a Perl 5 background, what are the advantages of moving to Perl 6 or Python?
I know Perl 5. What are the advantages of learning Perl 6, rather than moving to Python?
0.099668
0
0
3,114
124,604
2008-09-23T23:50:00.000
4
1
1
0
python,perl,raku
4,294,670
8
false
0
0
IMO python's regexing, esp. when you try to represent something like perl's /e operator as in s/whatever/somethingelse/e, becomes quite slow. So in doubt, you may need to stay with Perl5 :-)
4
26
0
Coming from a Perl 5 background, what are the advantages of moving to Perl 6 or Python?
I know Perl 5. What are the advantages of learning Perl 6, rather than moving to Python?
0.099668
0
0
3,114
125,034
2008-09-24T02:15:00.000
1
0
1
0
python,attributes,readonly
125,053
6
false
0
0
There is no real way to do this. There are ways to make it more 'difficult', but there's no concept of completely hidden, inaccessible class attributes. If the person using your class can't be trusted to follow the API docs, then that's their own problem. Protecting people from doing stupid stuff just means that they w...
1
8
0
In Python, I want to make selected instance attributes of a class be readonly to code outside of the class. I want there to be no way outside code can alter the attribute, except indirectly by invoking methods on the instance. I want the syntax to be concise. What is the best way? (I give my current best answer below.....
What is the easiest, most concise way to make selected attributes in an instance be readonly?
0.033321
0
0
395
125,222
2008-09-24T03:15:00.000
3
0
1
0
python,linux,ms-word
125,235
15
false
0
0
I'm not sure if you're going to have much luck without using COM. The .doc format is ridiculously complex, and is often called a "memory dump" of Word at the time of saving! At Swati, that's in HTML, which is fine and dandy, but most word documents aren't so nice!
1
28
0
for working with MS word files in python, there is python win32 extensions, which can be used in windows. How do I do the same in linux? Is there any library?
extracting text from MS word files in python
0.039979
0
0
64,780
125,703
2008-09-24T06:30:00.000
148
0
1
0
python,file,text
125,759
8
false
0
0
Unfortunately there is no way to insert into the middle of a file without re-writing it. As previous posters have indicated, you can append to a file or overwrite part of it using seek but if you want to add stuff at the beginning or the middle, you'll have to rewrite it. This is an operating system thing, not a Python...
1
209
0
I'm using Python, and would like to insert a string into a text file without deleting or copying the file. How can I do that?
How to modify a text file?
1
0
0
481,640
126,131
2008-09-24T09:05:00.000
8
0
0
0
javascript,python,html
126,250
2
false
1
0
The big complication here is emulating the full browser environment outside of a browser. You can use stand alone javascript interpreters like Rhino and SpiderMonkey to run javascript code but they don't provide a complete browser like environment to full render a web page. If I needed to solve a problem like this I wo...
1
18
0
Is there any python module for rendering a HTML page with javascript and get back a DOM object? I want to parse a page which generates almost all of its content using javascript.
Python library for rendering HTML and javascript
1
0
1
34,652
126,356
2008-09-24T10:14:00.000
1
0
0
0
python,facebook,turbogears
130,332
2
false
1
0
pyFacebook is Django-centric because it includes a Django example. I did not intend to irk, but am merely looking for a TurboGears example using pyFacebook.
2
2
0
I have a TurboGears application I'd like to run through Facebook, and am looking for an example TurboGears project using pyFacebook or minifb.py. pyFacebook is Django-centric, and I can probably figure it out, but this is, after all, the lazy web.
Example Facebook Application using TurboGears -- pyFacebook
0.099668
0
0
1,667
126,356
2008-09-24T10:14:00.000
3
0
0
0
python,facebook,turbogears
126,399
2
false
1
0
Why is pyFacebook django centric? Looks like it works perfectly fine with all kinds of WSGI apps or Python applications in general. No need to use Django.
2
2
0
I have a TurboGears application I'd like to run through Facebook, and am looking for an example TurboGears project using pyFacebook or minifb.py. pyFacebook is Django-centric, and I can probably figure it out, but this is, after all, the lazy web.
Example Facebook Application using TurboGears -- pyFacebook
0.291313
0
0
1,667
126,787
2008-09-24T12:21:00.000
2
1
0
0
python
126,843
2
true
1
0
As the author of one of the reloader mechanisms (the one in werkzeug) I can tell you that it doesn't work. What all the reloaders do is forking one time and restarting the child process if a monitor thread notices that one module changed on the file system. Inline reload()ing doesn't work because references to the rel...
1
2
0
Almost every Python web framework has a simple server that runs a wsgi application and automatically reloads the imported modules every time the source gets changed. I know I can look at the code and see how it's done, but that may take some time and I'm asking just out of curiosity. Does anyone have any idea how this ...
Checking for code changes in all imported python modules
1.2
0
0
304
127,454
2008-09-24T14:20:00.000
4
0
1
0
python
127,651
7
false
0
0
Build something cool in Python and share it with others. Small values of cool are still cool. Not everyone gets to write epic, world-changing software. Every problem solved well using Python is a way of showing how cool Python is.
5
13
0
I'm a pretty inexperienced programmer (can make tk apps, text processing, sort of understand oop), but Python is so awesome that I would like to help the community. What's the best way for a beginner to contribute?
Contributing to Python
0.113791
0
0
1,114
127,454
2008-09-24T14:20:00.000
0
0
1
0
python
127,787
7
false
0
0
Start by contributing to a Python project that you use and enjoy. This can be as simple as answering questions on the mailing list or IRC channel, offering to help with documentation and test writing or fixing bugs.
5
13
0
I'm a pretty inexperienced programmer (can make tk apps, text processing, sort of understand oop), but Python is so awesome that I would like to help the community. What's the best way for a beginner to contribute?
Contributing to Python
0
0
0
1,114
127,454
2008-09-24T14:20:00.000
1
0
1
0
python
127,501
7
false
0
0
If you aren't up to actually working on the Python core, there are still many ways to contribute.. 2 that immediately come to mind is: work on documentation.. it can ALWAYS be improved. Take your favorite modules and check out the documentation and add where you can. Reporting descriptive bugs is very helpful to the ...
5
13
0
I'm a pretty inexperienced programmer (can make tk apps, text processing, sort of understand oop), but Python is so awesome that I would like to help the community. What's the best way for a beginner to contribute?
Contributing to Python
0.028564
0
0
1,114
127,454
2008-09-24T14:20:00.000
7
0
1
0
python
127,601
7
true
0
0
Add to the docs. it is downright crappy Help out other users on the dev and user mailing lists. TEST PYTHON. bugs in programming languages are real bad. And I have seen someone discover atleast 1 bug in python Frequent the #python channel on irc.freenode.net
5
13
0
I'm a pretty inexperienced programmer (can make tk apps, text processing, sort of understand oop), but Python is so awesome that I would like to help the community. What's the best way for a beginner to contribute?
Contributing to Python
1.2
0
0
1,114
127,454
2008-09-24T14:20:00.000
3
0
1
0
python
127,493
7
false
0
0
I guess one way would be to help with documentation (translation, updating), until you are aware enough about the language. Also following the devs and users mail groups would give you a pretty good idea of what is being done and needs to be done by the community.
5
13
0
I'm a pretty inexperienced programmer (can make tk apps, text processing, sort of understand oop), but Python is so awesome that I would like to help the community. What's the best way for a beginner to contribute?
Contributing to Python
0.085505
0
0
1,114
128,466
2008-09-24T17:19:00.000
1
0
0
0
python,django
138,666
5
false
1
0
Only simplest sites are easy to upgrade. Expect real pain if your site happen to be for non-ASCII part of the world (read: anywhere outside USA and UK). The most painful change in Django was switching from bytestrings to unicode objects internally - now you have to find all places where you use bytestrings and change t...
4
8
0
Should I try to actually upgrade my existing app, or just rewrite it mostly from scratch, saving what pieces (templates, etc) I can?
What's the best way to upgrade from Django 0.96 to 1.0?
0.039979
0
0
896
128,466
2008-09-24T17:19:00.000
2
0
0
0
python,django
129,187
5
false
1
0
Just upgrade your app. The switch from 0.96 to 1.0 was huge, but in terms of Backwards Incompatible changes I doubt your app even has 10% of them. I was on trunk before Django 1.0 so I the transition for me was over time but even then the only major things I had to change were newforms, newforms-admin, str() to unicode...
4
8
0
Should I try to actually upgrade my existing app, or just rewrite it mostly from scratch, saving what pieces (templates, etc) I can?
What's the best way to upgrade from Django 0.96 to 1.0?
0.07983
0
0
896
128,466
2008-09-24T17:19:00.000
1
0
0
0
python,django
410,942
5
false
1
0
We upgraded in a multi step process and I'm quite happy with that. The application in Question was about 100.000 LoC and running several core business functions with lot's of interfacing to legacy systems. We worked like that: Update to django 0.97-post unicode merge. Fix all the unicode issues refactor the applicatio...
4
8
0
Should I try to actually upgrade my existing app, or just rewrite it mostly from scratch, saving what pieces (templates, etc) I can?
What's the best way to upgrade from Django 0.96 to 1.0?
0.039979
0
0
896
128,466
2008-09-24T17:19:00.000
7
0
0
0
python,django
128,496
5
true
1
0
Although this depends on what you're doing, most applications should be able to just upgrade and then fix everything that breaks. In my experience, the main things that I've had to fix after an upgrade are Changes to some of the funky stuff with models, such as the syntax for following foreign keys. A small set of te...
4
8
0
Should I try to actually upgrade my existing app, or just rewrite it mostly from scratch, saving what pieces (templates, etc) I can?
What's the best way to upgrade from Django 0.96 to 1.0?
1.2
0
0
896
128,689
2008-09-24T17:53:00.000
0
1
0
0
python,crud,turbogears
158,626
4
false
1
0
After doing some more digging and hacking it turns out to not be terribly hard to drop the Cakewalk interface into an application. It's not pretty without a lot of work, but it works right away.
1
3
0
Are there any good packages or methods for doing extensive CRUD (create-retrieve-update-delete) interfaces in the Turbogears framework. The FastDataGrid widget is too much of a black box to be useful and CRUDTemplate looks like more trouble than rolling my own. Ideas? Suggestions?
Doing CRUD in Turbogears
0
0
0
1,363
130,763
2008-09-25T00:22:00.000
2
0
0
1
python,windows,windows-vista,uac
22,821,704
11
false
0
0
You can make a shortcut somewhere and as the target use: python yourscript.py then under properties and advanced select run as administrator. When the user executes the shortcut it will ask them to elevate the application.
1
113
0
I want my Python script to copy files on Vista. When I run it from a normal cmd.exe window, no errors are generated, yet the files are NOT copied. If I run cmd.exe "as administator" and then run my script, it works fine. This makes sense since User Account Control (UAC) normally prevents many file system actions. Is th...
Request UAC elevation from within a Python script?
0.036348
0
0
126,138