Q_Id int64 337 49.3M | CreationDate stringlengths 23 23 | Users Score int64 -42 1.15k | Other int64 0 1 | Python Basics and Environment int64 0 1 | System Administration and DevOps int64 0 1 | Tags stringlengths 6 105 | A_Id int64 518 72.5M | AnswerCount int64 1 64 | is_accepted bool 2
classes | Web Development int64 0 1 | GUI and Desktop Applications int64 0 1 | Answer stringlengths 6 11.6k | Available Count int64 1 31 | Q_Score int64 0 6.79k | Data Science and Machine Learning int64 0 1 | Question stringlengths 15 29k | Title stringlengths 11 150 | Score float64 -1 1.2 | Database and SQL int64 0 1 | Networking and APIs int64 0 1 | ViewCount int64 8 6.81M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6,970,240 | 2011-08-07T02:01:00.000 | 2 | 0 | 1 | 0 | python,django,installation,suds | 6,970,387 | 3 | true | 1 | 0 | You can use virtual_env, I have used to play with another (unrelated) python framework buildbot | 1 | 0 | 0 | I am trying to setup my project environment which uses the following:
Python 2.5.2
Django 1.3
Python Suds
The server I am running it on already has Python (2.5.2) and Django (1.1) installed but I want to use a newer version of Django and dont have administrator rights to upgrade. How do I go about installing this aga... | Installing Django and Python Suds (without admin rights) | 1.2 | 0 | 0 | 1,250 |
6,970,359 | 2011-08-07T02:35:00.000 | 5 | 1 | 1 | 0 | java,c++,python,nlp,wrapper | 6,970,615 | 5 | false | 0 | 0 | I would simply advise not doing this.
Don't implement stuff in C/C++ "for speed". The performance benefit is not likely to be as great as you expect; e.g. compared with implementing in Java using "best practice" design and performance techniques.
Don't try and glue lots of languages together. You are setting yourself... | 1 | 7 | 0 | I am about to get involved in a NLP-related project and I need to use various libraries. Some are in java, others in C/C++ (for tasks that require more speed) and finally some are in Python. I was thinking of using Python as the "glue" and create wrapper-classes for every task that I want to do that relies on a differe... | Find an efficient way to integrate different language libraries into one project using Python as the "glue" | 0.197375 | 0 | 0 | 360 |
6,970,557 | 2011-08-07T03:33:00.000 | 4 | 1 | 0 | 0 | c++,python,translation,boost-python | 6,970,611 | 1 | false | 0 | 0 | having the existing C++ code use the new Python
I think you'll find that python makes a better glue language for C++ than C++ does for python. So you probably will have an easier time converting the main function to python first (in fact, the first step could be just renaming the main function, compiling the C++ app ... | 1 | 2 | 0 | This is simply a personal exercise/project, I don't intend to inflict this on the world. My goal is to further my understanding of both languages, and it would be a nice having a nice Python code base in the end.
But basically there is a program I like with a large (about 100ksloc) C++ code base, what I'd like to do i... | Is gradually translating a program written in C++ to Python feasible? | 0.664037 | 0 | 0 | 215 |
6,970,855 | 2011-08-07T05:05:00.000 | 4 | 0 | 1 | 0 | python,windows,memory-management | 6,970,861 | 3 | false | 0 | 0 | Python does not have a built-in mechanism for limiting memory consumption; if that's all it's using, then that's all it'll use. | 3 | 3 | 0 | I'm working on a program in python on Windows 7 that matches features between multiple images in real time. It is intended to be the only program running.
When I run it on my laptop, it runs very slowly. However, when I check how much memory it is using with the task manager, it is only using about 46,000 KB. I would l... | Increase availible memory for python in windows | 0.26052 | 0 | 0 | 2,636 |
6,970,855 | 2011-08-07T05:05:00.000 | 0 | 0 | 1 | 0 | python,windows,memory-management | 6,970,914 | 3 | false | 0 | 0 | Each process can use the same amount of (virtual) memory that the OS makes available. Python is not special in that regard. Perhaps you'd want to modify your program, but we'd have to see some code to comment on that. | 3 | 3 | 0 | I'm working on a program in python on Windows 7 that matches features between multiple images in real time. It is intended to be the only program running.
When I run it on my laptop, it runs very slowly. However, when I check how much memory it is using with the task manager, it is only using about 46,000 KB. I would l... | Increase availible memory for python in windows | 0 | 0 | 0 | 2,636 |
6,970,855 | 2011-08-07T05:05:00.000 | 3 | 0 | 1 | 0 | python,windows,memory-management | 6,970,870 | 3 | true | 0 | 0 | If you're doing image comparisons, chances are good you are CPU-bound, not memory-bound. Unless those are gigantic images, you're probably OK.
So, check your code for performance problems, use heuristics to avoid running unnecessary code, and send what you've got out for code review for others to help you. | 3 | 3 | 0 | I'm working on a program in python on Windows 7 that matches features between multiple images in real time. It is intended to be the only program running.
When I run it on my laptop, it runs very slowly. However, when I check how much memory it is using with the task manager, it is only using about 46,000 KB. I would l... | Increase availible memory for python in windows | 1.2 | 0 | 0 | 2,636 |
6,971,335 | 2011-08-07T07:19:00.000 | 3 | 1 | 1 | 0 | python,unit-testing,inner-classes,metaclass,python-unittest | 6,971,546 | 1 | true | 0 | 0 | You test a class by instantiating it. The "dummy class" you mentioned would be an instance of the metaclass, so that's exactly how you should test it.
When it comes to testing the inner class / outer class -- yes, I would include testing the inner class in the test for the outer class. If it makes sense to test the inn... | 1 | 3 | 0 | I usually unit test per class and this is no problem. However after messing around with python I have hit a problem that I have not encountered before in other languages, meta classes and inner classes.
Say I have a class that contains an inner class and also has a meta class, what is the best way to structure unit tes... | Unit testing metaclasses and inner classes in python | 1.2 | 0 | 0 | 1,309 |
6,972,466 | 2011-08-07T11:22:00.000 | 1 | 0 | 1 | 0 | python,unicode,encoding,utf-8,character-encoding | 6,972,479 | 2 | true | 0 | 0 | Short and sweet, ........ yes! | 2 | 2 | 0 | I'm crawling webpages from different websites and they have varied encodings. A sample of the encodings I get are -
Big5
TIS-620
utf-16le
shift_JIS
EUC-JP
MacCyrillic
koi8-r
apart from the more common encodings. I can get the unicode source of the web page by decoding using the above encodings.
My question is this:... | Converting any encoding to utf8 in python? | 1.2 | 0 | 0 | 1,160 |
6,972,466 | 2011-08-07T11:22:00.000 | 4 | 0 | 1 | 0 | python,unicode,encoding,utf-8,character-encoding | 6,972,548 | 2 | false | 0 | 0 | Yes, UTF-8 is nothing more than a scheme for storing integers in bytes, in such a way that smaller integers take fewer bytes. The result is that values less than 128 are stored in one byte so that ASCII is still ASCII. UTF-8 can represent all Unicode codepoints. | 2 | 2 | 0 | I'm crawling webpages from different websites and they have varied encodings. A sample of the encodings I get are -
Big5
TIS-620
utf-16le
shift_JIS
EUC-JP
MacCyrillic
koi8-r
apart from the more common encodings. I can get the unicode source of the web page by decoding using the above encodings.
My question is this:... | Converting any encoding to utf8 in python? | 0.379949 | 0 | 0 | 1,160 |
6,973,774 | 2011-08-07T15:42:00.000 | 0 | 0 | 0 | 0 | python,gtk,icons | 6,974,550 | 2 | false | 0 | 1 | I know this isn't 100% what you're looking for but Gnome will also recognize icons installed at ~/.local/share/icons/. When the program is run from the source directory, the icons could be copied there. | 1 | 2 | 0 | I have written a GTK app in Python (using PyGObject). I'm confused about how to handle deployment, specifically icons.
I understand that in most cases, I would be able to load my images from a specific path; however, the recommended way seems to be to register icons as named icons with the system, so they can be themed... | GTK Named Icons: Load while running from source, during development | 0 | 0 | 0 | 254 |
6,975,995 | 2011-08-07T21:46:00.000 | 0 | 0 | 0 | 0 | python,virtualbox,rdp | 7,852,841 | 2 | false | 0 | 0 | Have you considered Jython, which ought to be able to integrate natively with the Java library you already have? | 1 | 2 | 0 | Is there a way to access the screen of a stock version of a headless VirtualBox 4.x remotely using RDP with Python or access it using the VNC protocol?
I want to be able to access the boot screen (F12), too, so I cannot boot a VNC server in the Guest as the Guest is not yet booted.
Note that I already have an RFB versi... | How to connect Python to VirtualBox using RDP or RFB? | 0 | 0 | 1 | 1,273 |
6,976,443 | 2011-08-07T23:14:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine,google-cloud-datastore | 6,976,575 | 2 | false | 1 | 0 | Everything I read is against Parent entities for one reason, and that is when you modify anything in that tree, everything is locked.
When I first started working with parent entities, I wanted to treat them like the head of a hive or a database localized around that parent entry but apparently that isn't the way they ... | 1 | 5 | 0 | I'm trying to understand when to use an entity "parent" on GAE. Is this only useful for querying (ie get all the Foo objects where the parent == someObj) or does the child have access to the parent entity much like a ReferenceProperty?
When is it better to use the parent vs ReferenceProperty? | AppEngine - When to use a parent relationship? | 0.099668 | 0 | 0 | 276 |
6,976,578 | 2011-08-07T23:41:00.000 | -1 | 1 | 0 | 0 | php,python,apache,wsgi,pypy | 8,920,308 | 2 | false | 1 | 0 | I know that mod_wsgi doesn't work with mod_php
I heavily advise you, running PHP and Python applications on CGI level.
PHP 5.x runs on CGI, for python there exists flup, that makes it possible to run WSGI Applications on CGI.
Tamer | 1 | 5 | 0 | I'm in the process of setting up a webserver from scratch, mainly for writing webapps with Python. On looking at alternatives to Apache+mod_wsgi, it appears that pypy plays very nicely indeed with pretty much everything I intend to use for my own apps. Not really having had a chance to play with PyPy properly, I feel t... | PyPy + PHP on a single webserver | -0.099668 | 1 | 0 | 815 |
6,979,529 | 2011-08-08T08:38:00.000 | 2 | 1 | 0 | 0 | python,django,content-management-system,contenttype,feincms | 6,979,669 | 1 | false | 0 | 0 | No, that's not possible currently.
What's the reasoning behind this feature request? | 1 | 2 | 0 | I'd like to disable the option to move FeinCMS contenttypes whithin a region.
Does anyone have any suggestions how to accomplish this? | Disable option to move FeinCMS contenttypes within a region | 0.379949 | 0 | 0 | 108 |
6,980,749 | 2011-08-08T10:24:00.000 | 2 | 0 | 1 | 0 | python,pdb | 6,980,824 | 15 | false | 0 | 0 | You can use:
wing ide
eclipse with the pydev plugin
pycharms
All of the above support python debugging from inside an IDE. | 3 | 128 | 0 | Just a convenience question. I've been a bit spoiled with debuggers in IDEs like Visual Studio and XCode. I find it a bit clumsy to have to type import pdb; pdb.set_trace() to set a breakpoint (I'd rather not import pdb at the top of the file as I might forget and leave it in).
Is there a simpler way of setting a break... | Simpler way to put PDB breakpoints in Python code? | 0.02666 | 0 | 0 | 112,600 |
6,980,749 | 2011-08-08T10:24:00.000 | 0 | 0 | 1 | 0 | python,pdb | 43,837,567 | 15 | false | 0 | 0 | In Atom if Python plugins installed, you can just type in 'pdb' and hit enter and the snippet will type import and trace back for you.
I've used to this now that sometimes I just type it in even if I'm editing it in vim and waiting for the dropdown to appear. | 3 | 128 | 0 | Just a convenience question. I've been a bit spoiled with debuggers in IDEs like Visual Studio and XCode. I find it a bit clumsy to have to type import pdb; pdb.set_trace() to set a breakpoint (I'd rather not import pdb at the top of the file as I might forget and leave it in).
Is there a simpler way of setting a break... | Simpler way to put PDB breakpoints in Python code? | 0 | 0 | 0 | 112,600 |
6,980,749 | 2011-08-08T10:24:00.000 | 133 | 0 | 1 | 0 | python,pdb | 6,980,836 | 15 | false | 0 | 0 | You can run your program into pdb from the command line by running
python -m pdb your_script.py
It will break on the 1st line, then you'll be able to add a breakpoint wherever you want in your code using the break command, its syntax is:
b(reak) [[filename:]lineno | function[, condition]]
It is flexible enough to g... | 3 | 128 | 0 | Just a convenience question. I've been a bit spoiled with debuggers in IDEs like Visual Studio and XCode. I find it a bit clumsy to have to type import pdb; pdb.set_trace() to set a breakpoint (I'd rather not import pdb at the top of the file as I might forget and leave it in).
Is there a simpler way of setting a break... | Simpler way to put PDB breakpoints in Python code? | 1 | 0 | 0 | 112,600 |
6,981,064 | 2011-08-08T10:52:00.000 | 16 | 0 | 0 | 0 | python,mysql | 6,981,725 | 4 | true | 0 | 0 | Short answer
You can't.
If the password is stored in the artifact that's shipped to the end-user you must consider it compromised! Even if the artifact is a compiled binary, there are always (more or less complicated) ways to get at the password.
The only way to protect your resources is by exposing only a limited API ... | 2 | 17 | 0 | I'm writing a Python script which uses a MySQL database, which is locally hosted. The program will be delivered as source code. As a result, the MySQL password will be visible to bare eyes. Is there a good way to protect this?
The idea is to prevent some naughty people from looking at the source code, gaining direct a... | Safeguarding MySQL password when developing in Python? | 1.2 | 1 | 0 | 14,190 |
6,981,064 | 2011-08-08T10:52:00.000 | -5 | 0 | 0 | 0 | python,mysql | 6,981,128 | 4 | false | 0 | 0 | Either use simple passwor like root.Else Don't use password. | 2 | 17 | 0 | I'm writing a Python script which uses a MySQL database, which is locally hosted. The program will be delivered as source code. As a result, the MySQL password will be visible to bare eyes. Is there a good way to protect this?
The idea is to prevent some naughty people from looking at the source code, gaining direct a... | Safeguarding MySQL password when developing in Python? | -1 | 1 | 0 | 14,190 |
6,981,575 | 2011-08-08T11:41:00.000 | -1 | 0 | 0 | 0 | python,django,django-models | 69,876,980 | 3 | false | 1 | 0 | You can dump it into a JSON file and then use Notepad++ or equivalent to remove every line that has your field_name. Works for me, and very quick too. Make sure your field name is unique so that it will not remove other rows. | 2 | 0 | 0 | Is there a way to exclude fields from different tables while taking DB dump. I could only find to exclude a model completely. (I am using postgresql). any help is appreciated..
Thanks in advance.. | Exclude multiple fields from datadump in django | -0.066568 | 0 | 0 | 1,667 |
6,981,575 | 2011-08-08T11:41:00.000 | 1 | 0 | 0 | 0 | python,django,django-models | 6,982,181 | 3 | true | 1 | 0 | Not easily. I would grab a copy of dumpdata.py from the Django source and put it into your project and customize it. It would not be too hard to extend it to either use a custom manager for dumping or extend the exclude to support app.model.field.
That sounds like a generally useful extension. | 2 | 0 | 0 | Is there a way to exclude fields from different tables while taking DB dump. I could only find to exclude a model completely. (I am using postgresql). any help is appreciated..
Thanks in advance.. | Exclude multiple fields from datadump in django | 1.2 | 0 | 0 | 1,667 |
6,983,622 | 2011-08-08T14:25:00.000 | 1 | 1 | 0 | 0 | python,ajax,cgi | 6,983,929 | 2 | false | 1 | 0 | You could do this -
Use Javascript to check progress every 3 seconds.
Your Python script hit at anytime should give the progress at that instance. It should essentially act as state-machine. You need a server here or maybe the progress is stored on some file.
But having a server is the way to go...
Maybe the long r... | 1 | 0 | 0 | I'd like to:
Send request from the browser to a python CGI script
This request will start some very long operation
The browser should check progress of that operation every 3 seconds
How can I do that? | Python with CGI - handle ajax | 0.099668 | 0 | 1 | 345 |
6,984,672 | 2011-08-08T15:38:00.000 | 1 | 0 | 0 | 0 | python,django,django-admin,gunicorn | 6,984,814 | 5 | false | 1 | 0 | If you use contrib.static, you have to execute a collectstatic command to get all the app-specific static files (including admin's own) into the public directory that is served by gunicorn. | 1 | 3 | 0 | I have a mostly entirely plain django project, with no adding of my own media or customization of the admin interface in any way. Running the server with python manage.py runserver results in a nicely-formatted admin interface. Running the server with gunicorn_django does not. Why is this the case, and how can I fix it... | django: admin site not formatted | 0.039979 | 0 | 0 | 2,860 |
6,985,617 | 2011-08-08T16:53:00.000 | 0 | 0 | 1 | 0 | python | 28,193,777 | 6 | false | 0 | 0 | This can be achieved by importing the module via different paths.
That is - if in your sys.path you have two different dotted routes to the module, the module cache will create two different instances of the module with different symbol trees, globals and so on.
This can be used to have multiple versions of a library ... | 2 | 14 | 0 | I am interacting with a python 2.x API written in a non-OO way, it uses module-global scope for some internal state driven stuff. It's needed in a context where it's no longer singleton, and modifying the original code (not ours) is not an option.
Short of using subprocess runs of separate interpreters, is there any wa... | Get 2 isolated instances of a python module | 0 | 0 | 0 | 2,783 |
6,985,617 | 2011-08-08T16:53:00.000 | 0 | 0 | 1 | 0 | python | 70,163,586 | 6 | false | 0 | 0 | I was trying this with binary (so) submodules, but that procedure failed. | 2 | 14 | 0 | I am interacting with a python 2.x API written in a non-OO way, it uses module-global scope for some internal state driven stuff. It's needed in a context where it's no longer singleton, and modifying the original code (not ours) is not an option.
Short of using subprocess runs of separate interpreters, is there any wa... | Get 2 isolated instances of a python module | 0 | 0 | 0 | 2,783 |
6,986,273 | 2011-08-08T17:48:00.000 | 0 | 0 | 1 | 0 | python,windows | 6,986,335 | 4 | false | 0 | 0 | You have the Windows tag, so I'll answer accordingly.
You will need to, among other valid possibilities, prefix an underscore before lowercase characters, and replace slashes
with hyphens, in order to make the Base64 sequence a valid filename as well as unique. | 2 | 1 | 0 | How can I create a file into the temporary files from a encoded string and then execute it? | How create a tempory file from base64 encoded string? | 0 | 0 | 0 | 2,406 |
6,986,273 | 2011-08-08T17:48:00.000 | 1 | 0 | 1 | 0 | python,windows | 6,986,315 | 4 | false | 0 | 0 | decode the string (pydoc base64); make a tempfile (pydoc tempfile), write the string; and use any number of the os functions to execute it (maybe pydoc os.popen). | 2 | 1 | 0 | How can I create a file into the temporary files from a encoded string and then execute it? | How create a tempory file from base64 encoded string? | 0.049958 | 0 | 0 | 2,406 |
6,986,925 | 2011-08-08T18:40:00.000 | 3 | 0 | 1 | 0 | python,distutils | 6,988,101 | 1 | true | 0 | 0 | One possible solution: Create a custom package for that program containing the custom sqlite3/etc. stuff and use relative imports to refer to those custom subpackages from a main module in your package, which you'd hook into with a simple importing script that would execute a your_package.run() function or something. Y... | 1 | 2 | 0 | I am trying to find a solution for a problem I am working on. I have a python program which is is using a custom built sqlite3 install (which allows > 10 simultaneous connections) and in addition requires the use of Tix (which does not come as a stand install with the python package for the group I am distributing to.... | Packaging a Python Program with custom built libraries | 1.2 | 1 | 0 | 115 |
6,986,986 | 2011-08-08T18:46:00.000 | 5 | 0 | 0 | 0 | python,matplotlib,histogram | 6,987,109 | 9 | false | 0 | 0 | I guess the easy way would be to calculate the minimum and maximum of the data you have, then calculate L = max - min. Then you divide L by the desired bin width (I'm assuming this is what you mean by bin size) and use the ceiling of this value as the number of bins. | 1 | 185 | 1 | I'm using matplotlib to make a histogram.
Is there any way to manually set the size of the bins as opposed to the number of bins? | Bin size in Matplotlib (Histogram) | 0.110656 | 0 | 0 | 355,218 |
6,987,957 | 2011-08-08T20:11:00.000 | 0 | 0 | 1 | 0 | python,linux,mysql-python | 6,988,995 | 1 | true | 1 | 0 | If you can't get the same architecture through pip or your package manager, you will probably need to either recompile Python (which you might consider anyway -- Python 2.4 is old), or MySQLdb.
Unfortunately, a lot of Python libraries are not cross-compatible between i386 and x86_64 -- I've actually had exactly the sa... | 1 | 0 | 0 | I am attempting to set up my Django virtualenv production environment on a Linux shared host server. Installing python packages using pip goes fine until I try to install Mysql-Python, which crashes. Does anyone know why this is failing? Looking through the error log, I think it's an architecture incompatibility betwee... | MySQL-Python Installation Error: Possible Architecture Incompatibility? | 1.2 | 0 | 0 | 268 |
6,996,167 | 2011-08-09T12:26:00.000 | 5 | 1 | 1 | 0 | python,eclipse,git,pydev,egit | 9,559,566 | 3 | false | 0 | 0 | It happened to me not so long ago.
I could not find a nice way to solve it, but found a simple way though :).
What I did was simple :
Create a brand new project, and let it empty.
Get the .project file wihch was created together with the project and add it in the git repository.
Now you can directly import your repo... | 2 | 4 | 0 | I have a local git repository which has some Python modules and I would like to create a new project which includes these files (I installed egit egit).
My repository does not include a .project file. | How to add an existing git repository (without an eclipse project) into eclipse? | 0.321513 | 0 | 0 | 6,040 |
6,996,167 | 2011-08-09T12:26:00.000 | 1 | 1 | 1 | 0 | python,eclipse,git,pydev,egit | 34,880,409 | 3 | false | 0 | 0 | File > New PyDev Project
Unclick "Use default" and browse to your git repo.
Enter project name. Name must be the same as the git repo. You'll get a "Source Folder Not Found" error if it's not.
Click Finish. | 2 | 4 | 0 | I have a local git repository which has some Python modules and I would like to create a new project which includes these files (I installed egit egit).
My repository does not include a .project file. | How to add an existing git repository (without an eclipse project) into eclipse? | 0.066568 | 0 | 0 | 6,040 |
6,997,102 | 2011-08-09T13:43:00.000 | 1 | 0 | 1 | 0 | python,list,cython | 7,010,304 | 4 | true | 0 | 1 | The question begs to be asked : why do you want this ?
is it for efficiency (looping over the array) or to lower memory footprint ?
do you need an array or a linked list would be enough ?
is your particle class a simple struct or something with behavior/method ?
Depending on these, the best solution goes from usin... | 1 | 3 | 0 | In my Group class, there must be an attribute particles which should be an array-like but resizable type that can only hold Particle-instances.
Both classes, Group and Particle are declared using cdef.
As Python-lists can carry any Python-object, I thought there might be a more performant way of declaring some kind of ... | Cython, is there a way to create lists of only one type ? (Unlike Python-lists) | 1.2 | 0 | 0 | 4,416 |
6,998,046 | 2011-08-09T14:44:00.000 | 1 | 1 | 0 | 0 | python,api,twitter | 6,998,115 | 1 | false | 0 | 0 | You mean you're using the "log in via twitter" hack?
Well, if you want a "remember me" option you can build one just like normal (store some session info in a cookie... all security caveats apply).
If the actually are logged out and there's no cookie then you have to go through the whole process again anyway. The auth... | 1 | 1 | 0 | I have written an application which using twitter authentication.
Authentication process:
Get the request token
Authorize the token
Get the access key
Now I have access key, I can use the twitter API. I stored the access_key pair in the database for further use. But when next time user logged in via twitter, since al... | twitter authentication issue using oauth? | 0.197375 | 0 | 1 | 151 |
6,998,545 | 2011-08-09T15:17:00.000 | 1 | 0 | 1 | 0 | python,macos,osx-lion | 6,998,634 | 3 | false | 0 | 0 | You have a few options:
Change /usr/bin/python to a link to /usr/bin/python2.6
Put /System/Library/Frameworks/Python.framework/Versions/2.6/bin in your path before /usr/bin
Explicitly tell your scripts to use /usr/bin/python2.6 | 1 | 11 | 0 | I just upgraded to lion and with it came Python 2.7. I need to use 2.6 as my default python as the project I primarily work on uses 2.6. | How can I make python 2.6 my default in Mac OS X Lion? | 0.066568 | 0 | 0 | 20,778 |
6,999,621 | 2011-08-09T16:34:00.000 | 51 | 0 | 0 | 0 | python,plot,matplotlib | 7,000,381 | 2 | true | 0 | 0 | Specify, in the coordinates of your current axis, the corners of the rectangle that you want the image to be pasted over
Extent defines the left and right limits, and the bottom and top limits. It takes four values like so: extent=[horizontal_min,horizontal_max,vertical_min,vertical_max].
Assuming you have longitude a... | 1 | 37 | 1 | I managed to plot my data and would like to add a background image (map) to it.
Data is plotted by the long/lat values and I have the long/lat values for the image's three corners (top left, top right and bottom left) too.
I am trying to figure out how to use 'extent' option with imshow. However, the examples I found d... | how to use 'extent' in matplotlib.pyplot.imshow | 1.2 | 0 | 0 | 80,144 |
7,000,138 | 2011-08-09T17:17:00.000 | 0 | 1 | 1 | 0 | python,eclipse,debugging,aptana | 7,008,430 | 2 | true | 0 | 0 | what about this, in the script, you can write a function, say onlyForTest, then each time you write a new function and want to test it, you can just put it in the onlyForTest function, then specify some arguments required by the new function you just write, then open the interactive python shell, import the script, cal... | 1 | 3 | 0 | I've noticed how easy it is to debug a Python script from Eclipse. Simply set breakpoints and run a Python script from the debug menu. But is it possible to start a Python Interactive Interpreter instead of running a particular Python script, whilst still having Eclipse breaking on breakpoints? This would make it so mu... | How can I debug Python code without running a script (using Eclipse)? | 1.2 | 0 | 0 | 1,331 |
7,001,931 | 2011-08-09T19:37:00.000 | 0 | 0 | 0 | 0 | python,django,web-services,web2py,zope3 | 7,032,112 | 7 | false | 1 | 0 | Zope is tremendously powerful, but it definitely has the highest learning curve of the three choices you're discussing. | 1 | 2 | 0 | I need to build a simple administrative webapp using python that will connect to MySQL.
Web Application will need to expose some APIs via Web Services for other Web App and Android/iPhone clients to consume. I need help making technology selections.
I would appreciate suggestions and past experience comment comparisons... | Help choosing between Django, Zope3 and Web2Py for WebService Server | 0 | 0 | 0 | 1,294 |
7,002,429 | 2011-08-09T20:22:00.000 | 15 | 0 | 1 | 0 | python,dictionary,extract | 7,002,447 | 14 | false | 0 | 0 | Call the values() method on the dict. | 4 | 224 | 0 | I have a dictionary d = {1:-0.3246, 2:-0.9185, 3:-3985, ...}.
How do I extract all of the values of d into a list l? | How can I extract all values from a dictionary in Python? | 1 | 0 | 0 | 536,716 |
7,002,429 | 2011-08-09T20:22:00.000 | 0 | 0 | 1 | 0 | python,dictionary,extract | 43,495,270 | 14 | false | 0 | 0 | Pythonic duck-typing should in principle determine what an object can do, i.e., its properties and methods. By looking at a dictionary object one may try to guess it has at least one of the following: dict.keys() or dict.values() methods. You should try to use this approach for future work with programming languages wh... | 4 | 224 | 0 | I have a dictionary d = {1:-0.3246, 2:-0.9185, 3:-3985, ...}.
How do I extract all of the values of d into a list l? | How can I extract all values from a dictionary in Python? | 0 | 0 | 0 | 536,716 |
7,002,429 | 2011-08-09T20:22:00.000 | -1 | 0 | 1 | 0 | python,dictionary,extract | 66,254,412 | 14 | false | 0 | 0 | Normal Dict.values()
will return something like this
dict_values(['value1'])
dict_values(['value2'])
If you want only Values use
Use this
list(Dict.values())[0] # Under the List | 4 | 224 | 0 | I have a dictionary d = {1:-0.3246, 2:-0.9185, 3:-3985, ...}.
How do I extract all of the values of d into a list l? | How can I extract all values from a dictionary in Python? | -0.014285 | 0 | 0 | 536,716 |
7,002,429 | 2011-08-09T20:22:00.000 | 406 | 0 | 1 | 0 | python,dictionary,extract | 7,002,449 | 14 | true | 0 | 0 | If you only need the dictionary keys 1, 2, and 3 use: your_dict.keys().
If you only need the dictionary values -0.3246, -0.9185, and -3985 use: your_dict.values().
If you want both keys and values use: your_dict.items() which returns a list of tuples [(key1, value1), (key2, value2), ...]. | 4 | 224 | 0 | I have a dictionary d = {1:-0.3246, 2:-0.9185, 3:-3985, ...}.
How do I extract all of the values of d into a list l? | How can I extract all values from a dictionary in Python? | 1.2 | 0 | 0 | 536,716 |
7,002,671 | 2011-08-09T20:39:00.000 | 0 | 0 | 1 | 0 | python | 7,002,726 | 6 | false | 0 | 0 | num1, num2 = raw_input('Enter a range: ').split(',') | 1 | 4 | 0 | Is it possible to input 2 numbers int or float separated by a comma in a single line?
Say after the program runs it would ask the user to Enter a range: then the user would input 2,3. So the variable range is [2,3]. As far as I know range_choice.split() is the only way. | input 2 variables separated by a comma in a single line | 0 | 0 | 0 | 20,384 |
7,004,709 | 2011-08-10T00:42:00.000 | 0 | 0 | 1 | 0 | python,qt,asynchronous,spynner | 7,005,338 | 1 | false | 0 | 1 | You could run function_using_spynner in the main thread and do whatever else you need to do in the other thread. Alternatively, you could start the QApplication in spynner in the main thread before branching into multiple threads. | 1 | 0 | 0 | I'm using a module named spynner with python. spynner runs on a QApplication instance. I need to run functions using spynner asynchronously.
I have tried calling these functions in different threads, using something like:
thread.start_new_thread(function_using_spynner)
This works if I run just one function, but if I t... | QApplication in threads | 0 | 0 | 0 | 1,045 |
7,004,887 | 2011-08-10T01:17:00.000 | 2 | 0 | 0 | 0 | python,django,comments | 7,004,917 | 1 | true | 1 | 0 | Why not using the URL as the model? You can even write a middleware that creates an Url instance upon a page request, if it does not exist yet. | 1 | 0 | 0 | I'd like to use the Django comments framework (or something similar) to easily enable comments for my site. According to the Django documentation, a comment thread must be associated with a parent object that is a Django model. (https://docs.djangoproject.com/en/dev/ref/contrib/comments/).
However, most of my views are... | can I use the django comments framework without an attached parent model? | 1.2 | 0 | 0 | 186 |
7,006,013 | 2011-08-10T04:46:00.000 | 0 | 1 | 0 | 0 | php,python | 7,006,100 | 3 | false | 0 | 0 | First of all if you are considering moving away from CMS than you should consider using some sort of framework but with time you will come to idea that you need your own shit in order to be satisfied.
Second, subject you are trying to decipher is a little bit more complex than just writing it down here.
I would sugges... | 1 | 1 | 0 | I'm primarily using Drupal and am considering moving away from CMS. If I were to build my own platform could I integrate modules like commenting systems, user login, etc. through a PHP/Python API? What would be the proper steps/good places to look/good tutorial on this? Would I have to build all of my own tables man... | Are there comment system/user loggin type modules through PHP API/Python API outside of CMS? | 0 | 0 | 1 | 152 |
7,007,635 | 2011-08-10T08:05:00.000 | 2 | 1 | 0 | 0 | python,unit-testing,dll,pydev | 7,011,545 | 1 | false | 0 | 1 | This happens because PyDev launches a shell that imports that dll (to do code-completion). You can do Ctrl+2 kill (with focus in a PyDev editor), to kill all the shells that PyDev may have spawned (that way you can update it).
Cheers,
Fabio | 1 | 1 | 0 | I'm unit-testing a python c module in Eclipse using PyDev unit-testing.
The development steps are:
I first write the python tests in Eclipse and then the c code that passes
the tests for the module in Codeblocks. Here is where a script is called
to create a dll and ctypes bindings for it. After that the “dll” and the... | Dll from python module is not released in Eclipse / PyDev | 0.379949 | 0 | 0 | 260 |
7,009,884 | 2011-08-10T11:15:00.000 | 1 | 0 | 0 | 0 | python,django,redirect,dns | 7,010,297 | 3 | false | 1 | 0 | You can also skip prefix via proper DNS configuration. | 1 | 12 | 0 | Is in Django a simple way to redirect everything from domain without www to version with it? I mean from http:// example.com to http:// www.example.com. | Django - redirect to version with www | 0.066568 | 0 | 0 | 8,338 |
7,011,416 | 2011-08-10T13:19:00.000 | 0 | 0 | 0 | 0 | python,wxpython,wxwidgets | 7,038,368 | 1 | true | 0 | 1 | Turns out you can capture EVT_CHAR events by binding directly to the text ctrl. As the text ctrl is only created when the property is selected however you can't do this when setting up the grid, rather you have to bind it following a EVT_PG_SELECTED event. | 1 | 0 | 0 | In wxPython I'm trying to update an existing UI to use wxPropertyGrid instead of an array of individual UI elements. Currently the underlying object model is updated and validation is applied after each key press and I want to do the same with the PropertyGrid.
The problem I'm having is that there doesn't seem to exis... | How to capture events for each key press in wxPropertyGrid | 1.2 | 0 | 0 | 377 |
7,011,428 | 2011-08-10T13:20:00.000 | 0 | 0 | 0 | 0 | python,numpy,matplotlib | 7,011,948 | 4 | false | 0 | 0 | What you want is a kind of 3D image (a block). Maybe you could plot it by slices (using imshow() or whatever the tool you want).
Maybe you could tell us what kind of plot you want? | 1 | 8 | 1 | does there exist an equivalent to matplotlib's imshow()-function for 3D-drawing of datas stored in a 3D numpy array? | imshow for 3D? (Python / Matplotlib) | 0 | 0 | 0 | 11,267 |
7,011,591 | 2011-08-10T13:30:00.000 | 0 | 0 | 0 | 0 | python,arrays,numpy,missing-data | 7,046,562 | 2 | false | 0 | 0 | you can use mask array when you do calculation. and when pass the array to ATPY, you can call filled(9999) method of the mask array to convert the mask array to normal array with invalid values replaced by 9999. | 1 | 2 | 1 | I am reading in census data using the matplotlib cvs2rec function - works fine gives me a nice ndarray.
But there are several columns where all the values are '"none"" with dtype |04. This is cuasing problems when I lode into Atpy "TypeError: object of NoneType has no len()". Something like '9999' or other missing wou... | Recode missing data Numpy | 0 | 0 | 0 | 2,140 |
7,011,884 | 2011-08-10T13:50:00.000 | 1 | 0 | 1 | 0 | python,multithreading,suspend,condition-variable | 7,011,927 | 2 | false | 0 | 0 | The wait() method releases the lock, and then blocks until it is
awakened by a notify() or notifyAll() call for the same condition
variable in another thread. Once awakened, it re-acquires the lock and
returns. It is also possible to specify a timeout.
It blocks until the condition is notified. | 1 | 0 | 0 | If I call wait() on a python condition variable, does the calling thread suspend execution and yield or does it keep blocking until the next context switch? | Does a Python threading.Condition.wait() suspend execution immediately? | 0.099668 | 0 | 0 | 1,555 |
7,011,950 | 2011-08-10T13:55:00.000 | 0 | 0 | 0 | 1 | python,celery | 7,013,383 | 3 | false | 0 | 0 | I think there might be some misunderstanding about what celerybeat does. Celerybeat does not process the periodic tasks; it only publishes them. It puts the periodic tasks on the queue to be processed by the celeryd workers. If you run a single celerybeat process and multiple celeryd processes then the task execution w... | 1 | 13 | 0 | I'm looking for a distributed cron-like framework for Python, and found Celery. However, the docs says "You have to ensure only a single scheduler is running for a schedule at a time, otherwise you would end up with duplicate tasks", Celery is using celery.beat.PersistentScheduler which store the schedule to a local fi... | Distributed Celery scheduler | 0 | 0 | 0 | 6,230 |
7,013,510 | 2011-08-10T15:32:00.000 | 0 | 0 | 1 | 0 | python,regex | 7,022,320 | 5 | false | 0 | 0 | remember that [] it represent a character class, every thing under it is going to be considers as the characters which can present in string, (unless you escape it within character class as you do with \d+), e.g. [\d-+]+ now in this case the - and + inside [] are just simply the symbol, the + which is outside in charac... | 2 | 6 | 0 | I know it can denote range, but for example here [-.\d] seems like this means decimal number. What does dash symbol in front of the regex mean?
Also, why apart from [], are there () around them? What do the () mean? | python regex - what does - (dash) mean | 0 | 0 | 0 | 19,153 |
7,013,510 | 2011-08-10T15:32:00.000 | 3 | 0 | 1 | 0 | python,regex | 7,013,540 | 5 | false | 0 | 0 | It means "dash." They probably expect some negative numbers (i.e. -0.5). The () means that it is capturing the matches. | 2 | 6 | 0 | I know it can denote range, but for example here [-.\d] seems like this means decimal number. What does dash symbol in front of the regex mean?
Also, why apart from [], are there () around them? What do the () mean? | python regex - what does - (dash) mean | 0.119427 | 0 | 0 | 19,153 |
7,014,512 | 2011-08-10T16:40:00.000 | 0 | 1 | 1 | 0 | python,math,modulo | 7,014,615 | 4 | false | 0 | 0 | Today's computers are amazingly fast, very complicated calculations can occur in what seems like no time at all. You need to repeat such calculations very many times to see the delay; I'd start with a million. | 2 | 1 | 0 | When I put in Python interpreter a ** b % c with large a (20 figures) b (4 figures) c (20 figures) I saw that Python calculates it pretty fast, almost like pow (a,b,c). I expect another behavior that Python first calculate a ** b then get the modulo (%) of result and such calculation will take significantly more time.
... | Behavior of Python ** and % operators with big numbers | 0 | 0 | 0 | 2,476 |
7,014,512 | 2011-08-10T16:40:00.000 | 2 | 1 | 1 | 0 | python,math,modulo | 7,014,538 | 4 | false | 0 | 0 | There is no magic behind the scenes, other than Python supports arbitrary-precision integers, and is well-implemented. It really did calculate a**b, then %c. | 2 | 1 | 0 | When I put in Python interpreter a ** b % c with large a (20 figures) b (4 figures) c (20 figures) I saw that Python calculates it pretty fast, almost like pow (a,b,c). I expect another behavior that Python first calculate a ** b then get the modulo (%) of result and such calculation will take significantly more time.
... | Behavior of Python ** and % operators with big numbers | 0.099668 | 0 | 0 | 2,476 |
7,014,953 | 2011-08-10T17:13:00.000 | 7 | 0 | 1 | 0 | python,security,encryption | 7,015,088 | 8 | false | 0 | 0 | I think the best you can do is protect the script file and system it's running on.
Basically do the following:
Use file system permissions (chmod 400)
Strong password for owner's account on the system
Reduce ability for system to be compromised (firewall, disable unneeded services, etc)
Remove administrative/root/sudo... | 2 | 121 | 0 | I'm writing a small Python script which will periodically pull information from a 3rd party service using a username and password combo. I don't need to create something that is 100% bulletproof (does 100% even exist?), but I would like to involve a good measure of security so at the very least it would take a long tim... | I need to securely store a username and password in Python, what are my options? | 1 | 0 | 0 | 120,750 |
7,014,953 | 2011-08-10T17:13:00.000 | 10 | 0 | 1 | 0 | python,security,encryption | 7,015,019 | 8 | false | 0 | 0 | There's not much point trying to encrypt the password: the person you're trying to hide it from has the Python script, which will have the code to decrypt it. The fastest way to get the password will be to add a print statement to the Python script just before it uses the password with the third-party service.
So stor... | 2 | 121 | 0 | I'm writing a small Python script which will periodically pull information from a 3rd party service using a username and password combo. I don't need to create something that is 100% bulletproof (does 100% even exist?), but I would like to involve a good measure of security so at the very least it would take a long tim... | I need to securely store a username and password in Python, what are my options? | 1 | 0 | 0 | 120,750 |
7,015,171 | 2011-08-10T17:31:00.000 | 1 | 1 | 1 | 0 | python,multithreading | 7,015,281 | 2 | false | 0 | 0 | This is what Queue's are for. Give each thread a Queue, and write into all but your own. | 2 | 2 | 0 | I'm developing an application in Python which needs to send a one-way message to all threads (threading module in Python2) in an array, except the current thread. I have tried variables, but that would result in all threads responding to it instead of all but the sender.
What is the best way to send messages that way? | Sending a one-way message with Python on all threads except the sender | 0.099668 | 0 | 0 | 263 |
7,015,171 | 2011-08-10T17:31:00.000 | 2 | 1 | 1 | 0 | python,multithreading | 7,015,194 | 2 | false | 0 | 0 | Why not make the "message" be a tuple of (thread_id, 'message'), and then send it to all threads - the thread that sent it can just ignore messages with its own thread_id. | 2 | 2 | 0 | I'm developing an application in Python which needs to send a one-way message to all threads (threading module in Python2) in an array, except the current thread. I have tried variables, but that would result in all threads responding to it instead of all but the sender.
What is the best way to send messages that way? | Sending a one-way message with Python on all threads except the sender | 0.197375 | 0 | 0 | 263 |
7,015,910 | 2011-08-10T18:32:00.000 | 2 | 1 | 0 | 1 | python | 7,016,498 | 2 | true | 0 | 0 | OK found the answer.
You need to install a newer version of Xcode.
I had installed an older Xcode 3.2 on Lion. After upgrading, my /usr/include/python2.7 directory was populated with the header files. | 1 | 3 | 0 | I'm running a new mac with osx lion and it came with the latest Python 2.7. My /Library/Frameworks/Python.framework/Versions directory has 2.3, 2.5, 2.6, 2.7, and Current.
Now 2.5 and 2.6 have Python.h and many other header files in /include.
My problem is I can't find any header files except pyconfig.h in the 2.7/in... | why is Python.h in my /usr/local/python2.6 folder when my Mac is using python 2.7? | 1.2 | 0 | 0 | 1,543 |
7,016,885 | 2011-08-10T19:52:00.000 | 5 | 0 | 0 | 0 | python,web-frameworks | 7,016,928 | 5 | false | 1 | 0 | Django is by far the most popular. Documentation is excellent, which will help you get up and running. | 2 | 5 | 0 | Which is the easiest Python web application framework to get started with, for general use?
Referring to easiest - I mean one which a short learning curve / time, at least in order to be able to use it for fairly simple apps. I have worked on non-trivial Ruby on Rails projects earlier, so it is not that I can't learn a... | Which is the easiest Python web application framework to get started with, for general use? | 0.197375 | 0 | 0 | 12,722 |
7,016,885 | 2011-08-10T19:52:00.000 | 0 | 0 | 0 | 0 | python,web-frameworks | 7,016,938 | 5 | false | 1 | 0 | Plone is probably the simplest, but Django is the most popular. It's also extremely well documented. | 2 | 5 | 0 | Which is the easiest Python web application framework to get started with, for general use?
Referring to easiest - I mean one which a short learning curve / time, at least in order to be able to use it for fairly simple apps. I have worked on non-trivial Ruby on Rails projects earlier, so it is not that I can't learn a... | Which is the easiest Python web application framework to get started with, for general use? | 0 | 0 | 0 | 12,722 |
7,017,059 | 2011-08-10T20:06:00.000 | 0 | 0 | 0 | 0 | python,django,internationalization,django-cms | 7,448,955 | 1 | false | 1 | 0 | Found the solution. Django-nani. | 1 | 1 | 0 | I am implementing payment plans on an multilingual eshop based on django-cms. I need internationalized support for payment plans.
User can enter abritrary number of payment plans (implies standard django models)
Every payment plan must have a description in every language site supports (3 at the moment). Implies basic... | Django-cms translatable objects | 0 | 0 | 0 | 240 |
7,017,838 | 2011-08-10T21:08:00.000 | 0 | 0 | 0 | 0 | python,django,apache,nginx,http-status-code-404 | 7,305,445 | 2 | false | 1 | 0 | I have worked out what I think is the "correct" way of doing this which is to set:
WSGIErrorOverride On
In my Apache vhost. This seems to achieve the desired goal of Apache handle the 404 errors. | 2 | 1 | 0 | Here is a simplified version of our setup:
Nginx reverse proxy front end serving static files
Apache + mod_wsgi serving a django app in /store and wordpress for all other URLs
404 errors outside /store work fine (via an apache 404 handler).
However, 404 errors within /store hit the django 404.html. I'd really like no... | How should apache/nginx and django play nicely together in respect of 404 errors? | 0 | 0 | 0 | 338 |
7,017,838 | 2011-08-10T21:08:00.000 | 0 | 0 | 0 | 0 | python,django,apache,nginx,http-status-code-404 | 7,045,823 | 2 | false | 1 | 0 | you could always symlink your 404 page as {django}/templates/404.html | 2 | 1 | 0 | Here is a simplified version of our setup:
Nginx reverse proxy front end serving static files
Apache + mod_wsgi serving a django app in /store and wordpress for all other URLs
404 errors outside /store work fine (via an apache 404 handler).
However, 404 errors within /store hit the django 404.html. I'd really like no... | How should apache/nginx and django play nicely together in respect of 404 errors? | 0 | 0 | 0 | 338 |
7,017,890 | 2011-08-10T21:13:00.000 | 1 | 0 | 0 | 0 | python,mysql,html,sql | 7,017,930 | 2 | false | 1 | 0 | use urllib2 to open up the web page. Then parse the returned text with regex to retrieve the title. | 1 | 2 | 0 | I want to make a really script in Python that gets the contents from the title tags of a specified web page and then puts them into a MySQL database.
I have very (and I mean very) little experience with Python but this needs to be done for my project. How can I do this in the simplest way possible?
I hope you are able ... | Getting contents of title tags with Python script | 0.099668 | 0 | 0 | 179 |
7,018,089 | 2011-08-10T21:29:00.000 | 0 | 0 | 1 | 1 | python,eclipse,pydev | 7,018,120 | 2 | true | 0 | 0 | The best solution I found was multiple installations: eclipse is not that big (~250mb I think), but it's quite slow, so you'll want to have as little plugins as possible. | 2 | 0 | 0 | My apologies if this has already been asked and answered. I don't know enough about eclipse & pydev setup to know what to search for.
I'd like to use pydev, but can't modify the existing installation of eclipse. Do I need to install my own eclipse so that I can then install pydev into it, or is there a way to install... | install pydev without rights to eclipse installation | 1.2 | 0 | 0 | 94 |
7,018,089 | 2011-08-10T21:29:00.000 | 0 | 0 | 1 | 1 | python,eclipse,pydev | 7,018,179 | 2 | false | 0 | 0 | Something that worked quite nicely for me when I was using Pydev with Eclipse as a non-privileged user on a shared computer was to install Eclipse+Pydev on a flash drive. You have the added advantage of being able to work from any computer while having your usual settings. | 2 | 0 | 0 | My apologies if this has already been asked and answered. I don't know enough about eclipse & pydev setup to know what to search for.
I'd like to use pydev, but can't modify the existing installation of eclipse. Do I need to install my own eclipse so that I can then install pydev into it, or is there a way to install... | install pydev without rights to eclipse installation | 0 | 0 | 0 | 94 |
7,018,139 | 2011-08-10T21:34:00.000 | 24 | 1 | 0 | 1 | python,serial-port,copy-paste,pyserial | 7,018,187 | 4 | true | 0 | 0 | IIRC, Ctrl-C is etx. Thus send \x03. | 1 | 17 | 0 | I'm automating a configuration process for an embedded board. To enter the setup screen I need to send "Ctrl-C" command.
This is NOT to interrupt a process I'm running locally, KeyboardInterrupt will not work. I need to send a value that will be interpreted by the bootloader as Ctrl-C.
What is the value I need to sen... | PySerial: How to send Ctrl-C command on the serial line | 1.2 | 0 | 0 | 44,697 |
7,019,350 | 2011-08-10T23:54:00.000 | 3 | 0 | 0 | 0 | python-3.x,web-scraping | 7,033,832 | 2 | false | 1 | 0 | lxml.html works on Python 3, and gets you html parsing, at least.
BeautifulSoup 4, which is in the works, should support Python 3 (I've done some work on this). | 1 | 5 | 0 | I'm new to Python so I'm sorry if this is a newbie question.
I'm trying to build a program involving webscraping and I've noticed that Python 3 seems to have significantly fewer web-scraping modules than the Python 2.x series.
Beautiful Soup, mechanize, and scrapy -- the three modules recommended to me -- all seem to... | Python 3 web scraping options | 0.291313 | 0 | 1 | 1,521 |
7,019,933 | 2011-08-11T01:42:00.000 | 0 | 1 | 0 | 1 | python,eclipse,pydev | 18,454,032 | 5 | false | 0 | 0 | For whatever it's worth, I was having the same problem running eclipse 3.6 on RHEL 6. When I ran eclipse as myself, I didn't get any PyDev options; however, when I ran eclipse as root, everything showed up. So permissions could be an issue fyi. | 3 | 6 | 0 | I'm having a lot of trouble getting Eclipse to recognise PyDev when using the PyDev zip file. (I need to use the zip file as the Dev machine does not have internet access).
I have Eclipse installed and have downloaded the PyDev zip. I've Googled a fair bit and tried the following based on suggestions I found:-
Unzippe... | Adding PyDev to Eclipse using the PyDev zip | 0 | 0 | 0 | 11,417 |
7,019,933 | 2011-08-11T01:42:00.000 | 1 | 1 | 0 | 1 | python,eclipse,pydev | 7,020,096 | 5 | false | 0 | 0 | I just did this today and a far easier way to do it is to use the built-in installer. Go to Help -> Install New Software and then type pydev in the software filter. Since you already have the zip, if you extract it in the dropins folder, you'll skip the download portion and go straight to installing it.
I have been abl... | 3 | 6 | 0 | I'm having a lot of trouble getting Eclipse to recognise PyDev when using the PyDev zip file. (I need to use the zip file as the Dev machine does not have internet access).
I have Eclipse installed and have downloaded the PyDev zip. I've Googled a fair bit and tried the following based on suggestions I found:-
Unzippe... | Adding PyDev to Eclipse using the PyDev zip | 0.039979 | 0 | 0 | 11,417 |
7,019,933 | 2011-08-11T01:42:00.000 | 1 | 1 | 0 | 1 | python,eclipse,pydev | 7,033,285 | 5 | false | 0 | 0 | I've been playing with PyDev and Eclipse. Reinstalled Eclipse on a fresh machine and unzipped the standard PyDev over it (not the source version) and it worked fine. Did the same thing on the same machine having the problems but in a different location (/home) also worked fine. So it looks like a configuration problem ... | 3 | 6 | 0 | I'm having a lot of trouble getting Eclipse to recognise PyDev when using the PyDev zip file. (I need to use the zip file as the Dev machine does not have internet access).
I have Eclipse installed and have downloaded the PyDev zip. I've Googled a fair bit and tried the following based on suggestions I found:-
Unzippe... | Adding PyDev to Eclipse using the PyDev zip | 0.039979 | 0 | 0 | 11,417 |
7,020,108 | 2011-08-11T02:15:00.000 | 0 | 0 | 0 | 0 | python,sql,django,django-models,django-signals | 7,021,874 | 3 | false | 1 | 0 | As other have said, the best solution is django-celery (https://github.com/ask/django-celery) but it's a little heavyweight if you are low on resources.
In a similar need, I have a middleware that checks the conditions and executes the needed operations (which, in my case, are just changing a boolean in some records of... | 1 | 2 | 0 | I'm totally confused and have no idea how to do this, so please forgive me if my description/information is bad.
So I want say to do a notification via django-notification or simply send an e-mail to one of my user when a post of his had ended like on ebay. In my database I have a model which stores the datetime of wh... | Django 1.3, how to signal when a post has ended like on ebay? | 0 | 0 | 0 | 204 |
7,021,671 | 2011-08-11T06:24:00.000 | 0 | 0 | 0 | 0 | python,reportlab,openerp | 7,023,526 | 1 | false | 1 | 0 | For better report customisation, use Aeroo Reports from Alistek. With this module, you can use your odt file without changing anything... | 1 | 2 | 0 | Problem:
I have sxw file and whenever I convert it in rml file using base_report_designer module(OpenERP module), and generate report I do not get underlined fonts in report which are underlined in sxw though but not in rml file.I changed font format & size then after I did not get underlined fonts in report.Currently ... | How to get underlined title report by converting sxw to rml format using base_report_designer module? | 0 | 0 | 0 | 838 |
7,023,052 | 2011-08-11T08:40:00.000 | 0 | 0 | 0 | 0 | python,flask,werkzeug | 65,440,537 | 15 | false | 1 | 0 | If none of the above solutions are working, try manually adding "http://" to the beginning of the url.
Chrome can distinguish "[ip-address]:5000" from a search query. But sometimes that works for a while, and then stops connecting, seemingly without me changing anything. My hypothesis is that the browser might someti... | 1 | 605 | 0 | I'm not sure if this is Flask specific, but when I run an app in dev mode (http://localhost:5000), I cannot access it from other machines on the network (with http://[dev-host-ip]:5000). With Rails in dev mode, for example, it works fine. I couldn't find any docs regarding the Flask dev server configuration. Any idea w... | Configure Flask dev server to be visible across the network | 0 | 0 | 0 | 608,243 |
7,023,369 | 2011-08-11T09:05:00.000 | 0 | 0 | 0 | 0 | python,django,python-module | 7,023,397 | 4 | false | 1 | 0 | Is there a reason you want to import all modules?
It's a good practice to import only those modules, classes etc. which are needed... | 1 | 0 | 0 | Is there a way to import all the modules in the django project itself instead of setting up again and again in all the systems.
I would have used gem freeze or something like that in a rails project. | get the modules locally for django project | 0 | 0 | 0 | 334 |
7,024,626 | 2011-08-11T10:55:00.000 | 1 | 0 | 0 | 1 | python,windows,process,windows-services,operating-system | 7,026,127 | 1 | true | 0 | 0 | Naming a process 'unresponsive' is quite subjective. It might be waiting for data and seem unresponsive, or it might be in a (endless) loop and seem unresponsive.
Usually, what people do is implement hartbeat. That is - have a very tiny socket server in the process where other processes can connect and send ping messag... | 1 | 0 | 0 | I'm trying to build a small process monitoring script on Windows Server 2008.
The script would:
find target process
check status (running/unresponsive/stopped)
kill and restart process if unresponsive/stopped
Any suggestion on the best way to implement this? | Check status of process and restart process if unresponsive/stopped - Python | 1.2 | 0 | 0 | 1,575 |
7,025,833 | 2011-08-11T12:28:00.000 | 0 | 0 | 0 | 1 | python,subprocess | 7,027,423 | 1 | true | 0 | 0 | platform.popen has not been deprecated as best as I can tell. However, this is a low-level function that you should not make use of for flexibility and portability reasons.
Lots of other process-launching things were deprecated and some removed in Python 3. Many, many attempts at doing this well were made in the histor... | 1 | 1 | 0 | I have a bunch of code that uses the old deprecated popen from the platform package. Since this is deprecated, I will be moving this to the subprocess package.
What is the equivalent statement to popen("some_command")? Is there a reason that popen was deprecated? | Porting from platform.popen to subprocess.Popen? | 1.2 | 0 | 0 | 220 |
7,026,934 | 2011-08-11T13:43:00.000 | 2 | 0 | 1 | 0 | python,data-structures | 7,027,176 | 1 | true | 0 | 0 | You can use three deques but like this:
the original one for 1 minutes interval (instead of 15)
another one for 5 minutes, will receive events from the previous deque
another one for 15 minutes, will receive events from the previous deque.
This way, no duplicates and no indexing is needed. And this can be extended to... | 1 | 3 | 0 | I'm looking for an efficient way of solving a particular problem in Python. I have a stream of events arriving each with an associated timestamp. Conceptually I add these events to the end of a time ordered list and do some processing on them, making some changes to various counts and averages (depending on the type o... | Event lists in Python | 1.2 | 0 | 0 | 948 |
7,027,323 | 2011-08-11T14:07:00.000 | 6 | 0 | 1 | 0 | python | 7,027,365 | 3 | true | 0 | 0 | Yes, it's legimitate use. You will encounter that in many good Python codes. Just note that the convention is to write the names of such "constants" in UPPER_CASE. | 1 | 3 | 0 | I've written a small script in Python for simple text manipulation, consisting of a bunch of functions. Some of these functions contain magic numbers or string constants. Is it okay to store them in global variables? I do not intent to modify them, they are more like constants. | Is this a legal use of global variables in Python? | 1.2 | 0 | 0 | 216 |
7,027,803 | 2011-08-11T14:37:00.000 | 1 | 0 | 0 | 0 | python,django,git,pdb | 7,027,964 | 3 | false | 1 | 0 | The best option would be to have an extensive test suite, and to run the tests before pushing to production. Extraneous pdb breakpoints will prevent the tests from passing.
If you can't do that, then option 2 is the best: write a utility to break into the debugger, and make it sensitive to the state of the settings. ... | 2 | 3 | 0 | What do you suggest to get rid of pdb calls on production software?
In my case, I'm developing a django website.
I don't know if I should:
Monkey patch pdb from settings.py (dependding on DEBUG boolean).
Make a pdb wrapper for our project which expose set_trace or print basic log if DEBUG = True
Dissalow comitting b... | How to ensure there are no pdb calls out of debugging configuration? | 0.066568 | 0 | 0 | 133 |
7,027,803 | 2011-08-11T14:37:00.000 | 2 | 0 | 0 | 0 | python,django,git,pdb | 7,028,046 | 3 | true | 1 | 0 | The third one. You have to enforce some commit rules. For example, run a serie of tests before a commit, etc. This way, developpers have a simple way to check if a pdb break remain. If someone commit a set_trace, he has to bake a cake for the rest of the team.
This works fine in my company :-)
edit: you may present thi... | 2 | 3 | 0 | What do you suggest to get rid of pdb calls on production software?
In my case, I'm developing a django website.
I don't know if I should:
Monkey patch pdb from settings.py (dependding on DEBUG boolean).
Make a pdb wrapper for our project which expose set_trace or print basic log if DEBUG = True
Dissalow comitting b... | How to ensure there are no pdb calls out of debugging configuration? | 1.2 | 0 | 0 | 133 |
7,029,993 | 2011-08-11T17:05:00.000 | 3 | 0 | 0 | 0 | python,random,random-seed | 7,030,943 | 4 | false | 0 | 0 | The source of the seed and the distribution profile used are going to affect the outputs - if you are looking for cryptgraphic randomness, seeding from os.urandom() will get nearly real random bytes from device chatter (ie ethernet or disk) (ie /dev/random on BSD)
this will avoid you giving a seed and so generating det... | 1 | 117 | 1 | I have a big script in Python. I inspired myself in other people's code so I ended up using the numpy.random module for some things (for example for creating an array of random numbers taken from a binomial distribution) and in other places I use the module random.random.
Can someone please tell me the major difference... | Differences between numpy.random and random.random in Python | 0.148885 | 0 | 0 | 53,810 |
7,031,077 | 2011-08-11T18:38:00.000 | 2 | 1 | 0 | 1 | c++,python | 7,031,182 | 1 | false | 0 | 0 | Python honors PYTHONPATH environmental variable. It is a PATH like environmental variable specifying paths where Python loads modules.
Inside .py script PYTHONPATH can be accessed and updated through the sys.path variable.
If you can show more source code how you create Python interpreter more helpful answer can be giv... | 1 | 4 | 0 | When trying to to import and execute a function within a Python module from a C++ executable, how can I pass in the directory where the module is located as a command line argument? | specifiying directory of Python module when calling it from C++ | 0.379949 | 0 | 0 | 52 |
7,033,210 | 2011-08-11T21:39:00.000 | 3 | 0 | 1 | 0 | python,regex | 7,033,254 | 3 | true | 0 | 0 | That is fine for a un, but you might want to let them use -, _, %, @ and .. (Basically, [a-zA-Z0-9._%+-]). Many people will like using their email for a username and that covers well over 99% of them. In low security situations, I say let'em. | 1 | 1 | 0 | What is a good regex filter for usernames? [A-Za-z0-9 ] okay, or is that too inflexible? What other things should I look for? (Trimming whitespaces?) | How to sanitize username that would be in urls | 1.2 | 0 | 0 | 609 |
7,033,499 | 2011-08-11T22:07:00.000 | 9 | 0 | 1 | 0 | python,sequence,slice | 7,033,513 | 3 | true | 0 | 0 | [:] is the slice operator.
When it's on the left side, it overwrites the contents of the list without creating a new reference.
When it's on the right side, it creates a copy of the list with the same contents. | 1 | 8 | 0 | I was asked this for a coding test and didn't know the answer. Anyone have any ideas? | Difference between a[:] = b and a = b[:]? (Python) | 1.2 | 0 | 0 | 935 |
7,033,542 | 2011-08-11T22:11:00.000 | 1 | 0 | 1 | 0 | python,random,numbers,generator | 7,033,665 | 4 | false | 0 | 0 | If you need to maintain the file (which I think you do, in order to add new numbers), I would suggest you to "forget" using a plain text file and use SQLite or any other embedded DB that is backed up in a file, as you probably don't want to load all the numbers in memory.
The "feature" (or better said, data structure) ... | 1 | 1 | 0 | How do i generate random numbers but have the numbers avoid numbers already used.
I have a TXT file with thousands of sets of numbers and i need to generate a series of random numbers while avoiding these.
IE, TXT - 0102030405
my random number needs to avoid this number.
on a side note, how can i split up the TXT 10... | How do generate random numbers, while avoiding numbers already used | 0.049958 | 0 | 0 | 613 |
7,033,612 | 2011-08-11T22:19:00.000 | 0 | 1 | 0 | 0 | c++,python,profiling | 7,033,696 | 2 | false | 0 | 1 | The usual technique for profiling already-existing functions that we use in Lua a lot is to overwrite the function with your own version that will start timing, call the original function, and stop timing, returning the value that the original function returned. | 1 | 2 | 0 | I'm implementing a profiler in an application and I'm a little flummoxed about how to implement Python profiling such that the results can be displayed in my existing tool. The application allows for Python scripting via communication with the python interpreter.
I was wondering if anyone has ideas on how to profile Py... | How can I "hook into" Python from C++ when it executes a function? My goal is to profile | 0 | 0 | 0 | 447 |
7,033,844 | 2011-08-11T22:44:00.000 | 3 | 0 | 0 | 0 | java,python,node.js | 7,034,257 | 6 | false | 1 | 0 | Ryan did not start with JavaScript. A large part of why Node was created in JavaScript is that JavaScript lacked vast oceans of libraries.
Those vast oceans of libraries are almost all written in blocking code.
To take full advantage of Node.js you need to limit your self to non blocking libraries. Which means that m... | 1 | 41 | 0 | Recently I got introduced to node.js and cool packages like express and jade. I have few questions consistently knocking my door:
If I pick node.js to build my next website, I will be using JavaScript to write my server-side complicated logic? but I don't think you can compare JavaScript with Java or Python to write se... | Nodejs: Where or How to write complicated business logic? | 0.099668 | 0 | 0 | 18,486 |
7,036,584 | 2011-08-12T06:54:00.000 | 0 | 1 | 0 | 1 | python,eclipse,opengl,aptana,pydev | 7,036,672 | 3 | false | 0 | 0 | Are you sure you don't have multiple versions of python? Seems to me like the interpreter that aptana uses is not the same as the one used from command line. You can look in:
Run -> Run configurations -> Python run -- then you have Interpreter tab
There you can click : See resulting command line. Than will get you the ... | 3 | 1 | 0 | I am trying to import the OpenGL.GL module.
Given the py file with that line, I can perform "python file.py" just fine, but I cannot run that same file when used in Aptana or Eclipse. Both IDEs have PyDev installed.
I do have PyOpenGL installed.
I wish to point out that I can still import other modules (PIL, numpy), wh... | Python OpenGL in Eclipse/Aptana | 0 | 0 | 0 | 1,045 |
7,036,584 | 2011-08-12T06:54:00.000 | 1 | 1 | 0 | 1 | python,eclipse,opengl,aptana,pydev | 7,041,218 | 3 | false | 0 | 0 | Maybe you need to reconfigure your interpreter.
If you installed PyOpenGL as an egg after pydev was set up your PYTHONPATH might be out of date.
Check out Preferences->PyDev->Interpreter - Python | 3 | 1 | 0 | I am trying to import the OpenGL.GL module.
Given the py file with that line, I can perform "python file.py" just fine, but I cannot run that same file when used in Aptana or Eclipse. Both IDEs have PyDev installed.
I do have PyOpenGL installed.
I wish to point out that I can still import other modules (PIL, numpy), wh... | Python OpenGL in Eclipse/Aptana | 0.066568 | 0 | 0 | 1,045 |
7,036,584 | 2011-08-12T06:54:00.000 | 2 | 1 | 0 | 1 | python,eclipse,opengl,aptana,pydev | 10,692,265 | 3 | false | 0 | 0 | I had the same problem after installing a different version of PyOpen and my Eclipse PyDev path is messed up. What I did was remove the interpreter link and re-added the old one which made PyDev to re-scan my libs. This seems to fix the problem. Don't forget for all your projects, you need to go to the property (Right ... | 3 | 1 | 0 | I am trying to import the OpenGL.GL module.
Given the py file with that line, I can perform "python file.py" just fine, but I cannot run that same file when used in Aptana or Eclipse. Both IDEs have PyDev installed.
I do have PyOpenGL installed.
I wish to point out that I can still import other modules (PIL, numpy), wh... | Python OpenGL in Eclipse/Aptana | 0.132549 | 0 | 0 | 1,045 |
7,037,269 | 2011-08-12T08:10:00.000 | 1 | 0 | 0 | 0 | python,google-app-engine,datastore | 7,041,161 | 2 | true | 1 | 0 | You cannot filter for property non-existence. Every query must be satisfied by an index, and there's no "negative index" of entities that lack a given property.
Generally, you'll need to iterate over all entities, and just ignore the ones that already have the property. | 1 | 1 | 0 | I have updated my model in Datastore so now it has an additional field. Now I have entities with and without that field but I need to add this field to all entities that don't yet have it. Idea is to get entities in a function without that field and add it. So, I wonder how I can filter such entities in Datastore reque... | Check if a field is present in an entity | 1.2 | 0 | 0 | 487 |
7,037,468 | 2011-08-12T08:29:00.000 | 4 | 0 | 0 | 0 | python,django,path,installation | 7,037,509 | 10 | false | 1 | 0 | This approach I am describing works across operating systems...
You try this on your command line - python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
This gives you the base directory. From there, type /django/ and here you find all the default templates, admin templates, etc.
Hope this... | 4 | 113 | 0 | I use Django but I need to find the default templates and applications.
I don't know where it's installed.
How can I find that? | Where is my Django installation? | 0.07983 | 0 | 0 | 80,172 |
7,037,468 | 2011-08-12T08:29:00.000 | 1 | 0 | 0 | 0 | python,django,path,installation | 27,666,717 | 10 | false | 1 | 0 | Worth mentioning that if you are using a virtual env all the packages will be in your project's root venv folder under "lib" ... | 4 | 113 | 0 | I use Django but I need to find the default templates and applications.
I don't know where it's installed.
How can I find that? | Where is my Django installation? | 0.019997 | 0 | 0 | 80,172 |
7,037,468 | 2011-08-12T08:29:00.000 | -1 | 0 | 0 | 0 | python,django,path,installation | 30,408,755 | 10 | false | 1 | 0 | If you are using virtualenv then it will be: /home/user/path where you installed django/django_directory/lib/python2.7/site-packages/Django-1.8.1-py2.7.egg/django/contrib/admin/templates/admin/base_site.html base-site.html is the default template. | 4 | 113 | 0 | I use Django but I need to find the default templates and applications.
I don't know where it's installed.
How can I find that? | Where is my Django installation? | -0.019997 | 0 | 0 | 80,172 |
7,037,468 | 2011-08-12T08:29:00.000 | 13 | 0 | 0 | 0 | python,django,path,installation | 7,037,479 | 10 | false | 1 | 0 | On Microsft-Windows OS: In the Lib/site-packages folder inside your python installation. | 4 | 113 | 0 | I use Django but I need to find the default templates and applications.
I don't know where it's installed.
How can I find that? | Where is my Django installation? | 1 | 0 | 0 | 80,172 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.