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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
13,239,279 | 2012-11-05T19:49:00.000 | 5 | 0 | 1 | 0 | python,dictionary | 13,239,324 | 5 | false | 0 | 0 | No. Check the OrderedDict from collections module. | 2 | 10 | 0 | When I introduce new pair it is inserted at the beginning of dictionary. Is it possible to append it at the end? | Is it possible to add pair at the end of the dictionary in python | 0.197375 | 0 | 0 | 20,298 |
13,239,279 | 2012-11-05T19:49:00.000 | 7 | 0 | 1 | 0 | python,dictionary | 13,239,328 | 5 | false | 0 | 0 | A dict in Python is not "ordered" - in Python 2.7+ there's collections.OrderedDict, but apart from that - no... The key point of a dictionary in Python is efficient key->lookup value... The order you're seeing them in is completely arbitrary depending on the hash algorithm... | 2 | 10 | 0 | When I introduce new pair it is inserted at the beginning of dictionary. Is it possible to append it at the end? | Is it possible to add pair at the end of the dictionary in python | 1 | 0 | 0 | 20,298 |
13,241,503 | 2012-11-05T22:34:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine,google-cloud-datastore | 13,250,634 | 2 | false | 1 | 0 | A repeated string property is your best option. | 1 | 0 | 0 | I want to have a property on a database model of mine in Google App Engine and I am not sure which category works the best. I need it to be a tag cloud similar to the Tags on SO. Would a text property be best or should I use a string property and make it repeated=True.
The second seems best to me and then I can just ... | Which GAE Database Property Fits a Tag Property? | 0.099668 | 0 | 0 | 72 |
13,241,827 | 2012-11-05T23:05:00.000 | 5 | 1 | 1 | 0 | python,python-import | 13,241,883 | 2 | true | 0 | 0 | Just import them where they're needed. After a module has been imported once, it is cached so that any subsequent imports will be quick. If you import the same module 20 times, only the first one will be slow. | 1 | 1 | 0 | I have a Python program that has several slow imports. I'd like to delay importing them until they are needed. For instance, if a user is just trying to print a help message, it is silly to import the slow modules. What's the most Pythonic way to do this?
I'll add a solution I was playing with as a answer. I know you... | What's the best way to do a just-in-time import of Python libraries? | 1.2 | 0 | 0 | 421 |
13,243,581 | 2012-11-06T02:43:00.000 | 1 | 1 | 0 | 0 | java,python,ruby,email,clojure | 13,243,729 | 1 | false | 0 | 0 | Almost every mail server has some form of extensibility where you can insert logic in the mail-flow process, it's how some spam filters were implemented before they were built directly in to the servers. Personally, I use Exchange server which has a variety of points and APIs to extend it, such as SMTP Sinks.
However, ... | 1 | 0 | 0 | I am interested to build a mail service that allows you to incorporate custom logic in the your mail server.
For example, user A can reply to helloworld@mysite.com once and subsequent emails from user A to helloworld@mysite.com will not go through until certain actions are taken.
I am looking for something simple and ... | Customizable mail server - what are my options? | 0.197375 | 0 | 0 | 92 |
13,245,772 | 2012-11-06T06:43:00.000 | 0 | 0 | 0 | 0 | python,sockets | 13,245,863 | 3 | false | 0 | 0 | Sockets are handled and controlled by OS. Any programming language what do is just put the data to buffer in OS. So in order to check the open sockets you just have to read them by operating system. | 1 | 0 | 0 | In Python 2.7 is there a way to get information on all open sockets similar to what netstat/ss does in linux?
I am interested in writing a small program (similar to EtherApe) that tracks when my computer opens a connection to a server. | Show all open sockets in Python | 0 | 0 | 1 | 3,146 |
13,248,020 | 2012-11-06T09:25:00.000 | 7 | 0 | 1 | 0 | python | 13,248,068 | 3 | false | 0 | 0 | One difference is for r+ if the files does not exist, it'll not be created and open fails. But in case of a+ the file will be created if it does not exist. | 1 | 46 | 0 | I have try r+ and a+ to open file and read and write, but 'r+' and 'a+' are all append the str to the end of the file.
So, what's the difference between r+ and a+ ?
Add:
I have found the reason:
I have read the file object and forgot to seek(0) to set the location to the begin | What's the difference between 'r+' and 'a+' when open file in python? | 1 | 0 | 0 | 137,317 |
13,248,848 | 2012-11-06T10:15:00.000 | 1 | 0 | 0 | 0 | python-2.7,wxpython,wxwidgets | 13,254,838 | 1 | true | 0 | 1 | ObjectListView is just a nice wrapper around the ListCtrl. To my knowledge, the ListCtrl does not support the embedding of other widgets. You could create a popup dialog when double-clicking a cell and do it that way. Otherwise, you would have to use the UltimateListCtrl. That widget DOES allow widget embedding because... | 1 | 0 | 0 | If this is possible, can you show some code example? Thanks in advance. | Can we embedd a ComboBox or a TextCtrl on the ObjectListView of wxPython? | 1.2 | 0 | 0 | 203 |
13,249,147 | 2012-11-06T10:34:00.000 | 0 | 0 | 0 | 1 | python,google-apps-script | 13,249,247 | 1 | false | 0 | 0 | Yes. You would need to authorize it the first time and implement oAuth from the script though. I strongly suggest that you switch to the Google Drive API. | 1 | 0 | 0 | Would it be possible for some type of Python script to check services running on a linux box, and integrate with a google app script, so it would then populate a google doc spreadsheet stating whther a service is running or not ? | Python/Google Apps Script integration | 0 | 0 | 0 | 164 |
13,250,046 | 2012-11-06T11:27:00.000 | 3 | 0 | 0 | 0 | python,pandas,csv,types | 58,968,554 | 6 | false | 0 | 0 | You Can do This , Works On all Versions of Pandas
pd.read_csv('filename.csv', dtype={'zero_column_name': object}) | 1 | 76 | 1 | I am importing study data into a Pandas data frame using read_csv.
My subject codes are 6 numbers coding, among others, the day of birth. For some of my subjects this results in a code with a leading zero (e.g. "010816").
When I import into Pandas, the leading zero is stripped of and the column is formatted as int64.
... | How to keep leading zeros in a column when reading CSV with Pandas? | 0.099668 | 0 | 0 | 62,070 |
13,251,192 | 2012-11-06T12:34:00.000 | 0 | 0 | 1 | 0 | python,coding-style | 13,251,219 | 3 | false | 0 | 0 | If a function succeeds or fails return a boolean True or False.
If it causes an error, throw an exception.
If it mutates something don't put a return. | 2 | 0 | 0 | Suppose I'm writing a function in python, this function can either be success or raise exception.
So which one shall I use:
return
return True
no return
Edit:
Thanks for response. In this case I mean to ask if return Value have no further meaning, shall I still do a return True or something.
The case I'm working on ... | About python function return value best practice | 0 | 0 | 0 | 2,748 |
13,251,192 | 2012-11-06T12:34:00.000 | 2 | 0 | 1 | 0 | python,coding-style | 13,251,230 | 3 | false | 0 | 0 | Don't bother returning anything, unless you explicitly specify that the function intends to return something useful.
This way you can assume that everything has succeeded if no exception was thrown, | 2 | 0 | 0 | Suppose I'm writing a function in python, this function can either be success or raise exception.
So which one shall I use:
return
return True
no return
Edit:
Thanks for response. In this case I mean to ask if return Value have no further meaning, shall I still do a return True or something.
The case I'm working on ... | About python function return value best practice | 0.132549 | 0 | 0 | 2,748 |
13,252,683 | 2012-11-06T14:03:00.000 | 3 | 0 | 0 | 1 | python,google-app-engine | 13,252,901 | 2 | false | 1 | 0 | There's still a cursor, even if the last result is retrieved. The query class doesn't know that, in any case: it knows what you've had already, but it doesn't know what else is still to come. The cursor doesn't represent any actual result, it's simply a way of resuming the query later. In fact, it's possible to use a c... | 1 | 2 | 0 | From the Google App Engine documentation:
"cursor() returns a base64-encoded cursor string denoting the position in the query's result set following the last result retrieved."
What does it return if the the last result retrieved IS the last result in the query set? Wouldn't this mean that there is no position that can... | what does the cursor() method of GAE Query class return if the last result was already retrieved? | 0.291313 | 0 | 0 | 119 |
13,253,510 | 2012-11-06T14:50:00.000 | 0 | 0 | 1 | 1 | python,django,windows,vim,ide | 19,894,858 | 5 | false | 0 | 0 | One possible compromise is to use your favorite IDE with a vim emulator plugin. For example, in Eclipse you can use Vrapper, PyCharm has IdeaVim and so forth. Lighttable also has vim key-bindings. The plug-ins (or key-binding options) give you some of the benefits of editing in Vim while still having the powerful debug... | 1 | 1 | 0 | I am turning to Python from .NET world. And Visual Studio was something a great tool i used.
In python world we do have basic IDLE and another one is VIM. I have seen that a lot of developers have configured VIM to a great IDE. Using basic VIM in Windows 7 seems of less use.
So i want to moderate my VIM to a level whic... | Using VIM for Python IDE in Windows? | 0 | 0 | 0 | 4,165 |
13,254,044 | 2012-11-06T15:19:00.000 | 0 | 0 | 1 | 0 | python,interactive-shell,python-interactive | 13,254,202 | 2 | false | 0 | 0 | I believe the pickle package should work for you. You can use pickle.dump or pickle.dumps to save the state of most objects. (then pickle.load or pickle.loads to get it back) | 1 | 0 | 0 | I am trying to build an online Python Shell. I execute commands by creating an instance of InteractiveInterpreter and use the command runcode. For that I need to store the interpreter state in the database so that variables, functions, definitions and other values in the global and local namespaces can be used across c... | How to store the current state of InteractiveInterpreter Object in a database? | 0 | 1 | 0 | 136 |
13,258,448 | 2012-11-06T19:59:00.000 | 0 | 0 | 0 | 0 | python-3.x,clipboardmanager | 13,261,057 | 1 | true | 0 | 1 | Clipboards are framework specific. So a good place would be to select a GUI framework, and look at it's documentation for how to deal with cut and paste. | 1 | 0 | 0 | Where would be a good place start learning to program a clipboard manager in python. i want to be able to copy selected text with a keyboard macro and set it to a slot identified ny the key combo "ctrl+alt+c+1", "ctrl+alt+c+2" storing more than one thing, also so would be got to be able to contaminate on to what is in ... | Python clipboard manager? | 1.2 | 0 | 0 | 964 |
13,261,858 | 2012-11-07T01:07:00.000 | 0 | 1 | 0 | 0 | python,twitter,twython | 16,578,360 | 2 | false | 0 | 0 | considering the case of similar tweets and retweets, I would recommend making a semantic note of the whole tweet, extracting the text part of each tweet and doing a dictionary lookup.
but tweet id is more simpler with significant loss, usage as noted above. | 1 | 1 | 0 | I'm working on a project which requires counting the number of tweets that meet the parameters of a query. I'm working in Python, using Twython as my interface to Twitter.
A few questions though, how do you record which tweets have already been accounted for? Would you simply make a note of the last tweet ID and ignore... | How to count tweets from query without double counting? | 0 | 0 | 0 | 245 |
13,262,047 | 2012-11-07T01:34:00.000 | 3 | 0 | 1 | 0 | java,python,security,encryption,aes | 13,262,092 | 1 | true | 1 | 0 | Typically, you'd generate the IV randomly, and send it along with the encrypted message. The IV doesn't need to be secret--it just needs to be different for every message you send.
There are a wide variety of concerns to worry about when implementing crypto. Your block cipher mode matters, for instance--if you're using... | 1 | 1 | 0 | I'm making a project in Java and Python that includes sending an encrypted string from one to the other. I can get the languages to understand each other and fully de-crypt / encrypt strings. However I was talking to somebody and was told that I am not being totally secure. I am using AES encryption for the project. Pa... | AES Encryption (Python and Java) | 1.2 | 0 | 0 | 631 |
13,267,912 | 2012-11-07T10:36:00.000 | 1 | 1 | 0 | 0 | c++,python,boost-python | 13,363,934 | 2 | true | 0 | 1 | The from python conversion is in fact done in builtin_converters.cpp and not in the header part of the library. I Copied this file and deleted everything except the converter for long double, which I was then able to modify. | 1 | 2 | 0 | Where does boost python register from python converters for builtin types such as from PyLong_Type to double?
I want to define a converter that can take a numpy.float128 from python and returns a long double for functions in C++. I already did it the other way round, the to_python converter. For that I tweaked builtin_... | From python converter for builtin types | 1.2 | 0 | 0 | 300 |
13,274,197 | 2012-11-07T16:42:00.000 | 9 | 0 | 0 | 0 | python,amazon-web-services,boto,amazon-glacier | 13,275,014 | 1 | true | 1 | 0 | The AWS Glacier service does not provide a way to delete a job. You can:
Initiate a job
Describe a job
Get the output of a job
List all of your jobs
The Glacier service manages the jobs associated with an vault. | 1 | 7 | 0 | I have started a retrival job for an archive stored in one of my vaults on
Glacier AWS.
It turns out that I do not need to resurrect and download that archive any more.
Is there a way to stop and/or delete my Glacier job?
I am using boto and I cannot seem to find a suitable function.
Thanks | AWS glacier delete job | 1.2 | 1 | 0 | 1,164 |
13,280,680 | 2012-11-08T00:31:00.000 | 3 | 0 | 1 | 0 | python,python-3.x,python-2.x | 24,463,654 | 8 | false | 0 | 0 | Well, not discounting the problems cautioned about at the start. But it can be useful in certain cases.
First of all, the reason I am looking this post up is because I did just this and __slots__ doesn't like it. (yes, my code is a valid use case for slots, this is pure memory optimization) and I was trying to get ar... | 5 | 35 | 0 | Say I have a class, which has a number of subclasses.
I can instantiate the class. I can then set its __class__ attribute to one of the subclasses. I have effectively changed the class type to the type of its subclass, on a live object. I can call methods on it which invoke the subclass's version of those methods.
So, ... | How dangerous is setting self.__class__ to something else? | 0.07486 | 0 | 0 | 8,582 |
13,280,680 | 2012-11-08T00:31:00.000 | 30 | 0 | 1 | 0 | python,python-3.x,python-2.x | 13,280,789 | 8 | true | 0 | 0 | Here's a list of things I can think of that make this dangerous, in rough order from worst to least bad:
It's likely to be confusing to someone reading or debugging your code.
You won't have gotten the right __init__ method, so you probably won't have all of the instance variables initialized properly (or even at all)... | 5 | 35 | 0 | Say I have a class, which has a number of subclasses.
I can instantiate the class. I can then set its __class__ attribute to one of the subclasses. I have effectively changed the class type to the type of its subclass, on a live object. I can call methods on it which invoke the subclass's version of those methods.
So, ... | How dangerous is setting self.__class__ to something else? | 1.2 | 0 | 0 | 8,582 |
13,280,680 | 2012-11-08T00:31:00.000 | 5 | 0 | 1 | 0 | python,python-3.x,python-2.x | 13,281,013 | 8 | false | 0 | 0 | On arbitrary classes, this is extremely unlikely to work, and is very fragile even if it does. It's basically the same thing as pulling the underlying function objects out of the methods of one class, and calling them on objects which are not instances of the original class. Whether or not that will work depends on int... | 5 | 35 | 0 | Say I have a class, which has a number of subclasses.
I can instantiate the class. I can then set its __class__ attribute to one of the subclasses. I have effectively changed the class type to the type of its subclass, on a live object. I can call methods on it which invoke the subclass's version of those methods.
So, ... | How dangerous is setting self.__class__ to something else? | 0.124353 | 0 | 0 | 8,582 |
13,280,680 | 2012-11-08T00:31:00.000 | 17 | 0 | 1 | 0 | python,python-3.x,python-2.x | 13,281,122 | 8 | false | 0 | 0 | Assigning the __class__ attribute is useful if you have a long time running application and you need to replace an old version of some object by a newer version of the same class without loss of data, e.g. after some reload(mymodule) and without reload of unchanged modules. Other example is if you implement persistency... | 5 | 35 | 0 | Say I have a class, which has a number of subclasses.
I can instantiate the class. I can then set its __class__ attribute to one of the subclasses. I have effectively changed the class type to the type of its subclass, on a live object. I can call methods on it which invoke the subclass's version of those methods.
So, ... | How dangerous is setting self.__class__ to something else? | 1 | 0 | 0 | 8,582 |
13,280,680 | 2012-11-08T00:31:00.000 | 0 | 0 | 1 | 0 | python,python-3.x,python-2.x | 13,280,788 | 8 | false | 0 | 0 | How "dangerous" it is depends primarily on what the subclass would have done when initializing the object. It's entirely possible that it would not be properly initialized, having only run the base class's __init__(), and something would fail later because of, say, an uninitialized instance attribute.
Even without that... | 5 | 35 | 0 | Say I have a class, which has a number of subclasses.
I can instantiate the class. I can then set its __class__ attribute to one of the subclasses. I have effectively changed the class type to the type of its subclass, on a live object. I can call methods on it which invoke the subclass's version of those methods.
So, ... | How dangerous is setting self.__class__ to something else? | 0 | 0 | 0 | 8,582 |
13,280,743 | 2012-11-08T00:40:00.000 | 3 | 0 | 1 | 0 | python,time,precision | 13,280,845 | 1 | true | 0 | 0 | How much precision do you want? While it's true that there are finite decimal fractions that can't be represented as finite binary fractions, the nearest approximate value is going to round to the correct number of integer milliseconds as long as you aren't timing a program running for 143 millenia (2**52 milliseconds)... | 1 | 3 | 0 | I want to capture timestamps with sub-second precision in python. It looks like the standard answer is int(time.time() * 1000)
However, if time.time() returns a float, won't you have precision problems? There will be some values that won't represent accurately as a float.
I'm worried about some fractional times that do... | In Python, is time.time() * 1000 precise enough? | 1.2 | 0 | 0 | 2,199 |
13,281,377 | 2012-11-08T01:59:00.000 | 6 | 0 | 1 | 0 | python,dictionary | 13,281,387 | 4 | false | 0 | 0 | [d['key'][2]] should do the trick ...
Breaking it down:
d['key'] retieves the tuple from the dictionary
[2] subscripts the list and gets the desired item out of it
The outer brackets put the final object into a list | 1 | 0 | 0 | If I have d = {"key": (5,4,"val1","val2",2)} How would I grab val1 out of the tuple and turn it into a list by itself? | Python: Converting a dictionary value to a list | 1 | 0 | 0 | 79 |
13,282,190 | 2012-11-08T03:59:00.000 | 2 | 0 | 0 | 0 | python | 13,282,258 | 2 | true | 0 | 0 | Calculate the angle from the door hinge to each of the points; whichever is closest to the current angle of the door itself (hinge to door edge) will be hit first when rotating.
If the cycling is giving you trouble: notice that for any given angle, you can subtract it from 360 to get its complement; whichever is the sm... | 1 | 0 | 0 | I'm trying to some some code in python. Basically what it does is simulates a door (viewed from above) on an (x,y) coordinate system. The task is given a list of points, determine which the door will hit first, if any.
Determining if a point is within range to be hit by the door is simple enough, determining which poin... | Point wrapping algorithm - A blocked Swinging door | 1.2 | 0 | 0 | 382 |
13,283,451 | 2012-11-08T06:08:00.000 | 1 | 0 | 1 | 0 | python,calculator,operation,operand | 13,283,479 | 3 | false | 0 | 0 | If you're allowed to, I'd recommend checking out the ast module. It's designed to do stuff like this for you using Python's own parser.
For an actual application, you'd probably use a parser generator like Ply.
For a simple homework assignment like this, you're probably expected to handcode a parser. First tokenize it ... | 1 | 2 | 0 | So I was trying to figure out how to detect the number of operands and operations in a mathematical expression
Ex: 1+2*9/2
I was trying to separate the operands and the operations into their own form using functions because we have to check how many operations must be done and in the correct order (PEDMAS) as well.
I'... | How to find the operand and the operation in a string | 0.066568 | 0 | 0 | 4,720 |
13,284,566 | 2012-11-08T07:38:00.000 | 0 | 0 | 1 | 0 | javascript,python,json,storage,offlineapps | 13,284,691 | 6 | false | 0 | 0 | My suggestion would be something like WampServer (Windows, Apache, MySQL, PHP). I've seen a few tutorials about adding Python to that mix.
You would have access to reading and writing JSON data to the local storage or placing your data in a local database. | 2 | 1 | 0 | Problem
I need a way to store and collect JSON data in an entirely offline(!) web application, hosted on a local (shared) machine. Several people will access the app but it will never actually be online.
I'd like the app to:
Read and write JSON data continuously and programmatically (i.e. not using a file-upload type ... | How to read and write JSON offline on local machine? | 0 | 0 | 1 | 2,518 |
13,284,566 | 2012-11-08T07:38:00.000 | 0 | 0 | 1 | 0 | javascript,python,json,storage,offlineapps | 13,285,068 | 6 | false | 0 | 0 | I know you said you don't want to opt for local server, but nodejs could be the solution. If you know JavaScript, then it's very simple to set one server up and let everybody access to the server from any browser. Since it's entirely JavaScript you don't even have conversion issues with the JSON format.
For storing the... | 2 | 1 | 0 | Problem
I need a way to store and collect JSON data in an entirely offline(!) web application, hosted on a local (shared) machine. Several people will access the app but it will never actually be online.
I'd like the app to:
Read and write JSON data continuously and programmatically (i.e. not using a file-upload type ... | How to read and write JSON offline on local machine? | 0 | 0 | 1 | 2,518 |
13,286,049 | 2012-11-08T09:22:00.000 | 1 | 0 | 0 | 0 | python,scrapy,web-crawler | 13,641,429 | 2 | true | 1 | 0 | After some time we found the solution - response.meta['depth'] | 1 | 0 | 0 | Subj.I want to get page (nested) level in scrapy on each page(url, request) in spider, is there any way to do that? | Get page (nested) level scrapy on each page(url, request) in spider | 1.2 | 0 | 1 | 294 |
13,288,013 | 2012-11-08T11:17:00.000 | 1 | 0 | 1 | 0 | python,virtualenv,mysql-python | 43,866,023 | 3 | false | 0 | 0 | source $ENV_PATH/bin/activate
pip uninstall MySQL-python
pip install MySQL-python
this worked for me. | 2 | 9 | 0 | I'm using the most recent versions of all software (Django, Python, virtualenv, MySQLdb) and I can't get this to work. When I run "import MySQLdb" in the python prompt from outside of the virtualenv, it works, inside it says "ImportError: No module named MySQLdb".
I'm trying to learn Python and Linux web development. ... | Have MySQLdb installed, works outside of virtualenv but inside it doesn't exist. How to resolve? | 0.066568 | 1 | 0 | 6,817 |
13,288,013 | 2012-11-08T11:17:00.000 | 14 | 0 | 1 | 0 | python,virtualenv,mysql-python | 13,288,095 | 3 | true | 0 | 0 | If you have created the virtualenv with the --no-site-packages switch (the default), then system-wide installed additions such as MySQLdb are not included in the virtual environment packages.
You need to install MySQLdb with the pip command installed with the virtualenv. Either activate the virtualenv with the bin/acti... | 2 | 9 | 0 | I'm using the most recent versions of all software (Django, Python, virtualenv, MySQLdb) and I can't get this to work. When I run "import MySQLdb" in the python prompt from outside of the virtualenv, it works, inside it says "ImportError: No module named MySQLdb".
I'm trying to learn Python and Linux web development. ... | Have MySQLdb installed, works outside of virtualenv but inside it doesn't exist. How to resolve? | 1.2 | 1 | 0 | 6,817 |
13,290,514 | 2012-11-08T14:04:00.000 | 0 | 0 | 0 | 0 | python,django | 66,928,557 | 3 | false | 1 | 0 | Sometimes this can happen if you haven't added your app to
INSTALLED_APPS = [ 'app', ]
in settings.py | 1 | 2 | 0 | I've create a command in app/management/commands and this command was working fine. I'm unable to run this command now. I'm getting the following error:
Unknown command: 'my_custom_command_name'
I'm using a virtual env. I don't see this in list of commands when I type pythong manage.py. I've this app installed in my se... | Unable to run django custom command | 0 | 0 | 0 | 2,913 |
13,294,968 | 2012-11-08T18:00:00.000 | 1 | 0 | 1 | 0 | python,large-data | 13,295,051 | 4 | false | 0 | 0 | Well if you just need to store it, why keep it in memory, use some kind of database. | 1 | 2 | 0 | This is a task I could have used a dict for, if it weren't for the fact that I will need to store much more data than can fit in my 4 GBs of RAM. I'm also doing other memory-demanding stuff in the same program, so the lower mem-requirements, the better.
I just want to
store many strings
check whether a string is incl... | Memory efficient way of checking inclusion | 0.049958 | 0 | 0 | 137 |
13,295,331 | 2012-11-08T18:25:00.000 | 1 | 0 | 1 | 0 | python,google-maps,tkinter | 13,311,950 | 2 | false | 0 | 1 | Most GUI Frameworks have a way to embed a web browser frame, with a way to execute javascript from the python code. If this is available to you, you could use the Google Maps JavaScript API v3 to display a map.
If you let us know which GUI framework you're using, we might be able to help more. | 1 | 5 | 0 | I'm working on a project in Python using tkinter that will allow for geolocation of IP addresses. I have the raw conversions down, and I can take an IP address and know city, state, country, longitude, latitude, etc. I'm wondering if there's any way to embed Google Maps or something similar into my program to offer a... | How can I embed google maps into my Python program? | 0.099668 | 0 | 0 | 7,845 |
13,296,320 | 2012-11-08T19:29:00.000 | 2 | 0 | 0 | 1 | python,web-applications,deployment | 13,296,458 | 1 | true | 0 | 0 | It all depends on your application.
You can:
use Puppet to deploy servers,
use Fabric to remotely connect to the servers and execute specific tasks,
use pip for distributing Python modules (even non-public ones) and install dependencies,
use other tools for specific tasks (such as use boto to work with Amazon Web Serv... | 1 | 4 | 0 | We are developing a distributed application in Python. Right now, we are about to re-organize some of our system components and deploy them on separate servers, so I'm looking to understand more about deployment for an application such as this. We will have several back-end code servers, several database servers (of ... | Python deployment for distributed application | 1.2 | 0 | 0 | 821 |
13,297,219 | 2012-11-08T20:26:00.000 | 4 | 0 | 1 | 0 | python,ipython | 13,297,236 | 3 | false | 0 | 0 | To use ipython, just go to the command line, and run the command ipython. | 1 | 5 | 0 | I've installed ipython, but I don't know how to use it. Where could I find ipython shell? | Where to use ipython and where is ipthon shell? | 0.26052 | 0 | 0 | 5,087 |
13,298,480 | 2012-11-08T21:54:00.000 | -1 | 0 | 1 | 0 | python-2.7,pymongo,couchdbkit | 13,641,512 | 1 | false | 0 | 0 | bson
Try LogoDb from 1985 logo programming language for trs-80 | 1 | 0 | 0 | We are developing application for which we going to use a NoSql database. We have evaluated couchdb and mongodb. Our application is in python and read-speed is most critical for our application. And application is reading a large number of documents.
I want ask:
Is reading large number of documents is faster in bson... | CouchDB vs mongodb | -0.197375 | 1 | 0 | 468 |
13,298,630 | 2012-11-08T22:04:00.000 | 1 | 1 | 1 | 0 | python,eclipse | 46,827,826 | 11 | false | 0 | 0 | First of all make sure that you have the same Python interpreter configured as the project has. You can change it under:
Window > Preferences > PyDev > Interpreters > Python Interpreters
As long the project was created using Eclipse you can use import functionality.
Go to:
File > Import... > General > Existing Project... | 8 | 29 | 0 | I am using eclipse for python.
How do I import an existing project into eclipse in the current workspace.
Thanks | How do I import a pre-existing python project into Eclipse? | 0.01818 | 0 | 0 | 46,104 |
13,298,630 | 2012-11-08T22:04:00.000 | 10 | 1 | 1 | 0 | python,eclipse | 25,244,825 | 11 | false | 0 | 0 | At time of writing none of the given answers worked.
This is how it's done:
Locate the directory containing the Pydev project
Delete the PyDev project files (important as Eclipse won't let you create a new project in the same location otherwise)
In Eclipse, File->New->Pydev Project
Name the project the same as your or... | 8 | 29 | 0 | I am using eclipse for python.
How do I import an existing project into eclipse in the current workspace.
Thanks | How do I import a pre-existing python project into Eclipse? | 1 | 0 | 0 | 46,104 |
13,298,630 | 2012-11-08T22:04:00.000 | 0 | 1 | 1 | 0 | python,eclipse | 16,728,953 | 11 | false | 0 | 0 | I just suffered through this problem for a few hours. My issue may have been different than yours...Pydev did not show up as an import option (as opposed to C projects). My solution is to drag and drop. Just create a new project (name it the same as your old) and then drop your old project into the new project folder a... | 8 | 29 | 0 | I am using eclipse for python.
How do I import an existing project into eclipse in the current workspace.
Thanks | How do I import a pre-existing python project into Eclipse? | 0 | 0 | 0 | 46,104 |
13,298,630 | 2012-11-08T22:04:00.000 | 3 | 1 | 1 | 0 | python,eclipse | 13,299,322 | 11 | true | 0 | 0 | Following are the steps
Select pydev Perspective
right click on the project pan and click "import"
From the list select the existing project into workspace.
Select root directory by going next
Optionally you can select to copy the project into
thanks | 8 | 29 | 0 | I am using eclipse for python.
How do I import an existing project into eclipse in the current workspace.
Thanks | How do I import a pre-existing python project into Eclipse? | 1.2 | 0 | 0 | 46,104 |
13,298,630 | 2012-11-08T22:04:00.000 | 9 | 1 | 1 | 0 | python,eclipse | 22,244,064 | 11 | false | 0 | 0 | make sure pydev interpreter is added, add otherwise
windows->preferences->Pydev->Interpreter-Python
then create new pydev project,
give the same name
then don't use default location, browse to point the project location. | 8 | 29 | 0 | I am using eclipse for python.
How do I import an existing project into eclipse in the current workspace.
Thanks | How do I import a pre-existing python project into Eclipse? | 1 | 0 | 0 | 46,104 |
13,298,630 | 2012-11-08T22:04:00.000 | 14 | 1 | 1 | 0 | python,eclipse | 31,423,129 | 11 | false | 0 | 0 | In my case when i am trying to import my existing perforce project , it gives error no project found on windows machine. On linux i was able to import project nicely.
For Eclipse Kepler, i have done like below.
Open eclipse in pydev perspective.
Create a new pydev project in your eclipse workspace with the same name w... | 8 | 29 | 0 | I am using eclipse for python.
How do I import an existing project into eclipse in the current workspace.
Thanks | How do I import a pre-existing python project into Eclipse? | 1 | 0 | 0 | 46,104 |
13,298,630 | 2012-11-08T22:04:00.000 | 15 | 1 | 1 | 0 | python,eclipse | 13,298,723 | 11 | false | 0 | 0 | New Project
Dont use default Location
Browse to existing project location ...
if its an existing eclipse project with project files that have correct paths for your system you can just open the .proj file ... | 8 | 29 | 0 | I am using eclipse for python.
How do I import an existing project into eclipse in the current workspace.
Thanks | How do I import a pre-existing python project into Eclipse? | 1 | 0 | 0 | 46,104 |
13,298,630 | 2012-11-08T22:04:00.000 | 0 | 1 | 1 | 0 | python,eclipse | 28,258,101 | 11 | false | 0 | 0 | After following steps outlined by @Shan, if the folders under the root folder are not shown as packages,
Right-click on the root folder in PyDev Package Explorer
Select PyDev > Set as source-folder
It will add the root folder to the PYTHONPATH and now the folders will appear as packages | 8 | 29 | 0 | I am using eclipse for python.
How do I import an existing project into eclipse in the current workspace.
Thanks | How do I import a pre-existing python project into Eclipse? | 0 | 0 | 0 | 46,104 |
13,298,788 | 2012-11-08T22:16:00.000 | 2 | 0 | 0 | 0 | python,web-crawler,scrapy | 13,299,332 | 1 | false | 1 | 0 | If the site you are scraping does IP based detection, your only option is going to be to change your IP somehow. This means either using a different server (I don't believe EC2 operates in India) or proxying your server requests. Perhaps you can find an Indian proxy service? | 1 | 1 | 0 | I am trying to scrape a website which serves different page depending upon the geolocation of the IP sending the request. I am using an amazon EC2 located in US(which means it serves up a page meant for US) but I want the page that will be served in India. Does scrapy provide a way to work around this somehow? | fake geolocation with scrapy crawler | 0.379949 | 0 | 1 | 722 |
13,299,023 | 2012-11-08T22:31:00.000 | 6 | 1 | 0 | 1 | php,python,django,nginx,tornado | 13,304,821 | 1 | true | 1 | 0 | I'll go point by point:
Yes. It's ok to run tornado and nginx on one server. You can use nginx as reverse proxy for tornado also.
Haproxy will give you benefit, if you have more than one server instances. Also it will allow you to proxy websockets directly to tornado.
Actually, nginx can be used for redirects, with ... | 1 | 5 | 0 | Our website has developed a need for real-time updates, and we are considering various comet/long-polling solutions. After researching, we have settled on nginx as a reverse proxy to 4 tornado instances (hosted on Amazon EC2). We are currently using the traditional LAMP stack and have written a substantial amount of ... | Apache/PHP to Nginx/Tornado/Python | 1.2 | 0 | 0 | 2,544 |
13,301,469 | 2012-11-09T02:56:00.000 | 14 | 0 | 1 | 0 | python,pycharm | 16,985,124 | 2 | false | 0 | 0 | I just came across the same problem. It was because it had a class called TestClass in the file. I changed the name of the class and then I was able to run the file as normal. | 1 | 19 | 0 | I'm doing small time project development using PyCharm. I use Pycharm for its intellisense features. As I develop each piece of code, I like to run it occasionally to test it. All I need at the point of development is to be able to run the file. However, when I right click and try to run a standalone file, PyCharm trie... | How to run standalone files in PyCharm | 1 | 0 | 0 | 18,880 |
13,303,464 | 2012-11-09T06:51:00.000 | 0 | 0 | 0 | 0 | python,crystal-reports,flask,jinja2 | 68,141,752 | 3 | false | 1 | 0 | In my case loaders.py had a hardcode "utf-8" in several places which I replaced with "windows-1251" and for me everything worked! | 1 | 3 | 0 | I write a simple frontend for pretty old reporting system, which uses Crystal Reports 8 Web Component Server.
And I need to make a 'POST' request to this Web Component. When I'm making request from page encoded using standard UTF-8, all form data is passed in UTF-8 too. And that's the problem, because CR8 Web Component... | Can flask (using jinja2) render templates using 'windows-1251' encoding? | 0 | 0 | 0 | 3,341 |
13,304,136 | 2012-11-09T07:49:00.000 | 1 | 0 | 0 | 0 | python,qt4,python-2.7,pyside,qtreewidget | 15,232,509 | 2 | false | 0 | 1 | You need to override the click behaviour. Check the event if it's a double click or not and then you can redirect the event to the appropriate call. You should check the state if it's already clicked or not to prevent a second animation which might happen. | 1 | 4 | 0 | I have created a QTreeWidget and set animation to true (setAnimated(true)).
When I'm clicking on a mark (triangle) at the left of item it expands smoothly, but when I'm double clicking on the item it expands too fast (almost like there is no "animated" flag set).
I want smooth animation on double click too. How can I s... | QTreeWidget expand animation on double click | 0.099668 | 0 | 0 | 1,404 |
13,306,359 | 2012-11-09T10:32:00.000 | 4 | 0 | 0 | 1 | python,linux,twisted,sigkill | 13,306,625 | 2 | false | 0 | 0 | From the signal(2) man page:
The signals SIGKILL and SIGSTOP cannot be caught or ignored.
So there is no way the process can run any cleanup code in response to that signal. Usually you only use SIGKILL to terminate a process that doesn't exit in response to SIGTERM (which can be caught). | 2 | 5 | 0 | I have a python application that uses twisted framework.
I make use of value stored in the pidfile generated by twistd. A launcher script checks for it's presence and will not spawn a daemon process if the pidfile already exists.
However, twistd does not remove the .pidfile when it gets SIGKILL signal. That makes the l... | python-twisted and SIGKILL | 0.379949 | 0 | 0 | 574 |
13,306,359 | 2012-11-09T10:32:00.000 | 0 | 0 | 0 | 1 | python,linux,twisted,sigkill | 13,310,880 | 2 | false | 0 | 0 | You could change your launcher (or wrap it up in another launcher) and remove the pid file before trying to restart twistd. | 2 | 5 | 0 | I have a python application that uses twisted framework.
I make use of value stored in the pidfile generated by twistd. A launcher script checks for it's presence and will not spawn a daemon process if the pidfile already exists.
However, twistd does not remove the .pidfile when it gets SIGKILL signal. That makes the l... | python-twisted and SIGKILL | 0 | 0 | 0 | 574 |
13,311,732 | 2012-11-09T16:12:00.000 | 1 | 1 | 0 | 0 | python,c,performance | 13,311,964 | 1 | false | 0 | 0 | You'll want the python calls to your C function to be as little as possible. If you can call the C function once from python and get it to do most/all of the work, that would be better. | 1 | 0 | 0 | I wrote a python script to do some experiment with the Mandelbrot set. I used a simple function to find Mandelbrot set points. I was wondering how much efficiency I can achieve by calling a simple C function to do this part of my code? Please consider that this function should call many times from Python.
What is the e... | Efficiency of calling C function from Python | 0.197375 | 0 | 0 | 117 |
13,312,043 | 2012-11-09T16:29:00.000 | 46 | 0 | 1 | 0 | python,dictionary | 17,347,421 | 7 | false | 0 | 0 | any(d)
This will return true if the dict. d contains at least one truelike key, false otherwise.
Example:
any({0:'test'}) == False
another (more general) way is to check the number of items:
len(d) | 2 | 41 | 0 | How to check if dictionary is empty or not? more specifically, my program starts with some key in dictionary and I have a loop which iterates till there are key in dictionary. Overall algo is like this:
Start with some key in dict
while there is key in dict
do some operation on first key in dict
remove fi... | Python:Efficient way to check if dictionary is empty or not | 1 | 0 | 0 | 145,967 |
13,312,043 | 2012-11-09T16:29:00.000 | 8 | 0 | 1 | 0 | python,dictionary | 13,315,913 | 7 | false | 0 | 0 | I would say that way is more pythonic and fits on line:
If you need to check value only with the use of your function:
if filter( your_function, dictionary.values() ): ...
When you need to know if your dict contains any keys:
if dictionary: ...
Anyway, using loops here is not Python-way. | 2 | 41 | 0 | How to check if dictionary is empty or not? more specifically, my program starts with some key in dictionary and I have a loop which iterates till there are key in dictionary. Overall algo is like this:
Start with some key in dict
while there is key in dict
do some operation on first key in dict
remove fi... | Python:Efficient way to check if dictionary is empty or not | 1 | 0 | 0 | 145,967 |
13,312,588 | 2012-11-09T17:01:00.000 | 2 | 0 | 1 | 1 | python,eclipse,pydev | 13,312,787 | 1 | false | 0 | 0 | Python does not allow dashes in identifiers. Module names need to be valid identifiers, so any module file or package directory name with a dash in it is not importable.
On the other hand, script files (python files executed directly by Python, not imported) have no such restrictions. I'd say what you encountered is a ... | 1 | 3 | 0 | I had this problem for a while, and finally understanding what caused it was a good relief.
So basically, python files with a dash ('-') in their name are not fully analyzed by PyDev. I only get the errors but not the warnings... (ie: unused variables, unused imports etc...)
Is this a feature? a known bug? Is there an... | code analysis incomplete for filename with a dash | 0.379949 | 0 | 0 | 566 |
13,313,118 | 2012-11-09T17:37:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine,full-text-search,gae-search | 13,315,587 | 1 | false | 1 | 0 | This depends on whether or not you have any globally consistent indexes. If you do, then you should migrate all of your data from those indexes to new, per-document-consistent (which is the default) indexes. To do this:
Loop through the documents you have stored in the global index and reindexing them in the new index... | 1 | 0 | 0 | I've been using the appengine python experimental searchAPI. It works great. With release 1.7.3 I updated all of the deprecated methods. However, I am now getting this warning:
DeprecationWarning: consistency is deprecated. GLOBALLY_CONSIST
However, I'm not sure how to address it in my code. Can anyone point me in the ... | Appengine Search API - Globally Consistent | 0 | 0 | 0 | 174 |
13,313,609 | 2012-11-09T18:09:00.000 | 0 | 0 | 0 | 0 | python,django | 13,314,802 | 2 | false | 1 | 0 | This looks like it's caused by files being collected by collectstatic having outrageously inaccurate last modified timestamps (like before 1970). Try searching google for tools that allow you to modify your files' last modified dates and change them to something reasonable. | 2 | 0 | 0 | Error:
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "D:\CODE\wamp\www\AMBIENTES\env\Lib\site-packages\django\core\management\__init_... | Django collectstatic error | 0 | 0 | 0 | 1,413 |
13,313,609 | 2012-11-09T18:09:00.000 | 0 | 0 | 0 | 0 | python,django | 14,785,611 | 2 | false | 1 | 0 | I discoreved.
This is just cause I put some fonts in /static/fonts/ and the django don't accept fonts on Static Folder. So, i changed this files to /media/fonts/.
Worked! :D | 2 | 0 | 0 | Error:
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "D:\CODE\wamp\www\AMBIENTES\env\Lib\site-packages\django\core\management\__init_... | Django collectstatic error | 0 | 0 | 0 | 1,413 |
13,313,730 | 2012-11-09T18:18:00.000 | 2 | 0 | 0 | 0 | python,quickfix | 13,313,820 | 2 | true | 0 | 0 | QuickFix will connect and send a Logon automatically when you invoke start from your initiator. As for not being able to get through to your broker, ask them to confirm that they can see your Logon request. Also, make sure they don't require extra fields, like a password or a SubID. | 1 | 3 | 0 | When want to send a Quickfix message (Logon, for example) do I need to go and fill in every field manually, or will data from the Settings file get automatically added as necessary.
Currently, I can connect but not log into my broker's FIX server and I'm having trouble getting any idea of what I'm doing wrong. | Does Quickfix automatically fill in header, body and trailer fields? | 1.2 | 0 | 0 | 1,837 |
13,317,087 | 2012-11-09T22:41:00.000 | 0 | 0 | 1 | 0 | python,python-3.x | 13,317,159 | 2 | false | 0 | 0 | You need some logic that states in words: "if not yet seen, add to list, otherwise increment". Or just be pythonic and follow @Tim's suggestion | 1 | 0 | 0 | Let's say each letter in one of the list is called 'letter'. The problem I am having is when the string == letter for the first time in a particular list, I have to append a value to the new list. After that, if the string == letter again in that particular list, I only need to update the value. So yeah, it would be ... | list string comparison | 0 | 0 | 0 | 99 |
13,317,536 | 2012-11-09T23:31:00.000 | 4 | 0 | 0 | 0 | python,flask | 57,108,419 | 11 | false | 1 | 0 | You can view all the Routes via flask shell by running the following commands after exporting or setting FLASK_APP environment variable.
flask shell
app.url_map | 1 | 179 | 0 | I have a complex Flask-based web app. There are lots of separate files with view functions. Their URLs are defined with the @app.route('/...') decorator. Is there a way to get a list of all the routes that have been declared throughout my app? Perhaps there is some method I can call on the app object? | Get list of all routes defined in the Flask app | 0.072599 | 0 | 0 | 103,592 |
13,318,291 | 2012-11-10T01:19:00.000 | 0 | 0 | 0 | 0 | python,scrapyd | 13,344,717 | 2 | true | 1 | 0 | I found the answer by adding mylibs to site-packages of python by using setup.py inside mylib folder. That way I could import everything inside mylib in my projects. Actually mylibs were way outside from the location where setup.py of my deploy-able project is present. setup.py looks for packages on same level and insi... | 1 | 3 | 0 | Scrapyd is service where we can eggify deploy our projects. However I am facing a problem. I have a Project named MyScrapers whose spider classes uses an import statement as follows:
from mylibs.common.my_base_spider import MyBaseSpider
The path to my_base_spider is /home/myprojectset/mylibs/common/my_base_spider
While... | Scrapyd: How to specify libs and common folders that deployed projects can use? | 1.2 | 0 | 0 | 973 |
13,318,611 | 2012-11-10T02:17:00.000 | 2 | 0 | 1 | 0 | sorting,python-2.7,absolute-value | 29,600,848 | 2 | false | 0 | 0 | I had the same problem. The answer: Python will sort numbers by the absolute value if you have them as strings. So as your key, make sure to include an int() or float() argument. My working syntax was
data = sorted(data, key = lambda x: float(x[0]))
...the lambda x part just gives a function which outputs the thing you... | 2 | 2 | 1 | I'm trying to sort a list of unknown values, either ints or floats or both, in ascending order. i.e, [2,-1,1.0] would become [-1,1.0,2]. Unfortunately, the sorted() function doesn't seem to work as it seems to sort in descending order by absolute value. Any ideas? | Sort a list of ints and floats with negative and positive values? | 0.197375 | 0 | 0 | 5,933 |
13,318,611 | 2012-11-10T02:17:00.000 | 0 | 0 | 1 | 0 | sorting,python-2.7,absolute-value | 65,985,248 | 2 | false | 0 | 0 | In addition to doublefelix,below code gives the absolute order to me from string.
siparis=sorted(siparis, key=lambda sublist:abs(float(sublist[1]))) | 2 | 2 | 1 | I'm trying to sort a list of unknown values, either ints or floats or both, in ascending order. i.e, [2,-1,1.0] would become [-1,1.0,2]. Unfortunately, the sorted() function doesn't seem to work as it seems to sort in descending order by absolute value. Any ideas? | Sort a list of ints and floats with negative and positive values? | 0 | 0 | 0 | 5,933 |
13,321,042 | 2012-11-10T10:01:00.000 | 0 | 0 | 0 | 0 | python,numpy | 13,345,287 | 1 | false | 0 | 0 | If I understand correctly, every pixel in the gray image is mapped to a single pixel in N other images. In that case, the map array is numpy.zeros((i.shape[0], i.shape[1], N, 2), dtype=numpy.int32) since you need to store 1 x and 1 y coordinate into each other N arrays, not the full Nth array every time. Using integer... | 1 | 1 | 1 | I have a gray image in which I want to map every pixel to N other matrices of size LxM.How do I initialize such a matrix?I tried
result=numpy.zeros(shape=(i_size[0],i_size[1],N,L,M)) for which I get the Value Error 'array is too big'.Can anyone suggest an alternate method? | Creating a 5D array in Python | 0 | 0 | 0 | 3,179 |
13,331,665 | 2012-11-11T13:44:00.000 | 0 | 0 | 1 | 0 | python,language-agnostic | 13,441,013 | 2 | false | 0 | 0 | I would suggest to merge the 3 lists of data into one dictionary, which maps names to country names, e.g., it maps "England" -> "England", "English" -> "England", "London" -> "England". It can be easily stored in a database or a file and retrieved.
Then I would search for the keys in the dictionary, and label the item... | 2 | 0 | 0 | I am playing around with parsing RSS feeds looking for references to countries. At the moment I am using Python, but I think this question is fairly language agnostic (in theory).
Let's say I have three lists (all related)
Countries - Nouns (i.e. England, Norway, France )
Countries - Adjectives (i.e. English, Norwegia... | Data storage for query | 0 | 0 | 1 | 55 |
13,331,665 | 2012-11-11T13:44:00.000 | 0 | 0 | 1 | 0 | python,language-agnostic | 13,331,819 | 2 | true | 0 | 0 | It is a very debatable question. There can be multiple solutions for this. If I were you, I would simply a small DB in Mongodb with three tables like these
Country:
Columns: id, name
Country-adj:
Columns: id, name, country_id
Cities:
Columns: id, name, country_id
then simple queries would give your ... | 2 | 0 | 0 | I am playing around with parsing RSS feeds looking for references to countries. At the moment I am using Python, but I think this question is fairly language agnostic (in theory).
Let's say I have three lists (all related)
Countries - Nouns (i.e. England, Norway, France )
Countries - Adjectives (i.e. English, Norwegia... | Data storage for query | 1.2 | 0 | 1 | 55 |
13,332,268 | 2012-11-11T14:55:00.000 | 4 | 0 | 0 | 1 | python,linux,subprocess,pipe | 13,359,172 | 9 | false | 0 | 0 | Also, try to use 'pgrep' command instead of 'ps -A | grep 'process_name' | 1 | 326 | 0 | I want to use subprocess.check_output() with ps -A | grep 'process_name'.
I tried various solutions but so far nothing worked. Can someone guide me how to do it? | How to use `subprocess` command with pipes | 0.088656 | 0 | 0 | 305,963 |
13,334,722 | 2012-11-11T19:43:00.000 | 2 | 0 | 1 | 0 | python,list,methods | 13,334,734 | 6 | false | 0 | 0 | sum(map(sum, my_list))
This runs sum on every element of the first list, then puts the results from those into sum again. | 1 | 2 | 0 | I'm looking for method in python to sum a list of list that contain only integers.
I saw that the method sum() works only for list but not for list of list.
There is anything fit for me?
thank you | sum for list of lists | 0.066568 | 0 | 0 | 9,434 |
13,336,852 | 2012-11-12T00:04:00.000 | 3 | 0 | 1 | 1 | python,macos | 53,291,437 | 3 | false | 0 | 0 | If you have python 2 and 3 on brew. Following worked for me.
brew unlink python@2
brew link python@3 (if not yet linked) | 2 | 8 | 0 | Currently running Mac OS X Lion 10.7.5 , and it has python2.7 as default. In the terminal, i type 'python' and it automatically pulls up python2.7. I don't want that.
from terminal I have to instead type 'python3.2' if i want to use python3.2.
How do i change that? | Setting python3.2 as default instead of python2.7 on Mac OSX Lion 10.7.5 | 0.197375 | 0 | 0 | 16,097 |
13,336,852 | 2012-11-12T00:04:00.000 | 4 | 0 | 1 | 1 | python,macos | 13,336,983 | 3 | false | 0 | 0 | You could edit the default python path and point it to python3.2
Open up ~/.bash_profile in an editor and edit it so it looks like
PATH="/Library/Frameworks/Python.framework/Versions/3.2/bin:${PATH}"
export PATH | 2 | 8 | 0 | Currently running Mac OS X Lion 10.7.5 , and it has python2.7 as default. In the terminal, i type 'python' and it automatically pulls up python2.7. I don't want that.
from terminal I have to instead type 'python3.2' if i want to use python3.2.
How do i change that? | Setting python3.2 as default instead of python2.7 on Mac OSX Lion 10.7.5 | 0.26052 | 0 | 0 | 16,097 |
13,337,870 | 2012-11-12T03:06:00.000 | 4 | 0 | 0 | 1 | python,fabric,backslash | 13,338,597 | 2 | false | 0 | 0 | OK, finally worked this out. RocketDonkey was correct. Needed to prefix with "r" but also needed to set "shell=False". This allowed what ever worked directly in the bash terminal to work when being called from fabric.api.
Thanks RocketDonkey!! | 1 | 7 | 0 | I'm new to python and fabric api. I'm trying to use the sudo functionality to run a sed command in bash terminal which insert some text after a particular line of text is found. Some of the text I'm trying to insert into the file I'm modifying contains backslashes which seem to either be ignored by fabric or cause synt... | Python fabric.api backslash hell | 0.379949 | 0 | 0 | 676 |
13,337,924 | 2012-11-12T03:15:00.000 | 3 | 0 | 0 | 0 | python,web,flask | 13,338,019 | 3 | false | 1 | 0 | Short answer: you can't.
Longer answer: once you have "sent the page" (that is, you have completed a HTTP response) there is no way for you to change what was sent. You can, however, use JavaScript to make additional HTTP requests to the server, and use the HTTP responses to modify the DOM which will change the page th... | 1 | 1 | 0 | I have a question about using Flask with Python.
Lets say I want to make a website for some mod I'm making for a game, and I want to put in a live chat feed, how would I go around modifying the contents of the page after the page has been sent to the person? | Python Flask Modifying Page after loaded | 0.197375 | 0 | 0 | 1,583 |
13,340,080 | 2012-11-12T07:59:00.000 | 1 | 1 | 0 | 0 | python | 13,340,136 | 4 | false | 0 | 0 | I would highly recommend using a 3rd party HTTP server to serve static files.
Servers like nginx are heavily optimized for the task at hand, parallelized and written in fast languages.
Python is tied to one processor and interpreted. | 2 | 4 | 0 | What's the fastest way to serve static files in Python? I'm looking for something equal or close enough to Nginx's static file serving.
I know of SimpleHTTPServer but not sure if it can handle serving multiple files efficiently and reliably.
Also, I don't mind it being a part of a lib/framework of some sort as long as ... | Python fast static file serving | 0.049958 | 0 | 0 | 3,272 |
13,340,080 | 2012-11-12T07:59:00.000 | 1 | 1 | 0 | 0 | python | 13,340,760 | 4 | false | 0 | 0 | If you look for a oneliner you can do the following:
$> python -m SimpleHTTPServer
This will not fullfil all the task required but worth mentioning that this is the simplest way :-) | 2 | 4 | 0 | What's the fastest way to serve static files in Python? I'm looking for something equal or close enough to Nginx's static file serving.
I know of SimpleHTTPServer but not sure if it can handle serving multiple files efficiently and reliably.
Also, I don't mind it being a part of a lib/framework of some sort as long as ... | Python fast static file serving | 0.049958 | 0 | 0 | 3,272 |
13,341,780 | 2012-11-12T10:12:00.000 | 1 | 0 | 1 | 0 | python,multiprocessing | 13,729,930 | 1 | false | 0 | 0 | I ended up creating a Pipe for every Process. Then when the main Process shuts down it can send a message to all the children Processes that they should shut down too.
In order to make that work right you've got to put a periodic check into the children Processes' "do loop" to see if there are messages in the pipe, an... | 1 | 4 | 0 | I noticed that os._exit(<num>) ::
Exit the process with status n, without calling cleanup handlers,
flushing stdio buffers, etc.
and that sys.exit() ::
“only” raises an exception, it will only exit the process when called
from the main thread
I need a solution to close a multi-processed application that will en... | Exiting a multiprocessed python application safely | 0.197375 | 0 | 0 | 1,183 |
13,345,239 | 2012-11-12T14:11:00.000 | 1 | 1 | 0 | 1 | python,usb,debian | 13,345,336 | 2 | true | 0 | 0 | cat /etc/mtab | awk '{ print $2 }'
Will give you a list of mountpoints. You can as well read /etc/mtab yourself and just check if anything's mounted under /media/usb0 (file format: whitespace-divided, most likely single space). The second column is mount destination, the first is the source. | 1 | 1 | 0 | I'm using debian with usbmount. I want to check if a USB memory stick is available to write to.
Currently I check if a specific dir exists on the USB drive. If this is True I can then write the rest of my files - os.path.isdir('/media/usb0/Test_Folder')
I would like to create Test_Folder if it doesn't exist. However ... | Python usbmount checking for device before writing | 1.2 | 0 | 0 | 905 |
13,346,470 | 2012-11-12T15:25:00.000 | 0 | 0 | 0 | 0 | python,django,django-models,django-forms | 13,399,089 | 2 | false | 1 | 0 | I have now a partial solution. I override the Manager and in particular its all() and get() functions (because I only need those functions for now). all() returns a queryset in which I added the result of some logics that give me objects build from external datas (taken through xmlrpc in my case). I added those objects... | 1 | 3 | 0 | Does anyone can tell me if it's possible to create a Model class, with some model fields and some other fields taking their data from external data sources. The point is that I would like this model to be exploited the same way as another model by ModelForm for instance. I mean if I redefine "objects" Manager of the mo... | How to define a Model with fields filled by other data sources than database in django? | 0 | 0 | 0 | 1,001 |
13,346,698 | 2012-11-12T15:38:00.000 | 1 | 0 | 0 | 1 | python,openerp | 13,358,175 | 2 | false | 1 | 0 | Good question..
Openerp on windows uses a dll for python (python26.dll in /Server/server of the openerp folder in program files). It looks like all the extra libraries are in the same folder, so you should be able to download the extra libraries to that folder and restart the service. (I usually stop the service and ru... | 1 | 6 | 0 | I installed OpenERP 6.1 on windows using the AllInOne package. I did NOT install Python separately. Apparently OpenERP folders already contain the required python executables.
Now when I try to install certain addons, I usually come across requirements to install certain python modules. E.g. to install Jasper_Server, I... | Installing Python modules for OpenERP 6.1 in Windows | 0.099668 | 0 | 0 | 3,249 |
13,347,378 | 2012-11-12T16:22:00.000 | 1 | 0 | 0 | 0 | wpf,xaml,ironpython,sharpdevelop | 13,352,605 | 1 | true | 1 | 1 | You could put in some code to catch the error and log it to a file.
Something possibly simpler is to compile your application as a Console Application. This can be done via Project Options - Application - Output type. Then you will get a console window when you run your WPF application and any exception that happens at... | 1 | 0 | 0 | I am doing an application with GUI using WPF/XAML with Ironpython and SharpDevelop, until now it works fine, when I'm in the development environment I can see the errors in console and know what is wrong.
But when I build and deploy the app for us on other system or I ran it outside of the development environment and... | Ironpython: How to see when a WPF application fails? | 1.2 | 0 | 0 | 240 |
13,351,608 | 2012-11-12T21:10:00.000 | 1 | 0 | 0 | 0 | python,quickfix | 13,368,991 | 2 | true | 1 | 0 | Solved! I think there was something wrong with my datadictionary (FIX44.xml) file. I had seen a problem in it before, but thought I fixed it. I got a new copy online and dropped it in and now everything seems to be working. Maybe the bad dictionary was not letting FIX accept the logon response? | 2 | 1 | 0 | QuickFIX logon trouble: (using QuickFIX, with FIX 4.4 in Python 2.7)
Once I do initiator.start() a connection is made, and logon message is sent. However, I don't ever see the ACK and session status message that the broker is sending back (all the overloaded Application methods are just supposed to print out what they ... | QuickFIX logon trouble: multiple rapid fire logon attempts being sent | 1.2 | 0 | 0 | 1,050 |
13,351,608 | 2012-11-12T21:10:00.000 | 2 | 0 | 0 | 0 | python,quickfix | 13,368,881 | 2 | false | 1 | 0 | Sounds like you do not have message logs enabled. If your app rejects messages below the application level (such as if the seq no is wrong, or the message is malformed), then it'll be rejected before your custom message handlers even see it.
If you are starting your Initiator with a ScreenLogStore, change it to a File... | 2 | 1 | 0 | QuickFIX logon trouble: (using QuickFIX, with FIX 4.4 in Python 2.7)
Once I do initiator.start() a connection is made, and logon message is sent. However, I don't ever see the ACK and session status message that the broker is sending back (all the overloaded Application methods are just supposed to print out what they ... | QuickFIX logon trouble: multiple rapid fire logon attempts being sent | 0.197375 | 0 | 0 | 1,050 |
13,351,694 | 2012-11-12T21:16:00.000 | 0 | 0 | 0 | 0 | python,django,django-views | 13,397,523 | 2 | false | 1 | 0 | It is an interesting problem. Ideally you should pull all the components from database before rendering. But looking at hierarchy, making template tags makes sense. These template tag will pull appropriate data. Assume for the purpose of this problem that database query gets cached due to search locality. | 1 | 8 | 0 | I'm working on a big social networking app in Django where I expect to use certain front-end components many times, and often with functionality designed in such a way that custom components contain other custom components, which might contain yet smaller subcomponents (ad infinitum). All of these components are typic... | Django: Implementing a nested, reusable component design | 0 | 0 | 0 | 1,068 |
13,352,796 | 2012-11-12T22:42:00.000 | 0 | 0 | 0 | 0 | python,mongodb,twitter,tweepy | 22,388,827 | 1 | false | 0 | 0 | Unfortunately, the Twitter API doesn't provide a way to do this. You can try searching through receive tweets for the keywords you specified, but it might not match exactly. | 1 | 1 | 0 | I'm filtering the twitter streaming API by tracking for several keywords.
If for example I only want to query and return from my database tweet information that was filtered by tracking for the keyword = 'BBC' how could this be done?
Do the tweet information collected have a key:value relating to that keyword by which... | Querying twitter streaming api keywords from a database | 0 | 1 | 0 | 374 |
13,353,113 | 2012-11-12T23:08:00.000 | 1 | 0 | 0 | 1 | python,django,ftp,virtualenv,virtualbox | 13,353,762 | 1 | true | 1 | 0 | The reason that the the client reported back "Connection refused by server" is that the server returned a TCP packet with the reset bit set, in response to an application trying to connect to a port that is not being listened on by an application, or by a firewall.
I think that the FTP service is not running, or runn... | 1 | 0 | 0 | I've recently started learning Django and have set up a virtual machine running a Django server on VirtualEnv. I can use the runserver command to run the basic Django installation server and view it on another computer with the local IP address.
However, I can't figure out how to connect to my virtual machine with my F... | How to FTP into a virtual machine? | 1.2 | 0 | 0 | 5,276 |
13,353,978 | 2012-11-13T00:37:00.000 | 1 | 0 | 1 | 1 | python,debian,fedora | 13,425,528 | 2 | false | 0 | 0 | Create an rpm package, give it to your Debian users and tell them to convert the rpm to a Debian package using alien on their Debian box. | 1 | 1 | 0 | I have created a small python application to be used internally in my organization. I wrote the code on my primary development machine running Fedora 17 and I would like to create a .deb in order to make it easy for my colleagues to install my program.
Is it possible to create debian packages for python application fro... | Creating a debian package for my python application from a system running fedora | 0.099668 | 0 | 0 | 110 |
13,354,317 | 2012-11-13T01:22:00.000 | 2 | 0 | 0 | 0 | macos,installation,wxpython | 13,357,833 | 2 | true | 0 | 1 | At least for development, I would suggest to install (python and) wx using homebrew. It will install version 2.9 and you're ensured that Apple-provided system libraries remain untouched. | 1 | 0 | 0 | I am new to Mac, have always used windows and I am confused on how to install wxPython. I downloaded the .dmg file from the website, and it contained three files:
a pkg file, a readme, and an uninstall.py
I opened the pkg file, went through the steps, and Im not sure where it installed after it said "Installation Compl... | Install wxpython on mac | 1.2 | 0 | 0 | 363 |
13,355,358 | 2012-11-13T03:53:00.000 | 5 | 1 | 0 | 0 | python,publishing,bioinformatics,biopython | 13,355,383 | 4 | false | 0 | 0 | While there are many approaches to this, one of the customary solutions would be to indeed publish it on github and then link to it from your research institution's website. | 1 | 4 | 0 | I've written an analytical pipeline in Python that I think will be useful to other people. I'm wondering whether it is customary to publish such scripts in GitHub, whether there's a specific place to do this for Python scripts, or even if there's a more specific place for biology-related Python scripts. | Where to deposit a Python script that performs bioinformatics analyses? | 0.244919 | 0 | 0 | 521 |
13,355,370 | 2012-11-13T03:55:00.000 | 8 | 0 | 1 | 1 | python-2.7 | 16,665,606 | 1 | false | 0 | 0 | python.org
The installer from python.org installs to /Library/Frameworks/Python.framework/, and only that python executable looks in the contained site-package dir for packages.
/Library/Python
In contrast, the dir /Library/Python/2.7/site-packages/ is a global place where you can put python packages, all python 2.7 in... | 1 | 4 | 0 | I am working on a mac, a quick question, could someone told me the difference of these two directories?
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/
/Library/Python/2.7/site-packages/ | what is the difference between "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/" and "/Library/Python/2.7/" | 1 | 0 | 0 | 2,452 |
13,356,024 | 2012-11-13T05:33:00.000 | 0 | 1 | 0 | 1 | php,python,caching,egg | 13,356,068 | 1 | false | 0 | 0 | Make sure whatever user php is running under has appropriate permissions. You can try opening a pipe and changing users, or just use apache's suexec. | 1 | 0 | 0 | I have a python script that runs as a daemon process. I want to be able to stop and start the process via a web page. I made a PHP script that runs exec() on the python daemon. Any idea?
Traceback (most recent call last): File
"/home/app/public_html/daemon/daemon.py", line 6, in from
socketServer import Ex... | Running Python from PHP | 0 | 0 | 0 | 189 |
13,356,348 | 2012-11-13T06:20:00.000 | 2 | 0 | 0 | 0 | python,nltk,smoothing | 13,397,869 | 1 | false | 0 | 0 | I'd suggest to replace all the words with low (specially 1) frequency to <unseen>, then train the classifier in this data.
For classifying you should query the model for <unseen> in the case of a word that is not in the training data. | 1 | 4 | 1 | I am using Naive Bayes classifier in python for text classification. Is there any smoothing methods to avoid zero probability for unseen words in python NLTK? Thanks in advance! | Smoothing in python NLTK | 0.379949 | 0 | 0 | 1,430 |
13,357,227 | 2012-11-13T07:58:00.000 | 0 | 1 | 0 | 0 | java,python,robotframework | 13,602,048 | 2 | false | 1 | 0 | Try to put your Library into this folder:
...YourPythonFolder\Lib\site-packages\
or, if this doesn't work, make in the folder "site-packages" folder with the name "MyLibrary" and put your library there.
This should work. | 1 | 2 | 0 | i am facing difficulty when trying to run my tests. Here is what i did :
Create a java project with one class which has one method called hello(String name)
Exported this as a jar and kept it in the same directory where i keep my test case file.
my Test case looks like this.
Setting * * Value * * Value * * Value... | Robot Framework - using User Libraries | 0 | 0 | 0 | 2,367 |
13,358,729 | 2012-11-13T10:03:00.000 | 3 | 0 | 0 | 0 | python,html,output,tabular | 13,358,764 | 2 | false | 1 | 0 | Why not do both ? Make your data available as CSV (for simple export to scripts etc.) and provide a decorated HTML version.
At some stage you may want (say) a proper Excel sheet, a PDF etc. So I would enforce a separation of the data generation from the rendering. Make your generator return a structure that can be cons... | 2 | 0 | 0 | I am using Python3 to calculate some statistics from language corpora. Until now I was exporting the results in a csv-file or directly on the shell. A few days ago I started learning how to output the data to html-tables. I must say I really like it, it deals perfect height/width of cell and unicodes and you can apply ... | Pros and Cons of html-output for statistical data | 0.291313 | 0 | 0 | 196 |
13,358,729 | 2012-11-13T10:03:00.000 | 1 | 0 | 0 | 0 | python,html,output,tabular | 13,359,571 | 2 | true | 1 | 0 | The question lists some benefits of HTML format. These alone are sufficient for using it as one of output formats. Used that way, it does not really matter much what you cannot easily do with the HTML format, as you can use other formats as needed.
Benefits include reasonable default rendering, which can be fine-tuned ... | 2 | 0 | 0 | I am using Python3 to calculate some statistics from language corpora. Until now I was exporting the results in a csv-file or directly on the shell. A few days ago I started learning how to output the data to html-tables. I must say I really like it, it deals perfect height/width of cell and unicodes and you can apply ... | Pros and Cons of html-output for statistical data | 1.2 | 0 | 0 | 196 |
13,358,955 | 2012-11-13T10:20:00.000 | 4 | 0 | 1 | 0 | python,memory-management,set,itertools | 13,358,975 | 1 | true | 0 | 0 | Sets are just like dict and list; on creation they copy the references from the seeding iterable.
Iterators cannot be sets, because you cannot enforce the uniqueness requirement of a set. You cannot know if a future value yielded by an iterator has already been seen before.
Moreover, in order for you to determine what ... | 1 | 2 | 0 | so I discovered Sets in Python a few days ago and am surprised that they never crossed my mind before even though they make a lot of things really simple. I give an example later.
Some things are still unclear to me. The docs say that Sets can be created from iterables and that the operators always return new Sets but ... | Python: Combining itertools and sets to save memory | 1.2 | 1 | 0 | 707 |
13,360,145 | 2012-11-13T11:42:00.000 | 1 | 0 | 0 | 1 | python,django,asynchronous,celery,gevent | 13,429,864 | 2 | false | 1 | 0 | Have you tried to use Celery + eventlet? It works well in our project | 1 | 4 | 0 | We're using Celery for background tasks in our Django project.
Unfortunately, we have many blocking sockets in tasks, that can be established for a long time. So Celery becomes fully loaded and does not respond.
Gevent can help me with sockets, but Celery has only experimental support of gevent (and as I found in prac... | Asynchronous replacement for Celery | 0.099668 | 0 | 0 | 1,476 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.