Q_Id
int64
337
49.3M
CreationDate
stringlengths
23
23
Users Score
int64
-42
1.15k
Other
int64
0
1
Python Basics and Environment
int64
0
1
System Administration and DevOps
int64
0
1
Tags
stringlengths
6
105
A_Id
int64
518
72.5M
AnswerCount
int64
1
64
is_accepted
bool
2 classes
Web Development
int64
0
1
GUI and Desktop Applications
int64
0
1
Answer
stringlengths
6
11.6k
Available Count
int64
1
31
Q_Score
int64
0
6.79k
Data Science and Machine Learning
int64
0
1
Question
stringlengths
15
29k
Title
stringlengths
11
150
Score
float64
-1
1.2
Database and SQL
int64
0
1
Networking and APIs
int64
0
1
ViewCount
int64
8
6.81M
1,498,155
2009-09-30T13:32:00.000
1
1
0
1
python,c,embedded,fuzzy-logic
1,499,253
6
false
0
0
If most of your runtime is spent in C libraries, the language you use to call these libraries isn't important. What language are your time-eating libraries written in ?
6
5
0
I'm looking at implementing a fuzzy logic controller based on either PyFuzzy (Python) or FFLL (C++) libraries. I'd prefer to work with python but am unsure if the performance will be acceptable in the embedded environment it will work in (either ARM or embedded x86 proc both ~64Mbs of RAM). The main concern is that re...
Performance of Python worth the cost?
0.033321
0
0
1,593
1,498,155
2009-09-30T13:32:00.000
0
1
0
1
python,c,embedded,fuzzy-logic
1,502,231
6
false
0
0
From your description, speed should not be much of a concern (and you can use C, cython, whatever you want to make it faster), but memory would be. For environments with 64 Mb max (where the OS and all should fit as well, right ?), I think there is a good chance that python may not be the right tool for target deploym...
6
5
0
I'm looking at implementing a fuzzy logic controller based on either PyFuzzy (Python) or FFLL (C++) libraries. I'd prefer to work with python but am unsure if the performance will be acceptable in the embedded environment it will work in (either ARM or embedded x86 proc both ~64Mbs of RAM). The main concern is that re...
Performance of Python worth the cost?
0
0
0
1,593
1,498,155
2009-09-30T13:32:00.000
0
1
0
1
python,c,embedded,fuzzy-logic
1,612,690
6
false
0
0
I never really measured the performance of pyfuzzy's examples, but as the new version 0.1.0 can read FCL files as FFLL does. Just describe your fuzzy system in this format, write some wrappers, and check the performance of both variants. For reading FCL with pyfuzzy you need the antlr python runtime, but after reading ...
6
5
0
I'm looking at implementing a fuzzy logic controller based on either PyFuzzy (Python) or FFLL (C++) libraries. I'd prefer to work with python but am unsure if the performance will be acceptable in the embedded environment it will work in (either ARM or embedded x86 proc both ~64Mbs of RAM). The main concern is that re...
Performance of Python worth the cost?
0
0
0
1,593
1,498,155
2009-09-30T13:32:00.000
35
1
0
1
python,c,embedded,fuzzy-logic
1,498,214
6
true
0
0
In general, you shouldn't obsess over performance until you've actually seen it become a problem. Since we don't know the details of your app, we can't say how it'd perform if implemented in Python. And since you haven't implemented it yet, neither can you. Implement the version you're most comfortable with, and can im...
6
5
0
I'm looking at implementing a fuzzy logic controller based on either PyFuzzy (Python) or FFLL (C++) libraries. I'd prefer to work with python but am unsure if the performance will be acceptable in the embedded environment it will work in (either ARM or embedded x86 proc both ~64Mbs of RAM). The main concern is that re...
Performance of Python worth the cost?
1.2
0
0
1,593
1,498,155
2009-09-30T13:32:00.000
12
1
0
1
python,c,embedded,fuzzy-logic
1,498,176
6
false
0
0
Python is very slow at handling large amounts of non-string data. For some operations, you may see that it is 1000 times slower than C/C++, so yes, you should investigate into this and do necessary benchmarks before you make time-critical algorithms in Python. However, you can extend python with modules in C/C++ code, ...
6
5
0
I'm looking at implementing a fuzzy logic controller based on either PyFuzzy (Python) or FFLL (C++) libraries. I'd prefer to work with python but am unsure if the performance will be acceptable in the embedded environment it will work in (either ARM or embedded x86 proc both ~64Mbs of RAM). The main concern is that re...
Performance of Python worth the cost?
1
0
0
1,593
1,499,268
2009-09-30T16:31:00.000
-1
1
0
1
python,linux
1,499,282
3
false
0
0
Use the command sudo. In order to run a program as a user, the system must "authenticate" that user. Obviously, root can run any program as any user, and any user can su to another user with a password. The program sudo can be configured to allow a group of users to sudo a particular command as a particular user. For e...
2
14
0
On a Linux box I want to run a Python script as another user. I've already made a wrapper program in C++ that calls the script, since I've realized that the ownership of running the script is decided by the ownership of the python interpreter. After that I change the C++ program to a different user and run the C++ prog...
Running python script as another user
-0.066568
0
0
33,209
1,499,268
2009-09-30T16:31:00.000
0
1
0
1
python,linux
1,499,313
3
false
0
0
Give those users the ability to sudo su $dedicated_username and tailor the permissions on your system so that $dedicated_user has sufficient, but not excessive, access.
2
14
0
On a Linux box I want to run a Python script as another user. I've already made a wrapper program in C++ that calls the script, since I've realized that the ownership of running the script is decided by the ownership of the python interpreter. After that I change the C++ program to a different user and run the C++ prog...
Running python script as another user
0
0
0
33,209
1,499,572
2009-09-30T17:32:00.000
1
0
0
1
python,mysql,macos
2,302,542
2
false
0
0
You also need python_select (or is it select_python?) to change the default python used.
1
0
0
I just upgraded the default Python 2.5 on Leopard to 2.6 via the installer on www.python.org. Upon doing so, the MySQLdb I had installed was no longer found. So I tried reinstalling it via port install py-mysql, and it succeeded, but MySQLdb was still not importable. So then I tried to python install python26 with pyth...
With multiple Python installs, how does MacPorts know which one to install MySQLdb for?
0.099668
1
0
1,051
1,500,564
2009-09-30T20:46:00.000
2
1
0
0
python,scripting,numbers,profiler,line
1,500,818
3
false
0
0
cProfile does not track line numbers within a function; it only tracks the line number of where the function was defined. cProfile attempts to duplicate the behavior of profile (which is pure Python). profile uses pstats to store the data from running, and pstats only stores line numbers for function definitions, no...
1
5
0
I'm using cProfile, pstats and Gprof2dot to profile a rather long python script. The results tell me that the most time is spent calling a method in an object I've defined. However, what I would really like is to know exactly what line number within that function is eating up the time. Any idea's how to get this addit...
cProfile and Python: Finding the specific line number that code spends most time on
0.132549
0
0
2,434
1,501,907
2009-10-01T04:36:00.000
-1
0
0
1
python,google-app-engine,cron
1,501,925
4
false
1
0
Looking over the docs, I agree that your 24 cron entry idea is the only documented way that would work. Not ideal, but should work.
2
4
0
I need to run a task every hour on the hour (00:00, 01:00, 02:00, ..., 23:00) every day of the week, but can't seem to find an example in App Engine's docs of how to do this. There is an example of running at ask every hour, but this doesn't fit because the "start" of that hour depends on when you deploy the applicatio...
Run a task every hour on the hour with App Engine's cron API
-0.049958
0
0
3,297
1,501,907
2009-10-01T04:36:00.000
1
0
0
1
python,google-app-engine,cron
1,501,960
4
false
1
0
The docs say you can have 20 cron entries, so you can't have one for every hour of the day. You could run your task every minute and check if it is the first minute of the hour - exit otherwise.
2
4
0
I need to run a task every hour on the hour (00:00, 01:00, 02:00, ..., 23:00) every day of the week, but can't seem to find an example in App Engine's docs of how to do this. There is an example of running at ask every hour, but this doesn't fit because the "start" of that hour depends on when you deploy the applicatio...
Run a task every hour on the hour with App Engine's cron API
0.049958
0
0
3,297
1,502,431
2009-10-01T07:37:00.000
3
0
1
1
python,debugging,cherrypy
1,502,612
1
false
0
0
No. Not only does the wsgiserver start its own set of worker threads (10 by default, but even if you only specified 1 that's still 1 thread for the listening socket and 1 worker thread). Even if that were not true, if you use the rest of CherryPy (i.e. the engine), it runs that 1 listener thread in a separate thread fr...
1
1
0
Is it possible to use the CherrPy server as a blocking/non-threading server (for easier debugging?)
Using CherryPy as a blocking/non-threading server for easier debugging
0.53705
0
0
934
1,504,804
2009-10-01T15:55:00.000
5
1
1
0
c#,.net,ironpython
1,551,802
4
false
1
0
If I wanted to just "learn the framework", I would do it in C# or VB for two main reasons: Intellisense - the framework is huge, and being offered suggestions for function overloads is one of the ways to find new stuff. There's almost no good intellisense for the framework with IronPython at the moment (Michael Foord...
3
4
0
Because I'm a Python fan, I'd like to learn the .NET framework using IronPython. Would I be missing out on something? Is this in some way not recommended? EDIT: I'm pretty knowledgeable of Java ( so learning/using a new language is not a problem for me ). If needed, will I be able to use everything I learned in IronPyt...
Using IronPython to learn the .NET framework, is this bad?
0.244919
0
0
477
1,504,804
2009-10-01T15:55:00.000
11
1
1
0
c#,.net,ironpython
1,504,823
4
true
1
0
No, sounds like a good way to learn to me. You get to stick with a language and syntax that you are familiar with, and learn about the huge range of classes available in the framework, and how the CLR supports your code. Once you've got to grips with some of the framework and the CLR services you could always pick up C...
3
4
0
Because I'm a Python fan, I'd like to learn the .NET framework using IronPython. Would I be missing out on something? Is this in some way not recommended? EDIT: I'm pretty knowledgeable of Java ( so learning/using a new language is not a problem for me ). If needed, will I be able to use everything I learned in IronPyt...
Using IronPython to learn the .NET framework, is this bad?
1.2
0
0
477
1,504,804
2009-10-01T15:55:00.000
5
1
1
0
c#,.net,ironpython
1,504,904
4
false
1
0
You can definitely do that to learn the class library, but I'm not sure if it's such a good idea when it comes to fundamental CLR concepts (e.g. delegates and events). You'll need to pay attention and distinguish what is strictly an IronPython feature, and what is CLR feature exposed in IronPython in a way that matches...
3
4
0
Because I'm a Python fan, I'd like to learn the .NET framework using IronPython. Would I be missing out on something? Is this in some way not recommended? EDIT: I'm pretty knowledgeable of Java ( so learning/using a new language is not a problem for me ). If needed, will I be able to use everything I learned in IronPyt...
Using IronPython to learn the .NET framework, is this bad?
0.244919
0
0
477
1,505,744
2009-10-01T18:45:00.000
0
0
0
1
python,networking,network-programming,twisted
1,506,213
3
false
1
0
Why not use a database instead of "just a structure"? Both relational and non-relational DBs offer many practical advantages (separate processes using them, take care of replication [[and/or snapshots, backups, ...]], rich functionality if you need it for the "queries", and so on, and so forth). Worst case, the "just ...
1
0
0
I have a problem as follows: Server process 1 Constantly sends updates that occur to a datastore Server process 2 Clients contact the server, which queries the datastore, and returns a result The thing is, the results that process 1 and process 2 are sending back the client are totally different and unrelated. How ...
Network programming abstraction, decomposition
0
0
0
290
1,506,647
2009-10-01T21:37:00.000
3
0
0
0
python,matplotlib,boxplot
1,506,741
3
false
0
0
Try axis('equal'). It's been a while since I worked with matplotlib, but I seem to remember typing that command a lot.
1
4
1
I have a plot of two boxplots in the same figure. For style reasons, the axis should have the same length, so that the graphic box is square. I tried to use the set_aspect method, but the axes are too different because of their range and the result is terrible. Is it possible to have 1:1 axes even if they do not have t...
Matplotlib square boxplot
0.197375
0
0
8,361
1,506,901
2009-10-01T22:45:00.000
314
1
1
0
python,datetime,date,time
1,506,916
7
true
0
0
datetime.date.today() + datetime.timedelta(days=1) should do the trick
1
166
0
What is the cleanest and most Pythonic way to get tomorrow's date? There must be a better way than to add one to the day, handle days at the end of the month, etc.
Cleanest and most Pythonic way to get tomorrow's date?
1.2
0
0
110,489
1,507,041
2009-10-01T23:32:00.000
10
0
1
0
python
1,507,054
8
false
0
0
Read other people's code. Write some of your own code. Repeat for a year or two. Study the Python documentation and learn the built-in modules. Read Python in a Nutshell. Subscribe your RSS reader to the Python tag on Stack Overflow.
3
10
0
Once you have learned the basic commands in Python, you are often able to solve most programming problem you face. But the way in which this is done is not really Python-ic. What is common is to use the classical c++ or Java mentality to solve problems. But Python is more than that. It has functional programming incor...
How do I get fluent in Python?
1
0
0
14,330
1,507,041
2009-10-01T23:32:00.000
2
0
1
0
python
1,507,058
8
false
0
0
I guess becoming fluent in any programming language is the same as becoming fluent in a spoken/written language. You do that by speaking and listening to the language, a lot. So my advice is to do some projects using python, and you will soon become fluent in it. You can complement this by reading other people's code w...
3
10
0
Once you have learned the basic commands in Python, you are often able to solve most programming problem you face. But the way in which this is done is not really Python-ic. What is common is to use the classical c++ or Java mentality to solve problems. But Python is more than that. It has functional programming incor...
How do I get fluent in Python?
0.049958
0
0
14,330
1,507,041
2009-10-01T23:32:00.000
3
0
1
0
python
1,507,068
8
false
0
0
The same way you get fluent in any language - program a lot. I'd recommend working on a project (hopefully something you'll actually use later). While working on the project, every time you need some basic piece of functionality, try writing it yourself, and then checking online how other people did it. This both lets ...
3
10
0
Once you have learned the basic commands in Python, you are often able to solve most programming problem you face. But the way in which this is done is not really Python-ic. What is common is to use the classical c++ or Java mentality to solve problems. But Python is more than that. It has functional programming incor...
How do I get fluent in Python?
0.07486
0
0
14,330
1,507,075
2009-10-01T23:44:00.000
0
0
0
0
python,file-io,wxpython,wxwidgets,mmap
1,507,087
2
false
0
1
Are people really going to read (or need) all 10MB in a text control? Probably not. Suggest that, you load on demand by paging in portions of the data. Or better still, provide some user search functionality that narrows down the results to the information of interest.
1
0
0
I am trying to display search result data quickly. I have all absolute file paths for files on my network drive(s) in a single, ~50MB text file. The python script makes a single pass over every line in this file [kept on the local drive] in a second or less, and that is acceptable. That is the time it takes to gather ...
wx.TextCtrl.LoadFile()
0
0
0
1,831
1,507,082
2009-10-01T23:47:00.000
2
0
1
0
python,exception
1,507,245
7
false
0
0
I concur with all of the above. There's really no other way to signal that something went wrong in the initialisation of an object other than raising an exception. In most programs classes where the state of a class is wholly dependant on the inputs to that class we might expect some kind of ValueError or TypeError to...
5
153
0
Is it considered bad form to raise exceptions within __init__? If so, then what is the accepted method of throwing an error when certain class variables are initialized as None or of an incorrect type?
Python: Is it bad form to raise exceptions within __init__?
0.057081
0
0
65,275
1,507,082
2009-10-01T23:47:00.000
3
0
1
0
python,exception
1,507,112
7
false
0
0
I should think it is the perfect case for the built-in ValueError exception.
5
153
0
Is it considered bad form to raise exceptions within __init__? If so, then what is the accepted method of throwing an error when certain class variables are initialized as None or of an incorrect type?
Python: Is it bad form to raise exceptions within __init__?
0.085505
0
0
65,275
1,507,082
2009-10-01T23:47:00.000
2
0
1
0
python,exception
18,825,585
7
false
0
0
Raising errors from init is unavoidable in some cases, but doing too much work in init is a bad style. You should consider making a factory or a pseudo-factory - a simple classmethod that returns setted up object.
5
153
0
Is it considered bad form to raise exceptions within __init__? If so, then what is the accepted method of throwing an error when certain class variables are initialized as None or of an incorrect type?
Python: Is it bad form to raise exceptions within __init__?
0.057081
0
0
65,275
1,507,082
2009-10-01T23:47:00.000
187
0
1
0
python,exception
1,507,127
7
true
0
0
Raising exceptions within __init__() is absolutely fine. There's no other good way to indicate an error condition within an initializer, and there are many hundreds of examples in the standard library where initializing an object can raise an exception. The error class to raise, of course, is up to you. ValueError is b...
5
153
0
Is it considered bad form to raise exceptions within __init__? If so, then what is the accepted method of throwing an error when certain class variables are initialized as None or of an incorrect type?
Python: Is it bad form to raise exceptions within __init__?
1.2
0
0
65,275
1,507,082
2009-10-01T23:47:00.000
11
0
1
0
python,exception
1,507,130
7
false
0
0
I don't see any reason that it should be bad form. On the contrary, one of the things exceptions are known for doing well, as opposed to returning error codes, is that error codes usually can't be returned by constructors. So at least in languages like C++, raising exceptions is the only way to signal errors.
5
153
0
Is it considered bad form to raise exceptions within __init__? If so, then what is the accepted method of throwing an error when certain class variables are initialized as None or of an incorrect type?
Python: Is it bad form to raise exceptions within __init__?
1
0
0
65,275
1,508,256
2009-10-02T08:09:00.000
7
1
1
0
python,comparison,language-features,smalltalk,language-comparisons
1,508,312
5
false
0
0
Python certainly does have metaclasses. Smalltalk has some unusual features: Has a rather simple syntax and only about 6 (!) keywords. Everything else (including defining new classes) is accomplished by calling methods (sending messages in Smalltalk). This allows you to create some DSL within the language. In Smalltal...
1
7
0
I've seen some comparisons between Smalltalk and Ruby on the one hand and Ruby and Python on the other, but not between Python and Smalltalk. I'd especially like to know what the fundamental differences in Implementation, Syntax, Extensiabillity and Philosophy are. For example Python does not seem to have Metaclasses....
How does Smalltalk (Pharo for example) compare to Python?
1
0
0
3,672
1,508,906
2009-10-02T11:03:00.000
5
0
1
0
python
1,508,919
8
false
0
0
You really want to stick with the later version. Python 2.6 and the rest of the 2.x versions that come out are really for compatibility. However, this is not true if you want to use a framework like Django right away because it is incompatible with the 3.x series at the moment. A tip for learning Python? Just start usi...
4
6
0
I am about to learn Python and was wondering what is recommended, learning python 2.6 or 3.1? (any tips on learning python is welcomed as well =) edit: Is the difference really big between the two? If I learn python 2 will i have trouble learning python 3?
python 2.6 or python 3.1?
0.124353
0
0
2,505
1,508,906
2009-10-02T11:03:00.000
-1
0
1
0
python
1,508,931
8
false
0
0
If you want to use existing libraries and modules written in C/C++ or use SWIG, you'll have to use python2, otherwise I don't really see a reason to stick with python2.
4
6
0
I am about to learn Python and was wondering what is recommended, learning python 2.6 or 3.1? (any tips on learning python is welcomed as well =) edit: Is the difference really big between the two? If I learn python 2 will i have trouble learning python 3?
python 2.6 or python 3.1?
-0.024995
0
0
2,505
1,508,906
2009-10-02T11:03:00.000
10
0
1
0
python
1,508,929
8
false
0
0
I would go with 2.6 for a couple of reasons. There's so much more material (books, examples, etc) based on 2.6. Some things might not work under 3.x, and you'll be able to get some good second-hand deals on 2.4-6 books. The majority of libraries you'll want to pull in are still aimed at 2.6. This will change in time, ...
4
6
0
I am about to learn Python and was wondering what is recommended, learning python 2.6 or 3.1? (any tips on learning python is welcomed as well =) edit: Is the difference really big between the two? If I learn python 2 will i have trouble learning python 3?
python 2.6 or python 3.1?
1
0
0
2,505
1,508,906
2009-10-02T11:03:00.000
5
0
1
0
python
1,509,308
8
false
0
0
You would want to go with 2.6 today. Why? Because there is no library support for 3.1. We've just finished porting setuptools (under the name Distribute) to Python 3, so hopefully library support for Python 3 will increase dramatically during the next year, but it's not there yet. And it's not so hard to switch. It's n...
4
6
0
I am about to learn Python and was wondering what is recommended, learning python 2.6 or 3.1? (any tips on learning python is welcomed as well =) edit: Is the difference really big between the two? If I learn python 2 will i have trouble learning python 3?
python 2.6 or python 3.1?
0.124353
0
0
2,505
1,509,404
2009-10-02T13:10:00.000
1
0
0
0
python,mechanize
1,509,434
1
true
0
0
By parsing the browser contents with lxml, which has xpath support.
1
0
0
I've got a form, returned by Python mechanize Browser and got via forms() method. How can I perform XPath search inside form node, that is, among descendant nodes of the HTML form node? TIA Upd: How to save html code of the form?
How to search XPath inside Python ClientForm object?
1.2
0
1
596
1,510,018
2009-10-02T14:52:00.000
-1
0
1
0
python,sqlalchemy,constraints
1,510,137
2
false
0
0
I'm pretty sure that unique constraints can only be applied on columns that already have data in them, and not on runtime-calculated expressions. Hence, you would need to create an extra column which contains the year part of your date, over which you could create a unique constraint together with number. To best use t...
1
3
0
A quick SQLAlchemy question... I have a class "Document" with attributes "Number" and "Date". I need to ensure that there's no duplicated number for the same year, is there a way to have a UniqueConstraint on "Number + year(Date)"? Should I use a unique Index instead? How would I declare the functional part? (SQLAlc...
Compound UniqueConstraint with a function
-0.099668
1
0
890
1,510,084
2009-10-02T15:01:00.000
1
0
0
0
python,ruby-on-rails,frameworks,python-3.x
1,510,491
5
false
0
0
Python 3 isn't ready for web applications right now. The WSGI 1.0 specification isn't suitable for Py3k and the related standard libraries are 2to3 hacks that don't work consistently faced with bytes vs. unicode. It's a real mess. WEB-SIG are bashing out proposals for a WSGI revision; hopefully it can move forward soon...
3
1
0
One of the feature I like in RoR is the db management, it can hide all the sql statement, also, it is very easy to change different db in RoR, is there any similar framework in Python 3000?
Is there any framework like RoR on Python 3000?
0.039979
1
0
614
1,510,084
2009-10-02T15:01:00.000
0
0
0
0
python,ruby-on-rails,frameworks,python-3.x
1,510,218
5
false
0
0
Python 3 is not ready for practical use, because there is not yet enough libraries that have been updated to support Python 3. So the answer is: No. But there are LOADS of them on Python 2. Tens, at least. Django, Turbogears, BFG and of course the old man of the game: Zope. To tell which is best for you, you need to ex...
3
1
0
One of the feature I like in RoR is the db management, it can hide all the sql statement, also, it is very easy to change different db in RoR, is there any similar framework in Python 3000?
Is there any framework like RoR on Python 3000?
0
1
0
614
1,510,084
2009-10-02T15:01:00.000
2
0
0
0
python,ruby-on-rails,frameworks,python-3.x
1,512,245
5
false
0
0
I believe CherryPy is on the verge of being released for Python 3.X.
3
1
0
One of the feature I like in RoR is the db management, it can hide all the sql statement, also, it is very easy to change different db in RoR, is there any similar framework in Python 3000?
Is there any framework like RoR on Python 3000?
0.07983
1
0
614
1,510,188
2009-10-02T15:17:00.000
0
1
1
0
python,utf-8,codec,seek
1,510,303
4
false
0
0
Update: You can't do seek/tell on the object returned by codec.open(). You need to use a normal file, and decode the strings to unicode after reading. I do not know why it doesn't work but I can't make it work. The seek seems to only work once, for example. Then you need to close and reopen the file, which is of course...
3
6
0
I have an application that generates some large log files > 500MB. I have written some utilities in Python that allows me to quickly browse the log file and find data of interest. But I now get some datasets where the file is too big to load it all into memory. I thus want to scan the document once, build an index and ...
Can seek and tell work with UTF-8 encoded documents in Python?
0
0
0
2,140
1,510,188
2009-10-02T15:17:00.000
3
1
1
0
python,utf-8,codec,seek
1,510,276
4
true
0
0
If true, this sounds like a bug or limitation of the codecs module, as it's probably confusing byte and character offsets. I would use the regular open() function for opening the file, then seek()/tell() will give you byte offsets that are always consistent. Whenever you want to read, use f.readline().decode('utf-8'). ...
3
6
0
I have an application that generates some large log files > 500MB. I have written some utilities in Python that allows me to quickly browse the log file and find data of interest. But I now get some datasets where the file is too big to load it all into memory. I thus want to scan the document once, build an index and ...
Can seek and tell work with UTF-8 encoded documents in Python?
1.2
0
0
2,140
1,510,188
2009-10-02T15:17:00.000
2
1
1
0
python,utf-8,codec,seek
1,510,282
4
false
0
0
For UTF-8, you don't actually need to open the file with codecs.open. Instead, it is reliable to read the file as a byte string first, and only then decode an individual section (invoking the .decode method on the string). Breaking the file at line boundaries is safe; the only unsafe way to split it would be in the mid...
3
6
0
I have an application that generates some large log files > 500MB. I have written some utilities in Python that allows me to quickly browse the log file and find data of interest. But I now get some datasets where the file is too big to load it all into memory. I thus want to scan the document once, build an index and ...
Can seek and tell work with UTF-8 encoded documents in Python?
0.099668
0
0
2,140
1,511,808
2009-10-02T21:13:00.000
3
0
1
0
python,file,distribution,py2exe,distutils
1,511,907
2
true
0
0
I just used shutil.copytree, which takes an ignore kwd arg.
1
2
0
I want to copy a data directory into my distribution dir. copy_tree does this just fine. However, the project is also an svn repository, and I don't want the distribution to have all the .svn files that the data dir has. Is there any easy way to do a copy_tree excluding the .svn files, or should I just write my own rec...
Python distutils - copy_tree with filter
1.2
0
0
2,747
1,511,854
2009-10-02T21:22:00.000
4
1
1
0
python,module,cron
3,256,325
3
false
0
0
I could be wrong but doesn't python crontab offer ways to read and write to crontab but nothing regarding parsing the crontab to determine the time until the next time a job will be run?
1
4
0
All. I am trying to find a python module that I can use to parse a cron entry and get the next time it will run. With perl I use the Schedule::Cron::Events module but I would like to convert to python. Thanks in advance.
Parse a cron entry in Python
0.26052
0
0
8,165
1,512,389
2009-10-03T00:21:00.000
3
0
0
0
python,google-app-engine,web-applications
1,512,414
2
true
1
0
You'd have to wrap the instance of WSGIApplication with your own WSGI app that lowercases the URL in the WSGI environment -- but then the environment would just stay modified, which may have other unpleasant effects. Why not just add (?i) to the regex patterns you use in urlpatterns instead?
1
0
0
Is there any straightforward to convert all incoming urls to lowercase before they get matched against urlpatterns in run_wsgi_app(webapp.WSGIApplication(urlpatterns))?
Converting urls into lowercase?
1.2
0
0
344
1,512,530
2009-10-03T01:33:00.000
3
0
1
1
python,macos,port,osx-leopard,lxml
1,513,810
2
false
0
0
Ned : incompatible changes in the 2.6.3 version of python's distutil Not precisely. The API hasn't changed but Setuptools overrides them, and makes the assumption they are called in a particular order. Lennart: The Distribute installation doesn't seem to trigger the bug Yes indeed, this precise bug was detected som...
1
4
0
I try to: easy_install lxml and I get this error: File "build/bdist.macosx-10.3-fat/egg/setuptools/command/build_ext.py", line 85, in get_ext_filename KeyError: 'etree' any hints?
can't install lxml (python 2.6.3, osx 10.6 snow leopard)
0.291313
0
0
2,271
1,512,644
2009-10-03T02:45:00.000
1
1
1
0
python,release-management,pypi
1,513,884
2
true
0
0
You don't need to release eggs for anything else than Windows, and then only if your package uses C extensions so that they have compiled parts. Otherwise you simply release one source distribution. That will be enough for all Python versions on all platforms. Running the tests for different versions automated is trick...
1
5
0
I've got several eggs I maintain on Pypi but up until now I've always focused on Python 2.5x. I'd like to release my eggs under both Python 2.5 & Python 2.6 in an automated fashion i.e. running tests generating doc preparing eggs uploading to Pypi How do you guys achieve this? A related question: how do I tag an egg...
Python Pypi: what is your process for releasing packages for different Python versions? (Linux)
1.2
0
0
817
1,513,038
2009-10-03T07:04:00.000
1
0
0
1
iphone,python,web-services,google-app-engine
1,514,062
2
false
1
0
Looks like you're not setting the Content-Type header correctly in your service (assuming you ARE actually trying to send XML -- e.g. SOAP, XML-RPC, &c). What code are you using to set that header? Without some indication about what protocol you're implementing and via what framework, it's impossible to help in detail...
2
0
0
We made a simple application and using GoogleAppEngineLauncher (GAEL) ran that locally. Then we deployed, using GAEL again, to our appid. It works fine. Now, we made a web service. We ran that locally using GAEL and a very thin local python client. It works fine. We deployed that, and we get this message when we try t...
Deploying a web service to my Google App Engine application
0.099668
0
0
369
1,513,038
2009-10-03T07:04:00.000
0
0
0
1
iphone,python,web-services,google-app-engine
1,604,138
2
true
1
0
Looks like we aren't going to get to the bottom of this one. Just not enough information available at debug time. We've managed to affect a fix on the service, although I hate ot admit it we never found out what was causing this bug.
2
0
0
We made a simple application and using GoogleAppEngineLauncher (GAEL) ran that locally. Then we deployed, using GAEL again, to our appid. It works fine. Now, we made a web service. We ran that locally using GAEL and a very thin local python client. It works fine. We deployed that, and we get this message when we try t...
Deploying a web service to my Google App Engine application
1.2
0
0
369
1,513,062
2009-10-03T07:17:00.000
9
1
0
0
python,wordpress,drupal,content-management-system,social-networking
1,513,657
6
true
0
0
Difficult decision. Normally I would say 'definitely Drupal' without hesitation, as Drupal was build as a System for community sites from the beginning, whereas Wordpress still shows its heritage as a blogging solution, at least that's what I hear quite often. But then I'm working with Drupal all the time recently and ...
1
2
0
I am making a community for web-comic artist who will be able to sync their existing website to this site. However, I am in debate for what CMS I should use: Drupal or Wordpress. I have heard great things about Drupal, where it is really aimed for Social Networking. I actually got to play a little bit in the back end o...
Drupal or Wordpress CMS as a Social Network?
1.2
0
1
3,472
1,513,543
2009-10-03T11:40:00.000
0
1
0
0
python,openid,rpxnow
1,513,794
1
true
0
0
I believe that OpenID lets the user decide how much information to "share" during the login process. I can't say that I am an expert on the subject, but I know that my identity at myopenid.com lets me specify precisely what information to make available. Is it possible that the AOL default is to share nothing? If thi...
1
0
0
I can't seem to fetch the verifiedEmail field when trying to login to AOLs OpenID on my site. Every other provider that I know of provides this property, but not AOL. I realize that AOL somehow uses an old OpenID version, although is it feasible to just assume that their e-mail ends in @aol.com? I'm using the RPXNow li...
verifiedEmail AOL OpenID
1.2
0
0
166
1,513,823
2009-10-03T14:08:00.000
2
0
0
0
python,mechanize
1,513,899
3
false
1
0
Some wild ideas: Fetch the second page before filling in the form? Or fetch the new page and then goBack()? Although maybe that will reset the values.
1
3
0
There is a Python mechanize object with a form with almost all values set, but not yet submitted. Now I want to fetch another page using cookies from mechanize instance, but without resetting the page, forms and so on, e.g. so that the values remain set (I just need to get body string of another page, nothing else). So...
How to get a http page using mechanize cookies?
0.132549
0
1
1,699
1,514,228
2009-10-03T16:40:00.000
3
1
1
0
python,data-persistence,dynamic-import
1,514,234
5
false
0
0
The biggest drawback is that it's a potential security problem since it's hard to guarantee that the files won't contains arbitrary code, which could be really bad. So don't use this approach if anyone else than you have write-access to the files.
3
3
0
This is what I've done for a project. I have a few data structures that are bascially dictionaries with some methods that operate on the data. When I save them to disk, I write them out to .py files as code that when imported as a module will load the same data into such a data structure. Is this reasonable? Are there ...
Is it reasonable to save data as python modules?
0.119427
0
0
351
1,514,228
2009-10-03T16:40:00.000
3
1
1
0
python,data-persistence,dynamic-import
1,514,248
5
true
0
0
It's reasonable, and I do it all the time. Obviously it's not a format you use to exchange data, so it's not a good format for anything like a save file. But for example, when I do migrations of websites to Plone, I often get data about the site (such as a list of which pages should be migrated, or a list of how old u...
3
3
0
This is what I've done for a project. I have a few data structures that are bascially dictionaries with some methods that operate on the data. When I save them to disk, I write them out to .py files as code that when imported as a module will load the same data into such a data structure. Is this reasonable? Are there ...
Is it reasonable to save data as python modules?
1.2
0
0
351
1,514,228
2009-10-03T16:40:00.000
7
1
1
0
python,data-persistence,dynamic-import
1,514,250
5
false
0
0
By operating this way, you may gain some modicum of convenience, but you pay many kinds of price for that. The space it takes to save your data, and the time it takes to both save and reload it, go up substantially; and your security exposure is unbounded -- you must ferociously guard the paths from which you reload mo...
3
3
0
This is what I've done for a project. I have a few data structures that are bascially dictionaries with some methods that operate on the data. When I save them to disk, I write them out to .py files as code that when imported as a module will load the same data into such a data structure. Is this reasonable? Are there ...
Is it reasonable to save data as python modules?
1
0
0
351
1,514,755
2009-10-03T20:26:00.000
5
0
0
0
python,django,cherrypy
1,514,830
7
false
1
0
CherryPy is web server "http framework", while Django supports web application front-to-end: it provides object-relational mapper, template, session management, automagically generates DB schema and all CRUD screens, and more.
7
35
0
CherryPy vs Django, which would you use and why?
CherryPy vs Django
0.141893
0
0
26,287
1,514,755
2009-10-03T20:26:00.000
4
0
0
0
python,django,cherrypy
13,001,017
7
false
1
0
I think they're both great, but I'm not a fan of full stack frameworks. CherryPy is a lot easier to use and much more flexible.
7
35
0
CherryPy vs Django, which would you use and why?
CherryPy vs Django
0.113791
0
0
26,287
1,514,755
2009-10-03T20:26:00.000
45
0
0
0
python,django,cherrypy
1,514,816
7
true
1
0
They're not exactly comparable. CherryPy provides url routing and a request/response abstraction, which makes prototyping very easy (although I find vanilla mod_python just as convenient). Django is a complete web application "stack", including a templating system and an object-relational mapper.
7
35
0
CherryPy vs Django, which would you use and why?
CherryPy vs Django
1.2
0
0
26,287
1,514,755
2009-10-03T20:26:00.000
6
0
0
0
python,django,cherrypy
1,514,785
7
false
1
0
I would use Django because of its large user base and existing modules (including the built-in admin interface) but I would imaging that CherryPy is more flexible than Django. You just have to look at the available options, figure out what you want to do and choose the platform that supports that the best.
7
35
0
CherryPy vs Django, which would you use and why?
CherryPy vs Django
1
0
0
26,287
1,514,755
2009-10-03T20:26:00.000
6
0
0
0
python,django,cherrypy
1,514,768
7
false
1
0
Django, because the community is so much larger. You'll find more 3rd-party modules you can use and you'll find much more support.
7
35
0
CherryPy vs Django, which would you use and why?
CherryPy vs Django
1
0
0
26,287
1,514,755
2009-10-03T20:26:00.000
11
0
0
0
python,django,cherrypy
1,520,944
7
false
1
0
Though e.e. coli has already provided the accepted answer (and a good one at that), one thing I'll say in favor of CherryPy is that it is also implements WSGI out of the box. What this means is that, unlike the mod_python approach mentioned (which I believe is still an Apache-only solution)*, it provides abstraction f...
7
35
0
CherryPy vs Django, which would you use and why?
CherryPy vs Django
1
0
0
26,287
1,514,755
2009-10-03T20:26:00.000
13
0
0
0
python,django,cherrypy
7,599,911
7
false
1
0
Django is vast, and difficult to learn, functions, tags and what not, you will absolutely are a computational genius if you have figured Django out completely. "full-stack" means every thing is available, you just have to spend the time looking for it :( CherryPy is light and clean and far less complex. Compare the sta...
7
35
0
CherryPy vs Django, which would you use and why?
CherryPy vs Django
1
0
0
26,287
1,515,686
2009-10-04T05:35:00.000
2
0
0
0
python,sockets,nonblocking
1,515,698
4
false
0
0
Why socket alone? It's so much simpler to use another standard library module, asyncore -- and if you can't, at the very least select! If you're constrained by your homework's condition to only use socket, then I hope you can at least add threading (or multiprocessing), otherwise you're seriously out of luck -- you can...
1
0
0
Can someone please tell how to write a Non-Blocking server code using the socket library alone.Thanks
Non Blocking Server in Python
0.099668
0
1
2,625
1,515,850
2009-10-04T07:45:00.000
0
0
1
0
python,windows-xp
1,515,858
5
false
0
0
Why do you want to do it? Everything that's in 3.0 is in 2.6, you can use the new features in 3.0 with from __future__ import. Run 2.6 until you're ready to upgrade to 3.0 for everything, then upgrade. You're not intended to have multiple versions of Python on the same machine. If you really want to, you can specify al...
2
3
0
What kind of setup do people use to run both python 2.6 and python 3.0 on the same windows machine?
how to run both python 2.6 and 3.0 on the same windows XP box?
0
0
0
691
1,515,850
2009-10-04T07:45:00.000
1
0
1
0
python,windows-xp
1,515,971
5
false
0
0
-You could use a batch file to launch with the appropriate version. -Eclipse with pydev allows you to choose which version to launch with. -Re-associate the .py/.pyw extension with your preferred version.
2
3
0
What kind of setup do people use to run both python 2.6 and python 3.0 on the same windows machine?
how to run both python 2.6 and 3.0 on the same windows XP box?
0.039979
0
0
691
1,517,038
2009-10-04T18:23:00.000
0
1
1
0
python,refresh,reload
27,299,101
7
false
0
0
I had the exact same issue creating a geoprocessing script for ArcGIS 10.2. I had a python toolbox script, a tool script and then a common script. I have a parameter for Dev/Test/Prod in the tool that would control which version of the code was run. Dev would run the code in the dev folder, test from test folder and pr...
1
29
0
This is a very basic question - but I haven't been able to find an answer by searching online. I am using python to control ArcGIS, and I have a simple python script, that calls some pre-written code. However, when I make a change to the pre-written code, it does not appear to result in any change. I import this module...
python refresh/reload
0
0
0
106,481
1,517,259
2009-10-04T20:08:00.000
2
0
1
0
python,keyboard-shortcuts,ipython
1,517,291
1
false
0
0
You say you have multiple instances installed -- are these all on different machines? What operating system(s) are they running? If you access them remotely, what operating system are you running? Do you get to them using ssh? Do you run something like screen, either locally or remotely, or both? There are lots of thin...
1
0
0
I use IPython very frequently and happily. Somehow, cutting text from the shell using the keyboard shortcut, Ctrl + X, is broken. Actually, I have a few different installations of IPython. In some of the installations, the shortcut works; in the others, it doesn't work. What might be the reason for this? Where should I...
Cutting text from IPython shell using Ctrl-X is broken
0.379949
0
0
274
1,517,347
2009-10-04T20:48:00.000
10
0
1
0
python,algorithm,sorting,python-internals
1,517,357
3
false
0
0
In early python-versions, the sort function implemented a modified version of quicksort. However, it was deemed unstable and as of 2.3 they switched to using an adaptive mergesort algorithm.
1
128
1
What algorithm is the built in sort() method in Python using? Is it possible to have a look at the code for that method?
About Python's built in sort() method
1
0
0
71,971
1,517,428
2009-10-04T21:29:00.000
1
0
1
0
c#,python,vim,ide
1,517,444
11
false
0
0
Good IDE for python are Komodo or Eclipse with PyDev. But even Notepad++ or any other text editor will enough to get you started, since you don't need to compile your code, just have a good editor. The benefit of the above IDEs, is that you can use them to manage a large scale project and debug your code. As for the cr...
2
2
0
I'm locked in using C# and I don't like it one bit. I have to start branching out to better myself as a professional and as a person, so I've decided to start making things in my own time using Python. The problem is, I've basically programmed only in C#. What IDE should I use to make programs using Python? My goal is ...
Coming from a Visual Studio background, what do you recommend I use to start my VERY FIRST Python project?
0.01818
0
0
619
1,517,428
2009-10-04T21:29:00.000
0
0
1
0
c#,python,vim,ide
1,517,475
11
false
0
0
Eclipse + Pydev is currently the gold standard IDE for Python. It's cross platform and since it's a general purpose IDE it has support for just about every other programming activity you might want to consider. Eclipse is not bad for C++, and very mature for Java developers. It's quite amazing when you realize that al...
2
2
0
I'm locked in using C# and I don't like it one bit. I have to start branching out to better myself as a professional and as a person, so I've decided to start making things in my own time using Python. The problem is, I've basically programmed only in C#. What IDE should I use to make programs using Python? My goal is ...
Coming from a Visual Studio background, what do you recommend I use to start my VERY FIRST Python project?
0
0
0
619
1,517,771
2009-10-05T00:26:00.000
12
0
0
0
python,sqlite
1,517,795
3
false
0
0
Generally, you do this by stringifying the list (with repr()), and then saving the string. On reading the string from the database, use eval() to re-create the list. Be careful, though that you are certain no user-generated data can get into the column, or the eval() is a security risk.
1
12
0
I want 3 columns to have 9 different values, like a list in Python. Is it possible? If not in SQLite, then on another database engine?
Is it possible to save a list of values into a SQLite column?
1
1
0
25,012
1,518,699
2009-10-05T07:40:00.000
1
0
0
1
python,linux
1,518,829
6
false
0
0
When an USB device is plugged in syslog writes messages concerning this to /var/log/messages. The "dmesg" command shows this log. You can check near the end of the log to see which channel the device was attached to, it is usually /dev/sd(letter)(number) depending on the partitions and number of serial disks plugged i...
3
5
0
How can I detect when a flash drive is plugged in? I'm using a bare Debian installation, without any GUI and want to be notified in my Python script when a new flash drive appears... I know that D-BUS distributes such information, but i dont want to use D-BUS. Is there a more bare access to that information? Shouldn't ...
How can I detect when a flash drive is plugged in under Linux?
0.033321
0
0
6,498
1,518,699
2009-10-05T07:40:00.000
0
0
0
1
python,linux
16,370,716
6
false
0
0
I did this using zenity in a script and udev with rule on rhel6 with: KERNEL=="sd[b-d]", DRIVERS=="usb", ACTION=="add", RUN+="/path/to/script"
3
5
0
How can I detect when a flash drive is plugged in? I'm using a bare Debian installation, without any GUI and want to be notified in my Python script when a new flash drive appears... I know that D-BUS distributes such information, but i dont want to use D-BUS. Is there a more bare access to that information? Shouldn't ...
How can I detect when a flash drive is plugged in under Linux?
0
0
0
6,498
1,518,699
2009-10-05T07:40:00.000
0
0
0
1
python,linux
1,518,728
6
false
0
0
/proc/partitions shows all the partitions known to the kernel.
3
5
0
How can I detect when a flash drive is plugged in? I'm using a bare Debian installation, without any GUI and want to be notified in my Python script when a new flash drive appears... I know that D-BUS distributes such information, but i dont want to use D-BUS. Is there a more bare access to that information? Shouldn't ...
How can I detect when a flash drive is plugged in under Linux?
0
0
0
6,498
1,518,725
2009-10-05T07:50:00.000
0
0
0
0
python,google-app-engine,bulk-load
1,519,020
2
false
1
0
I think you're going to need to be more specific as to what problem you're having. As far as bulk loading goes, there's lots of bulkloader documentation around; or are you asking about model design? If so, we need to know more about how you plan to search for users. Do you need partial string matches? Sorting? Fuzzy ma...
1
0
0
Hi I want some help in building a Phone book application on python and put it on google app engine. I am running a huge db of 2 million user lists and their contacts in phonebook. I want to upload all that data from my servers directly onto the google servers and then use a UI to retrieve the phone book contacts of eac...
Need help in designing a phone book application on python running on google app engine
0
1
0
420
1,519,074
2009-10-05T09:37:00.000
0
0
0
0
python,ssl
1,520,341
4
false
0
0
It is impossible to verify a self-signed certificate because of its very nature: it is self-signed. You have to sign a certificate by some other trusted third party's certificate to be able to verify anything, and after this you can add that third party's certificate to the list of your trusted CAs and then you will b...
1
9
0
I was trying to find out how I can go about verifying a self-signed certificate by a server in python. I could not find much data in google. I also want to make sure that the server url Thanks in advance for any insights.
Verifying peer in SSL using python
0
0
1
6,958
1,520,234
2009-10-05T13:56:00.000
0
0
0
0
python,numpy,version
53,898,417
17
false
0
0
It is good to know the version of numpy you run, but strictly speaking if you just need to have specific version on your system you can write like this: pip install numpy==1.14.3 and this will install the version you need and uninstall other versions of numpy.
2
340
1
How can I check which version of NumPy I'm using?
How do I check which version of NumPy I'm using?
0
0
0
514,245
1,520,234
2009-10-05T13:56:00.000
11
0
0
0
python,numpy,version
46,330,631
17
false
0
0
You can try this: pip show numpy
2
340
1
How can I check which version of NumPy I'm using?
How do I check which version of NumPy I'm using?
1
0
0
514,245
1,520,576
2009-10-05T14:52:00.000
0
0
1
0
python,vim
1,520,822
4
false
0
0
Try hitting Ctrl-p while typing mid-word. Ctrl-p inserts the most recent word that starts with the prefix you're typing and Ctrl-n inserts the next match. If you have several possibilities, you can hit ctrl-p more than once to substitute each candidate in order.
2
4
0
I've gotten omnicompletion with Pysmell to work before, but I can't seem to do it again. I tried following some steps online, but most, if not all, of them are to vague and assume too much that you know what you are doing to some extent. Can someone post a full, step-by-step tutorial on how to get code completion work...
Getting proper code completion for Python on Vim?
0
0
0
7,163
1,520,576
2009-10-05T14:52:00.000
4
0
1
0
python,vim
1,523,392
4
false
0
0
There's also Ctrl+n in insert mode which will autocomplete based on the words it has seen in any of the open buffers (even in other tabs).
2
4
0
I've gotten omnicompletion with Pysmell to work before, but I can't seem to do it again. I tried following some steps online, but most, if not all, of them are to vague and assume too much that you know what you are doing to some extent. Can someone post a full, step-by-step tutorial on how to get code completion work...
Getting proper code completion for Python on Vim?
0.197375
0
0
7,163
1,520,953
2009-10-05T16:04:00.000
0
0
0
1
python,comet
1,751,708
3
false
1
0
Extending what lost-theory has said, if you want to use comet for a passing messages between clients then you need to implement something like pubsub. Using something like tornado for the pubsub is much simpler than with the single threaded wsgiref servers.
2
1
0
I'm developing a web interface for an already existing desktop application. I've been looking for a way to allow the server to push content to the browser and ended up reaching Comet. Navigating through the internet, and most of the questions here, I got answers like twisted, orbited, tornado and most of them even poin...
Basic Comet in Python using just std lib
0
0
0
719
1,520,953
2009-10-05T16:04:00.000
0
0
0
1
python,comet
1,520,980
3
false
1
0
This is possible. Just don't close the connection to the client.
2
1
0
I'm developing a web interface for an already existing desktop application. I've been looking for a way to allow the server to push content to the browser and ended up reaching Comet. Navigating through the internet, and most of the questions here, I got answers like twisted, orbited, tornado and most of them even poin...
Basic Comet in Python using just std lib
0
0
0
719
1,521,670
2009-10-05T18:28:00.000
1
0
0
0
python,com,wxpython,parent
1,522,240
2
false
0
0
How's PP's control flow? If it's event-driven it could get appropriate events upon closure of that parent window or termination of that AP process; otherwise it could "poll" to check if the window or process are still around.
1
0
0
I have a Python program (PP) that loads another Program(AP) via COM, gets its window handle and sets it to be the PP parent. This works pretty well except that I can't control that AP still has their [X] button available in the top left corner. Since this is a pretty obvious place for the user to close when they are d...
Close Python when Parent is closed
0.099668
0
0
181
1,522,636
2009-10-05T21:59:00.000
6
0
0
0
python,urllib
1,522,662
5
false
0
0
Strictly speaking, this is true. But in practice, once (if) urllib goes out of scope, the connection will be closed by the automatic garbage collector.
2
73
0
I'm new to Python and reading someone else's code: should urllib.urlopen() be followed by urllib.close()? Otherwise, one would leak connections, correct?
should I call close() after urllib.urlopen()?
1
0
1
53,885
1,522,636
2009-10-05T21:59:00.000
1
0
0
0
python,urllib
55,125,414
5
false
0
0
You basically do need to explicitly close your connection when using IronPython. The automatic closing on going out of scope relies on the garbage collection. I ran into a situation where the garbage collection did not run for so long that Windows ran out of sockets. I was polling a webserver at high frequency (i.e. as...
2
73
0
I'm new to Python and reading someone else's code: should urllib.urlopen() be followed by urllib.close()? Otherwise, one would leak connections, correct?
should I call close() after urllib.urlopen()?
0.039979
0
1
53,885
1,522,844
2009-10-05T23:02:00.000
2
0
0
0
python,django,fastcgi,lighttpd,flup
1,531,138
2
true
1
0
I've looked at this on django running as fastcgi on both Slicehost (django 1.1, python 2.6) and Dreamhost (django 1.0, python 2.5), and I can say this: Running the top command shows the processes use a large amount of CPU to start up for ~2-3 seconds, then drop down to 0 almost immediately. Running the ps aux command a...
2
1
0
I'm running Django as threaded fastcgi via flup, served by lighttpd, communicating via sockets. What is the expected CPU usage for each fastcgi thread under no load? On startup, each thread runs at 3-4% cpu usage for a while, and then backs off to around .5% over the course of a couple of hours. It doesn't sink below t...
flup/fastcgi cpu usage under no-load conditions
1.2
0
0
792
1,522,844
2009-10-05T23:02:00.000
0
0
0
0
python,django,fastcgi,lighttpd,flup
1,526,653
2
false
1
0
Your fast-cgi threads must not consume any (noticeable) CPU if there are no requests to process. You should investigate the load you are describing. I use the same architecture and my threads are completely idle.
2
1
0
I'm running Django as threaded fastcgi via flup, served by lighttpd, communicating via sockets. What is the expected CPU usage for each fastcgi thread under no load? On startup, each thread runs at 3-4% cpu usage for a while, and then backs off to around .5% over the course of a couple of hours. It doesn't sink below t...
flup/fastcgi cpu usage under no-load conditions
0
0
0
792
1,522,951
2009-10-05T23:43:00.000
2
0
0
0
php,python,html,dropbox
2,074,899
3
false
1
0
If you can install the DropBox client on the webserver then it would be simple to let it sync your folder and then iterate over the contents of the folder with a programming language (PHP, Python, .NET etc) and produce the gallery page. This could be done every time the page is requested or as a scheduled job which re...
1
2
0
I'd like to know if the following situation and scripts are at all possible: I'm looking to have a photo-gallery (Javascript) webpage that will display in order of the latest added to the Dropbox folder (PHP or Python?). That is, when someone adds a picture to the Dropbox folder, there is a script on the webpage that...
Update a gallery webpage via Dropbox?
0.132549
0
1
4,092
1,523,465
2009-10-06T03:37:00.000
-5
0
1
0
python,binary
49,278,853
10
false
0
0
x = x + 1 print(x) a = x + 5 print(a)
5
105
0
How can I add, subtract, and compare binary numbers in Python without converting to decimal?
Binary numbers in Python
-1
0
0
228,134
1,523,465
2009-10-06T03:37:00.000
-1
0
1
0
python,binary
71,345,969
10
false
0
0
For example, 00000011 - 00000001 = 00000010 You can remove the zeroes and then add them again after you do your calculation! This works very easy. If your binary is stored as a string then you can convert to int which will automatically strip the zeroes from the start. After you have your answer you can turn it back in...
5
105
0
How can I add, subtract, and compare binary numbers in Python without converting to decimal?
Binary numbers in Python
-0.019997
0
0
228,134
1,523,465
2009-10-06T03:37:00.000
10
0
1
0
python,binary
1,523,478
10
false
0
0
I think you're confused about what binary is. Binary and decimal are just different representations of a number - e.g. 101 base 2 and 5 base 10 are the same number. The operations add, subtract, and compare operate on numbers - 101 base 2 == 5 base 10 and addition is the same logical operation no matter what base you...
5
105
0
How can I add, subtract, and compare binary numbers in Python without converting to decimal?
Binary numbers in Python
1
0
0
228,134
1,523,465
2009-10-06T03:37:00.000
3
0
1
0
python,binary
1,523,477
10
false
0
0
Binary, decimal, hexadecimal... the base only matters when reading or outputting numbers, adding binary numbers is just the same as adding decimal number : it is just a matter of representation.
5
105
0
How can I add, subtract, and compare binary numbers in Python without converting to decimal?
Binary numbers in Python
0.059928
0
0
228,134
1,523,465
2009-10-06T03:37:00.000
-7
0
1
0
python,binary
33,672,372
10
false
0
0
I think you're confused about what binary is. Binary and decimal are just different representations of a number - e.g. 101 base 2 and 5 base 10 are the same number. The operations add, subtract, and compare operate on numbers - 101 base 2 == 5 base 10 and addition is the same logical operation no matter what base you'r...
5
105
0
How can I add, subtract, and compare binary numbers in Python without converting to decimal?
Binary numbers in Python
-1
0
0
228,134
1,523,706
2009-10-06T05:13:00.000
1
0
0
1
python,python-3.x,werkzeug
1,622,505
3
false
1
0
I can only answer question one: I started using it for some small webstuff but now moved on to rework larger apps with it. Why Werkzeug? The modular concept is really helpful. You can hook in modules as you like, make stuff easily context aware and you get good request file handling for free which is able to cope with ...
3
2
0
I've been looking really hard at all of the way**(s)** one can develop web applications using Python. For reference, we are using RHEL 64bit, apache, mod_wsgi. History: PHP + MySQL years ago PHP + Python 2.x + MySQL recently and current Python + PostgreSQL working on it We use a great library for communicating betwe...
Werkzeug in General, and in Python 3.1
0.066568
1
0
2,259
1,523,706
2009-10-06T05:13:00.000
1
0
0
1
python,python-3.x,werkzeug
1,523,934
3
false
1
0
I haven't used Werkzeug, so I can only answer question 2: No, Werkzeug does not work on Python 3. In fact, very little works on Python 3 as of today. Porting is not difficult, but you can't port until all your third-party libraries have been ported, so progress is slow. One big stopper has been setuptools, which is a v...
3
2
0
I've been looking really hard at all of the way**(s)** one can develop web applications using Python. For reference, we are using RHEL 64bit, apache, mod_wsgi. History: PHP + MySQL years ago PHP + Python 2.x + MySQL recently and current Python + PostgreSQL working on it We use a great library for communicating betwe...
Werkzeug in General, and in Python 3.1
0.066568
1
0
2,259
1,523,706
2009-10-06T05:13:00.000
3
0
0
1
python,python-3.x,werkzeug
1,525,943
3
false
1
0
mod_wsgi for Python 3.x is also not ready. There is no satisfactory definition of WSGI for Python 3.x yet; the WEB-SIG are still bashing out the issues. mod_wsgi targets a guess at what might be in it, but there are very likely to be changes to both the spec and to standard libraries. Any web application you write toda...
3
2
0
I've been looking really hard at all of the way**(s)** one can develop web applications using Python. For reference, we are using RHEL 64bit, apache, mod_wsgi. History: PHP + MySQL years ago PHP + Python 2.x + MySQL recently and current Python + PostgreSQL working on it We use a great library for communicating betwe...
Werkzeug in General, and in Python 3.1
0.197375
1
0
2,259
1,523,874
2009-10-06T06:17:00.000
1
1
0
1
python,c,packaging,distutils
1,523,993
2
true
0
0
distutils can be used to install end user programs, but it's most useful when using it for Python libraries, as it can create source packages and also install them in the correct place. For that I would say it's more or less required. But for an end user Python program you can also use make or whatever you like and are...
2
0
0
I have an open source project containing both Python and C code. I'm wondering that is there any use for distutils for me, because I'm planning to do a ubuntu/debian package. The C code is not something that I could or want to use as Python extension. C and Python programs communicate with TCP/IP through localhost. So ...
Reasons to use distutils when packaging C/Python project
1.2
0
0
284
1,523,874
2009-10-06T06:17:00.000
1
1
0
1
python,c,packaging,distutils
1,525,194
2
false
0
0
Because it uses an unified python setup.py install command? distutils, or setuptools? Whatever, just use one of those. For development, it's also really useful because you don't have to care where to find such and such dependency. As long as it's standard Python/basic system library stuff, setup.py should find it for y...
2
0
0
I have an open source project containing both Python and C code. I'm wondering that is there any use for distutils for me, because I'm planning to do a ubuntu/debian package. The C code is not something that I could or want to use as Python extension. C and Python programs communicate with TCP/IP through localhost. So ...
Reasons to use distutils when packaging C/Python project
0.099668
0
0
284
1,524,606
2009-10-06T09:45:00.000
0
0
0
0
c#,python,ruby
1,524,622
1
false
1
0
Applet should be better if your application is not depended on IE. If for IE only then use COM/ActiveX
1
0
0
Can I use applets to inform me which hardware is installed on client system (fingerprint reader)? And if it is installed, can it tell me its version, so that it can download the proper plugin from a site? So that after everything is OK, the user can use his fingerprint reader to authenticate himself?
Is an applet a proper solution for hardware detection and driver install?
0
0
0
101
1,524,609
2009-10-06T09:47:00.000
2
0
1
0
c#,python,programming-languages,boo
1,524,626
5
false
0
0
You have lists and dictionaries in .Net: System.Collections.Generic.List and System.collections.Generic.Dictionary. As for the language: Just learn the one that is more fun for you. The choice of language is most often religious. Expecially on the .Net platform, where each language has almost the same capabilities.
3
11
0
Compared to C#, Boo feels a bit more Pythonic but it's also compiled down to .NET MSIL. I liked its syntax, even more than C#'s syntax. But I couldn't find a single book teaching Boo. And I really don't know, if learning Boo is better than C# or learning C# is better than Boo. I just want to use some Python-like data t...
Boo vs C# vs Python?
0.07983
0
0
15,993
1,524,609
2009-10-06T09:47:00.000
5
0
1
0
c#,python,programming-languages,boo
1,524,633
5
false
0
0
My general opinion is that it would be better to go for C# since it is from my point of view, easier to find resources, documentation and tutorials for C#.
3
11
0
Compared to C#, Boo feels a bit more Pythonic but it's also compiled down to .NET MSIL. I liked its syntax, even more than C#'s syntax. But I couldn't find a single book teaching Boo. And I really don't know, if learning Boo is better than C# or learning C# is better than Boo. I just want to use some Python-like data t...
Boo vs C# vs Python?
0.197375
0
0
15,993
1,524,609
2009-10-06T09:47:00.000
15
0
1
0
c#,python,programming-languages,boo
1,525,499
5
true
0
0
I have found Boo to be very useful in creating simple one-off scripts, while retaining my Pythonic source style. And since it compiles to runnable EXE or DLL, I can package up a single EXE with all the needed DLLs (including Boo.Lang.dll) using ILMerge, and then send that off to a client, usually for some kind of quic...
3
11
0
Compared to C#, Boo feels a bit more Pythonic but it's also compiled down to .NET MSIL. I liked its syntax, even more than C#'s syntax. But I couldn't find a single book teaching Boo. And I really don't know, if learning Boo is better than C# or learning C# is better than Boo. I just want to use some Python-like data t...
Boo vs C# vs Python?
1.2
0
0
15,993