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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
22,020,129 | 2014-02-25T16:24:00.000 | 4 | 0 | 1 | 1 | ipython-notebook | 22,020,213 | 2 | true | 0 | 0 | One minute later and it occurs to me that the front page might not support even though the server does. Sure enough, http://localhost:5000/localfile/PythonReference.ipynb?create=1 renders the local notebook. | 1 | 5 | 0 | I've got nbviewer installed and working. I see it has a --localfiles option that takes a folder name. It says: "Serving local notebooks in /home/gb/S14/inclass, this can be a security risk"
But I can't figure out the URL format to get it to look for the file there. The code adds a handler for /localfile/(.*) but that d... | How to make nbviewer display local files? | 1.2 | 0 | 0 | 4,226 |
22,022,938 | 2014-02-25T18:25:00.000 | 0 | 0 | 0 | 0 | python,selenium | 22,023,178 | 1 | false | 0 | 0 | If it's an OS dialog, no, you can't manipulate it with Selenium, you'd need a library that provides you hooks directly in to the OS. To capture the request, you would either need to use a proxy to capture the traffic and again another interface to interact with the proxy to inspect the request, or you might be able to... | 1 | 0 | 0 | When you click on some of the links on this particular page the GET request gets initiated by javascript. In this case it's a file so when you click it webdriver.Firefox makes a dialog window appear that asks you whether you want to download the file or not.
Is it possible to capture the GET request directly and save ... | How to capture GET requests in Selenium initiated via JavaScript? | 0 | 0 | 1 | 583 |
22,024,577 | 2014-02-25T19:45:00.000 | 0 | 0 | 1 | 0 | python,numpy | 22,024,672 | 1 | false | 0 | 0 | The exit code of the python process should reveal the reason for the process exiting. In the event of an adverse condition, the exit code will be something other than 0. If you are running in a Bash shell or similar, you can run "echo $?" in your shell after running Python to see its exit status.
If the exit status is ... | 1 | 1 | 1 | So I am trying to run various large images which gets put into an array using numpy so that I can then do some calculations. The calculations get done per image and the opening and closing of each image is done in a loop. I a have reached a frustration point because I have no errors in the code (well none to my knowled... | Large dataset - no error - but it wont run - python memory issue? | 0 | 0 | 0 | 107 |
22,026,393 | 2014-02-25T21:17:00.000 | 5 | 0 | 1 | 0 | python,python-2.7,file-io,dataframe,string-concatenation | 22,026,711 | 3 | false | 0 | 0 | Unless you are running into a performance issue, you can probably write to the file line by line. Python internally uses buffering and will likely give you a nice compromise between performance and memory efficiency.
Python buffering is different from OS buffering and you can specify how you want things buffered by se... | 1 | 5 | 1 | I have a speed/efficiency related question about python:
I need to write a large number of very large R dataframe-ish files, about 0.5-2 GB sizes. This is basically a large tab-separated table, where each line can contain floats, integers and strings.
Normally, I would just put all my data in numpy dataframe and use np... | Python: Fast and efficient way of writing large text file | 0.321513 | 0 | 0 | 15,877 |
22,029,142 | 2014-02-26T00:21:00.000 | 2 | 0 | 0 | 0 | python,scipy | 22,044,916 | 1 | true | 0 | 0 | Try scipy.odr. It allows to specify weights/errors in both input and response variable. | 1 | 0 | 1 | So I already know how to use scipy.optimize.curve_fit for normal fitting needs, but what do I do if both my x data and my y data both have error bars? | Scipy: Fitting Data with Two Dimensional Error | 1.2 | 0 | 0 | 104 |
22,030,342 | 2014-02-26T02:14:00.000 | -1 | 1 | 1 | 0 | python,c++,python-2.x,integer-division | 22,030,432 | 4 | false | 0 | 0 | I am not sure about Python, but in C++ integer/integer = integer, and therefore in case of -1/2 is -0.5 which is rounded automatically to integer and therefore you get the 0 answer.
In case of Python, maybe the system used the floor function to convert the result into an integer. | 2 | 4 | 0 | C++: cout << -1/2 evaluates to 0
Python: -1/2 evaluates to -1.
Why is this the case? | Why is -1/2 evaluated to 0 in C++, but -1 in Python? | -0.049958 | 0 | 0 | 1,668 |
22,030,342 | 2014-02-26T02:14:00.000 | 1 | 1 | 1 | 0 | python,c++,python-2.x,integer-division | 22,030,413 | 4 | false | 0 | 0 | From the Python docs (emphasis mine):
The / (division) and // (floor division) operators yield the quotient of their arguments. The numeric arguments are first converted to a common type. Plain or long integer division yields an integer of the same type; the result is that of mathematical division with the ‘floor’ fun... | 2 | 4 | 0 | C++: cout << -1/2 evaluates to 0
Python: -1/2 evaluates to -1.
Why is this the case? | Why is -1/2 evaluated to 0 in C++, but -1 in Python? | 0.049958 | 0 | 0 | 1,668 |
22,030,696 | 2014-02-26T02:47:00.000 | 0 | 0 | 0 | 0 | python,django,content-management-system,django-cms | 22,035,806 | 2 | false | 1 | 0 | django CMS is a CMS on top of django. It supports multiple languages really well and plays nice together with your own django apps. The basic idea is that you define placeholders in your template and then are able to fill those placeholders with content plugins. A content plugin can be a anything from text, picture, tw... | 1 | 1 | 0 | I am new to Django, but heard it was promising when attempting to create a a custom CMS.
I am looking to get started, but their seems to be a lack of documentation, tutorials, etc on how to actually get something like this going.
I am curious if their are any books/tutorials/guides that can help me get started with CM... | Best way to build a custom Django CMS | 0 | 0 | 0 | 2,589 |
22,033,465 | 2014-02-26T06:24:00.000 | 1 | 0 | 1 | 0 | python,python-2.7,py2exe,sympy | 28,066,995 | 1 | true | 0 | 0 | use python 3 and import sys,
see if that helps
py2exe has a problem with sympy,there is and issue in github you can follow | 1 | 2 | 0 | I'm trying to make executable file of my python program with py2exe.
I was succeed to make hello_word.exe but when I want to make exe of my own program it said RuntimeError: maximum recursion depth exceeded
After trying many times I recognized that it happens when I import sympy module.
Should I change setup.py when I ... | py2exe - Maximum recursion depth error | 1.2 | 0 | 0 | 1,701 |
22,037,983 | 2014-02-26T10:06:00.000 | 5 | 1 | 0 | 0 | php,python,wordpress | 22,038,195 | 1 | true | 0 | 0 | Your question doesn't really have a clear answer, because you're not comparing apples to apples here.
Wordpress is a Content Management System (CMS), a piece of software built using the php language.
Python is simply a language.
Vulnerabilities have certainly been found in Wordpress before, it's true. Similarly, softwa... | 1 | 0 | 0 | I am planning to develop a E-commerce website. i was thinking to use Wordpress CMS so that there will be plugins available for implementing the E-commerce feature. but questions was raised about the security of wordpress. i have got few suggestions from by friends about developing site in python.
Can anyone please help... | Is python secure than wordpress? | 1.2 | 0 | 0 | 186 |
22,040,054 | 2014-02-26T11:32:00.000 | 0 | 1 | 1 | 0 | python,visual-studio-2008,encoding | 22,040,482 | 1 | true | 0 | 0 | In Options - Text Editor - General, there's a setting "Auto-detect UTF-8 encoding without signature". Maybe that's all there is to it. | 1 | 0 | 0 | Somehow VS2008 knows about the character encoding of a source file. I need this information for a tool I wrote in python that does some processing of legacy code (some sophisticated include path remappings etc.), where each file might have a different character encoding. And for processing each file I need to know the ... | Where does Visual Studio 2008 store the information about a file's character encoding? | 1.2 | 0 | 0 | 32 |
22,046,149 | 2014-02-26T15:38:00.000 | 1 | 0 | 0 | 0 | python,django,tastypie | 22,069,707 | 1 | false | 1 | 0 | Although I'm not sure that the approach of using the resource_name with slashes will always work for you, in order to resolve your issue you can simply change the order of the URL registration.
When register the urls, register the resource with the name "library/books" last.
The reason that you have the issue is that "... | 1 | 0 | 0 | Is there a way to create a hierarchy of resources in tastypie using resource_name that will behave like regular django urls? I'm aiming to have tastypie urls that look like this: <app_name>/<module_name>/<functionality>, but I'm having trouble.
I've created resources with the following resource_name:
library/books
l... | Achieving django url-like functionality using resource_name in tastypie | 0.197375 | 0 | 0 | 158 |
22,051,158 | 2014-02-26T19:22:00.000 | 2 | 0 | 1 | 0 | python,pip,easy-install | 51,204,337 | 3 | false | 0 | 0 | To uninstall pip in windows:
Run command prompt as administrator
Give the command easy_install -m pip
This may not uninstall pip completely. So again give this command pip uninstall pip If by previous command pip got uninstalled then this command wont run, else it will completely remove pip
Now check by giving command... | 1 | 7 | 0 | On Windows 7, I install pip with easy_install and want to install a lower version of pip.
I want to remove the old version, but have no idea how to completely remove the pip installed by easy_install (or if there is a way to do it without going through easy_install, that is fine). How do I do this? | How to fully uninstall pip installed with easy_install? | 0.132549 | 0 | 0 | 63,563 |
22,053,050 | 2014-02-26T20:55:00.000 | 2 | 0 | 0 | 0 | python,numpy,matrix,multidimensional-array | 65,142,140 | 8 | false | 0 | 0 | The data structure of shape (n,) is called a rank 1 array. It doesn't behave consistently as a row vector or a column vector which makes some of its operations and effects non intuitive. If you take the transpose of this (n,) data structure, it'll look exactly same and the dot product will give you a number and not a m... | 1 | 394 | 1 | In numpy, some of the operations return in shape (R, 1) but some return (R,). This will make matrix multiplication more tedious since explicit reshape is required. For example, given a matrix M, if we want to do numpy.dot(M[:,0], numpy.ones((1, R))) where R is the number of rows (of course, the same issue also occurs c... | Difference between numpy.array shape (R, 1) and (R,) | 0.049958 | 0 | 0 | 193,239 |
22,053,852 | 2014-02-26T21:34:00.000 | 5 | 0 | 1 | 0 | python,python-3.x,matplotlib | 22,482,905 | 3 | false | 0 | 0 | Assuming you've already installed a 3.x python env in anaconda, this one line should do the trick:
conda install matplotlib -n name
where name is the name you previously gave to your python 3 anaconda env. If you're not sure of the name you gave it, it will be the name of a subdir in the Anaconda\envs directory.
Back... | 1 | 3 | 0 | I am configuring Anaconda 1.9.1 together with Python 3.3.4 and I am unable to setup Matplotlib for anaconda environment when I try to add package using Pycharm. I also tried to install from Matplotlib.exe file which I downloaded from its website. I can not change the installation directory in that case. I would like to... | How to install Matplotlib for anaconda 1.9.1 and Python 3.3.4? | 0.321513 | 0 | 0 | 45,160 |
22,055,320 | 2014-02-26T22:55:00.000 | 0 | 0 | 1 | 0 | python,dictionary | 22,055,376 | 3 | false | 0 | 0 | No, you cannot rely on that behaviour. It is an implementation detail which can change from one version of Python to the next or even from one system to the next.
That being said, it is unlikely to change soon. | 2 | 1 | 0 | We know that regular Python dictionaries are unordered, but what about the case when the keys are the set of natural numbers? The hash function seems to be an identity function when the domain is the set of natural numbers, and iterating over something like x = {0:'a', 1:'b', 2:'c'} seems to yield the natural order of ... | Dictionary order when keys are numbers | 0 | 0 | 0 | 86 |
22,055,320 | 2014-02-26T22:55:00.000 | 0 | 0 | 1 | 0 | python,dictionary | 22,055,690 | 3 | false | 0 | 0 | No. The order also depends on the order the keys are inserted. | 2 | 1 | 0 | We know that regular Python dictionaries are unordered, but what about the case when the keys are the set of natural numbers? The hash function seems to be an identity function when the domain is the set of natural numbers, and iterating over something like x = {0:'a', 1:'b', 2:'c'} seems to yield the natural order of ... | Dictionary order when keys are numbers | 0 | 0 | 0 | 86 |
22,055,432 | 2014-02-26T23:03:00.000 | 2 | 0 | 0 | 0 | python,django,django-templates | 22,055,844 | 1 | false | 1 | 0 | If you are making a web app, I'd say you need templates. Any other solution would be a mess.
However, django templates have been known to not scale well because rendering them is relatively slow compared to other solutions like jinja2. There are several apps that integrate jinja2 into django. There's also been a lot o... | 1 | 0 | 0 | Forgive my knowledge on django, although I was briefly talking with a developer from Google whom I had met and he stated something confusing to me.
He mentioned something that I hadn't really gotten a chance to ask him more about.
He told me to be careful with django templates because in terms of scale, they can cause ... | Using Django without templates? | 0.379949 | 0 | 0 | 1,483 |
22,056,351 | 2014-02-27T00:08:00.000 | 3 | 1 | 1 | 0 | python,metaprogramming,python-import,monkeypatching | 22,056,768 | 2 | false | 0 | 0 | If you really want to change the semantics of the import statement, you will have to patch the interpreter. import checks whether the named module already is loaded and if so it does nothing more. You would have to change exactly that, and that is hard-wired in the interpreter.
Maybe you can live with patching the Py... | 1 | 2 | 0 | Is there a way to force import x to always reload x in Python (i.e., as if I had called reload(x), or imp.reload(x) for Python 3)? Or in general, is there some way to force some code to be run every time I run import x? I'm OK with monkey patching or hackery.
I've tried moving the code into a separate module and delet... | Python: force every import to reload | 0.291313 | 0 | 0 | 603 |
22,057,077 | 2014-02-27T01:15:00.000 | -1 | 0 | 1 | 0 | python,linux,tkinter,tk,python-2.6 | 22,057,396 | 3 | false | 0 | 1 | Have you tried using pip-2.6 install package? | 3 | 1 | 0 | I installed Python 2.6 from source for software testing (2.7 was preinstalled on my Linux distro). However, I cannot import Tkinter within 2.6, I suppose because it doesn't know where to find Tk. How do I either help 2.6 find the existing Tkinter install or reinstall Tkinter for 2.6? | Installed Python from source and cannot import Tkinter - how to install? | -0.066568 | 0 | 0 | 417 |
22,057,077 | 2014-02-27T01:15:00.000 | 1 | 0 | 1 | 0 | python,linux,tkinter,tk,python-2.6 | 22,058,494 | 3 | true | 0 | 1 | I solved this by adding '/usr/lib/x86_64-linux-gnu' to lib_dirs in setup.py, then rebuilding python | 3 | 1 | 0 | I installed Python 2.6 from source for software testing (2.7 was preinstalled on my Linux distro). However, I cannot import Tkinter within 2.6, I suppose because it doesn't know where to find Tk. How do I either help 2.6 find the existing Tkinter install or reinstall Tkinter for 2.6? | Installed Python from source and cannot import Tkinter - how to install? | 1.2 | 0 | 0 | 417 |
22,057,077 | 2014-02-27T01:15:00.000 | 1 | 0 | 1 | 0 | python,linux,tkinter,tk,python-2.6 | 22,057,115 | 3 | false | 0 | 1 | Install the TCL and Tk development files and rebuild Python. | 3 | 1 | 0 | I installed Python 2.6 from source for software testing (2.7 was preinstalled on my Linux distro). However, I cannot import Tkinter within 2.6, I suppose because it doesn't know where to find Tk. How do I either help 2.6 find the existing Tkinter install or reinstall Tkinter for 2.6? | Installed Python from source and cannot import Tkinter - how to install? | 0.066568 | 0 | 0 | 417 |
22,058,478 | 2014-02-27T03:33:00.000 | 1 | 0 | 0 | 0 | python,soap,twisted,data-transfer,asynchronous-messaging-protocol | 22,081,242 | 1 | true | 0 | 0 | I like AMP a lot. twisted.protocols.amp is moderately featureful and relatively easily testable (although documentation on how to test applications written with it is a little lacking).
The command/response abstraction AMP provides is comfortable and familiar (after all, we live in a world where HTTP won). AMP avoids... | 1 | 0 | 0 | I am trying to implement a server using python-twisted with potential C# and ObjC clients. I started with LineReceiver and that works well for basic messaging, but I can't figure out the best approach for something more robust. Any ideas for a simple solution for the following requirements?
Request and response
ex.... | twisted python request/response message and substantial binary data transfer | 1.2 | 0 | 0 | 305 |
22,060,338 | 2014-02-27T06:04:00.000 | 0 | 0 | 0 | 0 | python,macos,oracle | 39,339,545 | 2 | false | 0 | 0 | I haven't seen this on OS X but the general Linux solution is to add your hostname to /etc/hosts for the IP 127.0.0.1. | 2 | 2 | 0 | On OS X 10.9 and 10.9.1, the cx_Oracle works OK. But after I updated my system to OS X 10.9.2 yesterday, it cannot work. When connecting to Oracle database, DatabaseError is raised. And the error message is:
ORA-21561: OID generation failed
Can anyone help me? | cx_Oracle can't connect to Oracle database after updating OS X to 10.9.2 | 0 | 1 | 0 | 1,020 |
22,060,338 | 2014-02-27T06:04:00.000 | 0 | 0 | 0 | 0 | python,macos,oracle | 41,649,509 | 2 | false | 0 | 0 | This can be fixed with a simple edit to your hosts file.
Find the name of your local-machine by running hostname in your local-terminal
$hostname
Edit your local hosts file
$vi /etc/hosts
assuming $hostname gives local_machine_name append it to your localhost ,
127.0.0.1 localhost local_machine_name
press... | 2 | 2 | 0 | On OS X 10.9 and 10.9.1, the cx_Oracle works OK. But after I updated my system to OS X 10.9.2 yesterday, it cannot work. When connecting to Oracle database, DatabaseError is raised. And the error message is:
ORA-21561: OID generation failed
Can anyone help me? | cx_Oracle can't connect to Oracle database after updating OS X to 10.9.2 | 0 | 1 | 0 | 1,020 |
22,062,837 | 2014-02-27T08:23:00.000 | -2 | 0 | 0 | 0 | python,real-time,pytables | 22,161,505 | 2 | false | 0 | 0 | This is definitely possible. It is especially easy if you only have one process in 'w' and multiple processes in 'r' mode. Just make sure in your 'w' process to flush() the file and/or the datasets occasionally. If you do this, the 'r' process will be able to see the data. | 1 | 2 | 1 | I am not sure if what I am thinking would be possible, I would need the help from someone experienced working with HDF5/PyTables.
The escenario would be like this:
Let's say that we have a process, or a machine or a connexion etc, acquiring data, and storing in a HDF5/PyTable format. I will call it store software.
Woul... | write and read on real time pytables | -0.197375 | 0 | 0 | 996 |
22,065,764 | 2014-02-27T10:31:00.000 | 1 | 0 | 1 | 0 | python,command-line | 22,066,139 | 2 | false | 0 | 0 | Easiest way of accomplishing this is to run a small TCP server in a thread and have it change the variable you want to change when it receives a command to do so. Then write a python script that sends the stop command to that TCP server. | 1 | 2 | 0 | How can I access a running Python script's variable? Or access a function, to set the variable. I want to access it from the command line or from another Python script, that doesn't matter.
For example,
I have one script running run_motor.py, with a variable called mustRun. When the user pushes the stop button it shoul... | Set variable of a running Python script | 0.099668 | 0 | 0 | 3,259 |
22,066,818 | 2014-02-27T11:15:00.000 | 0 | 1 | 0 | 0 | python,performance,algorithm,file,hex | 22,069,185 | 2 | false | 0 | 0 | split file into hex words consisting of purely [0-9a-fA-F] characters then int(word, 16) will change a word to a normal python integer. You can directly compare integers.
Alternatively you can keep the hex words and then convert an integer to a hex string using '{0:x}'.format(someinteger), prior to comparing the hex st... | 1 | 0 | 0 | I have big data hex files from which I need to compare some hex values.When i read through python read it automatically converts it into ascii and so I have to decode it again.How can i directly read file in hex??
Till now i have tried using Intelhex python package but it is throwing an error :
intelhex.HexRecordError... | how to compare hex files in python | 0 | 0 | 0 | 1,698 |
22,067,766 | 2014-02-27T11:54:00.000 | 0 | 0 | 0 | 0 | python,django,angularjs,heroku,architecture | 22,103,027 | 2 | false | 1 | 0 | What you guys think about architecture?
This is a common Service Oriented Architecture with decoupled Clients. You just have REST endpoints on your backend, and any Client can consume those endpoints.
You should also think about:
Do you need RESTful service (RESTful == stateless, will you store any state on the serve... | 1 | 0 | 0 | Currently I am working on a portal which is exposed to end users. This portal is developed using Python 2.7, Django 1.6 and MySQL.
Now we want to expose this portal as a mobile app. But current design does not support that as templates, views and database are tightly coupled with each other. So we decided to re-archit... | How to re-architect a portal for creating mobile app | 0 | 0 | 0 | 183 |
22,071,291 | 2014-02-27T14:22:00.000 | 0 | 0 | 0 | 0 | python,events,pyqt,pyside,qt-designer | 22,102,393 | 2 | false | 0 | 1 | Monkey Patching did the job, I dont know why I didn't taught of that | 1 | 0 | 0 | I am using PySide in a not-so-MVC fashion, meaning, I try as much as possible not to edit the generated .ui to .py file, I put my application logic in packages (models) and I have one module (.pyw file) more like a controller for them all to initialize and perform management. Not too best of practice but I'm doing fine... | Adding Event functions outside PyQt/PySide Generated Code | 0 | 0 | 0 | 1,710 |
22,071,505 | 2014-02-27T14:30:00.000 | 0 | 0 | 1 | 0 | python,python-3.x,colors,tkinter,label | 22,078,545 | 1 | false | 0 | 1 | No, it is not possible to change the color of one letter in a label. However, you can use a text widget instead of a label to color just a single character. You could also use a canvas widget. | 1 | 0 | 0 | I can change color of all text in label, but I want to change color of one letter.
Is that possible?
I use tkiner and python 3.3. | Change color of one letter in label. Python | 0 | 0 | 0 | 820 |
22,074,156 | 2014-02-27T16:15:00.000 | 0 | 0 | 0 | 1 | python,proxy,dns,dnspython | 22,074,588 | 1 | false | 0 | 0 | If Google blocked that number of requests from a given IP address, one has to assume that sending such a number of requests is against their usage policy (and no doubt a form of 'unfair usage'). So hiding your source IP behind proxies is hardly ethical.
You could adopt a more ethical approach by:
Distributing your req... | 1 | 0 | 0 | I'm writing a program which gathers basic CNAME information for given domains.
I'm currently using Google's DNS server as the one I'm questioning, but afraid that if I'll send couple of millions DNS lookups this will get me blocked (Don't worry, it's by no means any type of DDOS or anything in that area).
I'm wondering... | Is it possible to use dnspython through proxy? | 0 | 0 | 1 | 1,227 |
22,077,202 | 2014-02-27T18:27:00.000 | 3 | 0 | 1 | 0 | python | 22,077,225 | 1 | false | 0 | 0 | They are separate arguments. iterable is the second argument; key is the optional third argument. | 1 | 1 | 0 | What is the structure of the second argument in heapq.nlargest(n, iterable[, key])?
As a Python rookie, I am only used to functions in the form myfunc(x, y, x). The iterable[, key] is confusing me! | What does "iterable[, key]" mean in a method signature? | 0.53705 | 0 | 0 | 102 |
22,077,846 | 2014-02-27T18:57:00.000 | 5 | 0 | 0 | 0 | python,html,tkinter | 22,094,453 | 1 | true | 0 | 1 | There is no support for viewing rendered HTML in a tkinter widget. There was a project (tkhtml) to build a modern web browser using tcl/tk (which is what powers tkinter), but the project never got past a very early alpha release and the last check-in was in 2009. | 1 | 3 | 0 | I would like to read a HTML and I show it on a Tkinter window. I would like to know if this is possible with any module and if it's how can I do it, as I'm totally lost finding solutions.
Thanks in advance. | Read a HTML file and show it on a Tkinter window | 1.2 | 0 | 0 | 3,286 |
22,079,296 | 2014-02-27T20:11:00.000 | 3 | 0 | 1 | 0 | python,list | 22,079,431 | 1 | true | 0 | 0 | likely just because its redundant when we already have and are use to len() maybe you could add a .len() method :)
there is a a_list.__len__() | 1 | 2 | 0 | Python's length of list can be calculated by len(a_list). My question is, why was a_list.len() not implemented? Is there a reason behind it? | Why does python list does not have len() method | 1.2 | 0 | 0 | 991 |
22,079,882 | 2014-02-27T20:42:00.000 | 6 | 0 | 1 | 0 | python,matrix,transpose | 22,080,238 | 1 | true | 0 | 0 | [[row[i] for row in data] for i in range(len(data[0]))] | 1 | 1 | 1 | How do you transpose a matrix without using numpy or zip or other imports?
I thought this was the answer but it does not work if the matrix has only 1 row...
[[row[i] for row in data] for i in range(len(data[1]))] | How to transpose a matrix without using numpy or zip (or other imports) | 1.2 | 0 | 0 | 4,612 |
22,080,748 | 2014-02-27T21:24:00.000 | 0 | 0 | 1 | 1 | python,python-3.x | 22,080,908 | 2 | false | 0 | 0 | Your REGISTRY_KEY.strip() call is not doing what you think it's doing. It doesn't remove the string HKEY_LOCAL_MACHINE\ from the beginning of the string. Instead, it removes the characters H, K, E, etc., in any order, from both ends of the string. This is why it works when you manually put in what you expect.
As for yo... | 1 | 1 | 0 | I am reading reading path to the registry from a text file. The registry path is
HKEY_LOCAL_MACHINE\Software\MYAPP\6.3
I store this registry in a variable :
REGISTRY_KEY
Then I strip the HKEY_LOCAL_MACHINE part from the string and try to read the value at the key.
if REGISTRY_KEY.split('\\')[0] == "HKEY_LOCAL_MACH... | Explicitly make a string into raw string | 0 | 0 | 0 | 123 |
22,082,005 | 2014-02-27T22:31:00.000 | 1 | 0 | 0 | 1 | python,django,rackspace,mezzanine | 22,083,369 | 2 | false | 1 | 0 | The best way is to have this working, is to have a different web server serving all of your media (I used nginx). Then you setup a load balancer to detect failure and redirect all the requests to CDN in case of a failure.
One thing that you might have to figure out is the image path.(use HAProxy to rewrite the request... | 1 | 3 | 0 | I have a django/mezzanine/django-cumulus project that uses the rackspace cloudfiles CDN for media storage. I would like to automatically serve all static files from the local MEDIA_ROOT, if they exist, and only fallback to the CDN URL if they do not.
One possible approach is to manage the fallback at the template level... | Multiple storage engines for django media: prefer local, fallback to CDN | 0.099668 | 0 | 0 | 675 |
22,084,435 | 2014-02-28T01:33:00.000 | 1 | 0 | 0 | 0 | python,networkx | 22,084,546 | 3 | false | 0 | 0 | It seems to me you should
decide how many nodes you will have
generate the number of links per node in your desired distribution - make sure the sum is even
start randomly connecting pairs of nodes until all link requirements are satisfied
There are a few more constraints - no pair of nodes should be connected more t... | 1 | 3 | 1 | How I can create a graph with
-predefined number of connections for each node, say 3
-given distribution of connections (say Poisson distribution with given mean)
Thanks | Python: Create a graph with defined number of edges per node | 0.066568 | 0 | 0 | 1,817 |
22,085,475 | 2014-02-28T03:14:00.000 | 3 | 0 | 1 | 0 | python,performance | 22,085,499 | 1 | true | 0 | 0 | Apples and oranges. You should think about program flow and structure when choosing between storing data in a scope variable or an instance attribute. Comparing performance here is meaningless.
If the data logically belongs to an entity in your program which will be passed around between different parts of the program ... | 1 | 0 | 0 | I'm creating a hangman game in Python 2, and I can store the current word in either:
An object, as an attribute (like wordlist.word = blah)
A variable (like word = blah)
I'm then passing this word into another function, where the main parts of the game reside, to be used in comparisons and such.
I kind of prefer to k... | Is it more efficient to pass an object or a variable? | 1.2 | 0 | 0 | 61 |
22,087,875 | 2014-02-28T06:29:00.000 | 7 | 0 | 1 | 0 | python,python-sphinx,sphinx-apidoc | 22,088,341 | 1 | true | 0 | 0 | First you run sphinx-quickstart and accept the defaults to set up your basic structure this is only done once and you edit the table of contents section of index.rst to point to your tutorials, give an introduction, etc. - the you at least outline your tutorials in separate .rst files. You also edit config.py to add a... | 1 | 6 | 0 | I want to use Sphinx to document a large project that is currently not well-documented. In particular I want to use sphinx-apidoc to produce the documentation from the code as I document it.
However I also want to have some pages of tutorial on how to use the project etc., but it seems when I call sphinx-apidoc it gen... | What is the correct workflow in using Sphinx for Python project documentation? | 1.2 | 0 | 0 | 2,050 |
22,091,306 | 2014-02-28T09:37:00.000 | -1 | 0 | 0 | 0 | python,pandas,stock | 60,347,465 | 2 | false | 0 | 0 | Forget about Python. There is absolutely no way to convert an ISIN to a Ticker Symbol. You have completely misunderstood the wikipedia page. | 1 | 3 | 1 | I'm trying to compute some portfolio statistics using Python Pandas, and I am looking for a way to query stock data with DataReader using the ISIN (International Securities Identification Number).
However, as far as I can see, DataReader is not compatible with such ids, although both YahooFinance and GoogleFinance can... | Pandas: DataReader in combination with ISIN identification | -0.099668 | 0 | 0 | 3,894 |
22,095,035 | 2014-02-28T12:18:00.000 | 33 | 0 | 1 | 0 | ipython,ipython-notebook | 23,282,206 | 1 | false | 0 | 0 | I often start a qtconsole attached to the kernel. You can do that as follows:
Create a new cell.
In the new cell, type %qtconsole and execute that cell.
Delete the new cell.
Once you have a qtconsole that is attached to the notebook kernel. You can print
the value of variables there. | 1 | 23 | 0 | I have often this problem, when I'm slicing or subsetting data that I want to view/print [df.head()] the data and look into into it before writing next line of my code.
For this case, every time, I have to run the whole block(cell) in ipython, even if I have some logic written I had to comment that block and execute m... | Execute/Run a single line in IPython rather entire Cell | 1 | 0 | 0 | 9,263 |
22,096,525 | 2014-02-28T13:28:00.000 | 0 | 0 | 0 | 0 | python,algorithm,graph | 22,098,160 | 2 | true | 0 | 0 | It depends a lot on your particular needs. There are a few options. Two built-in, and one that requires a bit more work, but might be faster.
If what you really want is to find two non-intersecting paths, then you can use a filtered graph - after finding one path, induce a subgraph with the intermediate nodes removed, ... | 2 | 0 | 0 | I am using the NetworkX library for Python in my application that does some graph processing. One task is to call the all_simple_paths() function of NetworkX to give me all non-looping paths in the graph (up to a certain max. length of paths). This is working well.
Using this list of all simple paths in the graph the t... | How to find n most different paths in a graph? | 1.2 | 0 | 1 | 905 |
22,096,525 | 2014-02-28T13:28:00.000 | 0 | 0 | 0 | 0 | python,algorithm,graph | 22,098,044 | 2 | false | 0 | 0 | You could create a similarity or distance between two paths based on the number of edges that they share. Then apply a clustering algorithm to find n clusters, and pick one representative from each cluster, perhaps in a greedily fashion to minimise (in the case of similarities) edge weights between representatives. | 2 | 0 | 0 | I am using the NetworkX library for Python in my application that does some graph processing. One task is to call the all_simple_paths() function of NetworkX to give me all non-looping paths in the graph (up to a certain max. length of paths). This is working well.
Using this list of all simple paths in the graph the t... | How to find n most different paths in a graph? | 0 | 0 | 1 | 905 |
22,097,901 | 2014-02-28T14:29:00.000 | 2 | 0 | 1 | 0 | python,execution | 22,098,159 | 1 | true | 0 | 0 | These frames are representations of the stack frames created by function calls. You should not need to access them in normal programming. A new frame is indeed created every time a function is called, and destroyed when it exits or raises an uncaught exception. Since function calls can go many levels deep your program ... | 1 | 4 | 0 | In a python reference manual said that
A code block is executed in an execution frame. A frame contains some
administrative information (used for debugging) and determines where
and how execution continues after the code block’s execution has
completed.
and
Frame objects represent execution frames. They may oc... | frame type in python | 1.2 | 0 | 0 | 2,140 |
22,100,757 | 2014-02-28T16:37:00.000 | 3 | 0 | 1 | 0 | python,mysql | 44,177,264 | 14 | false | 0 | 0 | Also something that can go wrong: Don't name your own module mysql
import mysql.connector will fail because the import gives the module in the project precedence over site packages and yours likely doesnt have a connector.py file. | 1 | 35 | 0 | I'm using Amazon Linux AMI release 2013.09. I've install virtualenv and after activation then I run pip install mysql-connector-python, but when I run my app I get an error: ImportError: No module named mysql.connector. Has anyone else had trouble doing this? I can install it outside of virtualenv and my script runs wi... | Can not get mysql-connector-python to install in virtualenv | 0.042831 | 1 | 0 | 73,109 |
22,101,857 | 2014-02-28T17:26:00.000 | 0 | 0 | 0 | 0 | python,openerp | 22,103,548 | 1 | true | 1 | 0 | Working through XML-RPC is pretty much like working directly on the server, only slower.
To get the product list you'll need to interact wit product.product, and to narrow the list (and the data) you'll need to specify a domain such as domain=[('color','=','red'),('style','=','sport')] and fields=['id','name','...'].
H... | 1 | 0 | 0 | I'm currently working on a mobile app that connects with an openerp 7 instance though XML-RPC.
Although xmlrpc comm between iOS & Openerp 7 works perfectly, I'm puzzled at which objects I need to interact with at the openerp side in order to get the product list with only the items I want and to post a sale.
Any one?
T... | Retrieving product list form openerp 7 | 1.2 | 0 | 0 | 273 |
22,102,352 | 2014-02-28T17:51:00.000 | 0 | 0 | 0 | 0 | python,selenium,phantomjs | 22,103,574 | 1 | true | 1 | 0 | I just discovered that my problem was with a elem.send_keys(Keys.ENTER) line. Phantomjs seems to be very fast so I had to put a time.sleep of 2 seconds before that line, and now the script works fine. What happened is that Enter button for login wasn't clicked properly. Of course time.sleep(2) isn't the best way to sol... | 1 | 2 | 0 | I was trying to log into a website that is loaded fuly dinamically using dojo.js scripts. On my tests I am using:
Selenium 2.40
Phantomjs 1.9.7 (downloaded via npm)
Ubuntu 12.04
When I try my script with: driver = webdriver.Firefox()
Everything works fine, Firefox logins through login page /login.do, gets through aut... | Selenium phantomjs (python) not redirecting to welcome page after login, page is load dynamically using dojo | 1.2 | 0 | 1 | 633 |
22,103,096 | 2014-02-28T18:32:00.000 | 0 | 1 | 0 | 1 | python,linux,filesystemwatcher,inotify | 22,106,444 | 1 | true | 0 | 0 | Create a script (you wouldn't need python for this task, just df and find). This is pretty lightweight, needs less code than a daemon (much less maintenance in the long run), and running scripts once a minute by cron is not unheard of. :-) | 1 | 1 | 0 | I need to monitor NAS file system disk space, whenever file-system disk space goes above from a threshold value, I am I deleting oldest files from file system to bring back file system disk space below to threshold value.
I read several article which suggested me two alternatives:
by creating a daemon process which wi... | which is better way to run a file system monitoring service? | 1.2 | 0 | 0 | 154 |
22,106,380 | 2014-02-28T21:42:00.000 | 21 | 0 | 1 | 0 | python,pypdf2 | 42,181,449 | 4 | false | 0 | 0 | If you have pip, PyPDF2 is on the Python Package Index, so you can install it with the following in your terminal/command prompt:
Python 2:
pip install PyPDF2
Python 3:
pip3 install PyPDF2 | 2 | 15 | 0 | As a newbie... I am having difficulties installing pyPDF2 module. I have downloaded. Where and how do I install (setup.py) so I can use module in python interpreter? | How do I install pyPDF2 module using windows? | 1 | 0 | 0 | 94,939 |
22,106,380 | 2014-02-28T21:42:00.000 | 1 | 0 | 1 | 0 | python,pypdf2 | 33,626,099 | 4 | false | 0 | 0 | Here's how I did it:
After you have downloaded and installed Python (it usually installs under C:\Python** (** being python version - usually 27)), copy the extracted PyPDF2 contents to C:\Python** folder, after that enter in command prompt/terminal "cd C:\Python27\python.exe setup.py install". If you did everything r... | 2 | 15 | 0 | As a newbie... I am having difficulties installing pyPDF2 module. I have downloaded. Where and how do I install (setup.py) so I can use module in python interpreter? | How do I install pyPDF2 module using windows? | 0.049958 | 0 | 0 | 94,939 |
22,108,095 | 2014-02-28T23:58:00.000 | 2 | 0 | 0 | 0 | python,matplotlib | 22,109,817 | 1 | true | 0 | 0 | I don't think it's possible. I did a little bit of the backend's work in my main script, setting up a RendererPdf (defined in backend_pdf.py) and conatining a GraphicsContextPdf which is a GraphicsContextBase which keeps a capstyle, intialized as butt. As confirmed by grep, this is the only place where butt is hardcode... | 1 | 4 | 1 | Figures rendered with the PDF backend have a 'butt' capstyle in my reader. (If I zoom at the corner of a figure in a pdf, I do not see a square corner, but the overlap of shortened lines.) I would like either a 'round' or 'projecting' (what matplotlib calls the 'square' capstyle) cap. Thus the Spine objects are in ques... | set capstyle of spines for pdf backend | 1.2 | 0 | 0 | 176 |
22,109,120 | 2014-03-01T01:57:00.000 | 1 | 1 | 1 | 0 | python,performance,cpu,cpu-usage | 22,109,186 | 2 | false | 0 | 0 | First recommendation is the simpler lower than process priority to absolute minimum.
If still not reponsive, you could sprinkle in sleep() calls from from time module to surrender CPU
Or buy a new computer with 4 cores and just let it run. I do this all the time -- works great.
ADDED
Adding time.sleep() calls will leav... | 1 | 3 | 0 | I'm running a python program that's a fairly intensive test of many possible scenarios using a big-O of n algorithm. It's just brute-forcing it by testing over a billion different possibilities using at least five nested loops.
Anyway, I'm not concerned with how much time the program takes. It's fine to run in the bac... | Is it possible to force your computer to devote less CPU in exchange for more time when running a python program? | 0.099668 | 0 | 0 | 245 |
22,110,562 | 2014-03-01T05:29:00.000 | 0 | 0 | 0 | 0 | python,database,redis,redis-py | 22,111,910 | 1 | false | 0 | 0 | You cannot. The number of databases is not a dynamic parameter in Redis.
You can change it by updating the Redis configuration file (databases parameter) and restarting the server.
From a client (Python or other), you can retrieve this value using the "GET CONFIG DATABASES" command. But the "SET CONFIG DATABASES xxx" c... | 1 | 1 | 0 | I know that Redis have 16 databases by default, but what if i need to add another database, how can i do that using redis-py? | Insert a new database in redis using redis.StrictRedis() | 0 | 1 | 0 | 460 |
22,111,408 | 2014-03-01T07:18:00.000 | 1 | 1 | 0 | 0 | python,usb,ethernet,libusb | 22,111,428 | 1 | true | 0 | 0 | No, it is not possible. There is no sane way to affect the PHY in PC software. | 1 | 0 | 0 | I am trying to set the ethernet port pins directly to send High / Low signals to light up four LEDs. Is there any way I can simply connect LEDs to the ethernet cable?
What would be the best approach, if using ethernet is not a good option, to light up four LED lights and switch them on/off using a PC.
I am planning to ... | Toggle pins of ethernet port to high / low state? | 1.2 | 0 | 1 | 250 |
22,112,779 | 2014-03-01T09:54:00.000 | 0 | 0 | 0 | 0 | python,asp.net | 22,112,975 | 2 | false | 0 | 0 | Did you mean to ask about python or *nix filesystems in general? | 2 | 1 | 0 | Does a softlink still work if the file it links to is moved to a different location on the disk and why is that possible considering the action. | Soft links and Hard links | 0 | 0 | 0 | 132 |
22,112,779 | 2014-03-01T09:54:00.000 | 1 | 0 | 0 | 0 | python,asp.net | 22,113,036 | 2 | false | 0 | 0 | In terms of file system, soft links will not work if the target it is pointing to has been moved/renamed/deleted.
It continues to points to the old target, now a non-existing location or file. Because symbolic link contains a text string that is automatically interpreted and followed by the operating system as a path t... | 2 | 1 | 0 | Does a softlink still work if the file it links to is moved to a different location on the disk and why is that possible considering the action. | Soft links and Hard links | 0.099668 | 0 | 0 | 132 |
22,113,950 | 2014-03-01T11:45:00.000 | 2 | 0 | 1 | 1 | python,eclipse,pydev | 28,799,767 | 1 | false | 0 | 0 | The PYTHONPATH in PyDev is computed in the following order:
Source folders of the project have highest priority (since this is the code you're expecting to be editing).
External source folders of the project being used for the launch.
Computed PYTHONPATH of the dependent projects (again, first source then external).
P... | 1 | 1 | 0 | Using Eclipse with the PyDev plugin, if you choose myProject>Properties>PyDev-PYTHONPATH, you then see two tabs: Source Folders and External Libraries. You can also choose myProject>Properties>Project References and see a widget with a checkable list of other parallel subprojects in your Eclipse/Pydev IDE workspace. ... | In what order are PyDev project references, sourrce folders, and external libraries in the PYTHONPATH | 0.379949 | 0 | 0 | 340 |
22,114,437 | 2014-03-01T12:34:00.000 | 0 | 0 | 1 | 0 | python,transactions,nosql,redis | 22,115,137 | 1 | true | 0 | 0 | The result of 'pipeline.execute()' is an array of 2 elements. The first is the result of 'pipeline.incr('trans:')', the second is the result of 'pipeline.incr('trans:',-1)'. The output is correct in your case. | 1 | 2 | 0 | I am reading a book on Redis (Redis in action) and on page 59-60. There is an example use for transaction as below:
def trans(conn):
pipeline = conn.pipeline()
pipeline.incr('trans:')
time.sleep(.1)
pipeline.incr('trans:',-1)
print pipeline.execute()[0]
def run_transaction(conn):
if 1:
... | Why the results of my code are unexpected? | 1.2 | 0 | 0 | 48 |
22,114,984 | 2014-03-01T13:26:00.000 | 0 | 0 | 0 | 0 | python,django,debugging | 22,116,486 | 2 | false | 1 | 0 | To make your life easier, try IDE like PyCharm.
I use pdb or ipdb to debug simple python file, but they wouldn't be so useful in debugging complex Python scripts.
Also, django-debug-tools is a good tool to debug and optimize Django application. | 1 | 0 | 0 | I'm currently debugging a django application by inserting import pdb; pdb.set_trace() in the code and using the debugger commands to navigate through running application.
The debugger shows the current line, but most of the time it is helpful to have a bit more context. Therefore I open the current file in an editor in... | How to debug a django application in a comfortable way? | 0 | 0 | 0 | 91 |
22,121,165 | 2014-03-01T22:21:00.000 | 0 | 0 | 0 | 0 | python | 22,121,194 | 2 | false | 0 | 0 | When you use your browser, it sends a header known as a User-Agent that identifies it. You need to 'spoof' the user agent from your python script to make it think a human is browsing the website. Set the User-Agent header to that of a common browser, this makes it difficult for the server to detect that you are using a... | 1 | 0 | 0 | I was trying to download some files from a sever but it came back with an error page saying only links from internal server is allowed. I was able to download the file with any browser by clicking the link and I have verified the link I captured in Python was correct.
Is there any way this can be done by using python? ... | Download files that only allow access from internal server with Python | 0 | 0 | 1 | 56 |
22,121,368 | 2014-03-01T22:42:00.000 | 0 | 0 | 0 | 0 | python,linux,django,sockets | 22,125,431 | 3 | false | 1 | 0 | You need the following two programs running at all times:
The producer, which will populate the queue. This is the program that will collect the various messages and then post them on the queue.
The consumer, which will process messages from the queue. This consumer's job is to read the message and do something with i... | 1 | 4 | 0 | I've been trying to make a decision about my student project before going further. The main idea is get disk usage data, active linux user data, and so on from multiple internal server and publish them with Django.
Before I came to RabbitMQ I was thinking about developing a client application for each linux server and... | Using RabbitMQ with Django to get information from internal servers | 0 | 0 | 0 | 3,991 |
22,122,506 | 2014-03-02T00:52:00.000 | 4 | 0 | 0 | 0 | python,r,machine-learning,scikit-learn,svm | 22,123,913 | 2 | true | 0 | 0 | I do not have experiece with e1070, however from googling it it seems that it either uses or is based on LIBSVM (I don't know enough R to determine which from the cran entry). Scilearnkit also uses LIBSVM.
In both cases the model is going to be trained by LIBSVM. Speed, scalability, variety of options available is goi... | 2 | 1 | 1 | Recently I was contemplating the choice of using either R or Python to train support vector machines.
Aside from the particular strengths and weaknesses intrinsic to both programming languages, I'm wondering if there is any heuristic guidelines for making a decision on which way to go, based on the packages themselves.... | What's the difference between using libSVM in sci-kit learn, or e1070 in R, for training and using support vector machines? | 1.2 | 0 | 0 | 381 |
22,122,506 | 2014-03-02T00:52:00.000 | 0 | 0 | 0 | 0 | python,r,machine-learning,scikit-learn,svm | 22,189,863 | 2 | false | 0 | 0 | Sometime back I had the same question. Yes, both e1070 and scikit-learn use LIBSVM. I have experience with e1070 only.
But there are some areas where R is better. I have read in the past that Python does not handle categorical features properly (at least not right out of the box). This could be a big deal for some.
I a... | 2 | 1 | 1 | Recently I was contemplating the choice of using either R or Python to train support vector machines.
Aside from the particular strengths and weaknesses intrinsic to both programming languages, I'm wondering if there is any heuristic guidelines for making a decision on which way to go, based on the packages themselves.... | What's the difference between using libSVM in sci-kit learn, or e1070 in R, for training and using support vector machines? | 0 | 0 | 0 | 381 |
22,128,419 | 2014-03-02T13:49:00.000 | 1 | 0 | 0 | 0 | python,sqlalchemy,flask,flask-sqlalchemy | 22,128,680 | 2 | false | 1 | 0 | SQL Alchemy is generally not faster (esp. as it uses those driver to connect).
However, SQL Alchemy will help you structure your data in a sensible way and help keep the data consistent. Will also make it easier for you to migrate to a different db if needed. | 2 | 0 | 0 | I'd rather just use raw MySQL, but I'm wondering if I'm missing something besides security concerns. Does SQLAlchemy or another ORM handle scaling any better than just using pymysql or MySQLdb? | Should I use an ORM like SQLAlchemy for a lightweight Flask web service? | 0.099668 | 1 | 0 | 941 |
22,128,419 | 2014-03-02T13:49:00.000 | 1 | 0 | 0 | 0 | python,sqlalchemy,flask,flask-sqlalchemy | 22,134,840 | 2 | true | 1 | 0 | Your question is too open to anyone guarantee SQLAlchemy is not a good fit, but SQLAlchemy probably will never be your problem to handle scalability. You'll have to handle almost the same problems with or without SQLAlchemy.
Of course SQLAlchemy has some performance impact, it is a layer above the database driver, but ... | 2 | 0 | 0 | I'd rather just use raw MySQL, but I'm wondering if I'm missing something besides security concerns. Does SQLAlchemy or another ORM handle scaling any better than just using pymysql or MySQLdb? | Should I use an ORM like SQLAlchemy for a lightweight Flask web service? | 1.2 | 1 | 0 | 941 |
22,132,285 | 2014-03-02T19:27:00.000 | 1 | 0 | 1 | 0 | python,loops,while-loop | 22,132,302 | 5 | false | 0 | 0 | That is not only python , that is in most of programming languages
x=1;
x+=1;
x will be 2
x=1;
x-=1;
x will be 0
x=3;
x*=2;
x will be 6
x=6;
x/=2;
x will be 3 | 1 | 0 | 0 | what does
+=, -=, *= and /=
stand for in Python? and how do you use it for while loop? | what does +=, -=, *= and /= stand for in Python? | 0.039979 | 0 | 0 | 25,742 |
22,134,173 | 2014-03-02T22:02:00.000 | 6 | 1 | 0 | 1 | python,rabbitmq | 22,134,400 | 1 | true | 0 | 0 | in general, the network aspect of "batching messages" is handled at the level of the basic.qos(prefetch-size, prefetch-count) parameters. In this scheme, the broker will send some number of bytes/messages(respectively) beyond the the unacknowledged messages for a consumer, but the client library doles out messages, in... | 1 | 6 | 0 | I have a stream of requests in my RabbitMQ cluster, and multiple consumers handling them. The thing is - each consumer must handle requests in batches for performance reasons. Specifically there is a network IO operation that I can amortize by batching requests.
So, each consumer would like to maximize the number of r... | Batch message from a rabbitMQ queue | 1.2 | 0 | 0 | 4,628 |
22,137,858 | 2014-03-03T02:51:00.000 | 1 | 0 | 1 | 0 | python,shell,python-2.7,ipython | 22,137,897 | 1 | false | 0 | 0 | Just press q if you want to exit from the docs in Ipython | 1 | 0 | 0 | Whenever I use ipython and want to look up the docs on some object I use the ? command after the object. However, once I'm viewing the docs I can't go back to the previous ipython shell. Is there some easy keystrokes to do this? It is getting really annoying having to exit out of the ipython shell every time I need to ... | Ipython ? Shell | 0.197375 | 0 | 0 | 98 |
22,141,637 | 2014-03-03T08:11:00.000 | 0 | 1 | 0 | 0 | python,paramiko | 22,160,534 | 3 | false | 0 | 0 | if you are planning to use the exec_command() method provided within the paramiko API , you would be limited to send only a single command at a time , as soon as the command has been executed the channel is closed.
The below excerpt from Paramiko API docs .
exec_command(self, command) source code Execute a command on... | 1 | 0 | 0 | i have read other Stackoverflow threads on this. Those are older posts, i would like to get the latest update.
Is it possible to send multiple commands over single channel in Paramiko ? or is it still not possible ?
If so, is there any other library which can do the same.
Example scenario, automating the Cisco router ... | Paramiko - python SSH - multiple command under a single channel | 0 | 0 | 1 | 4,222 |
22,142,369 | 2014-03-03T08:58:00.000 | 2 | 0 | 0 | 0 | python,matlab,scipy | 22,165,531 | 4 | true | 0 | 0 | Using the functions scipy.ndimage.filters.correlate and scipy.ndimage.filters.convolve | 1 | 11 | 1 | I know the equivalent functions of conv2 and corr2 of MATLAB are scipy.signal.correlate and scipy.signal.convolve. But the function imfilter has the property of dealing with the outside the bounds of the array. Like as symmetric, replicate and circular. Can Python do that things | The equivalent function of Matlab imfilter in Python | 1.2 | 0 | 0 | 12,599 |
22,143,644 | 2014-03-03T10:02:00.000 | 0 | 0 | 0 | 0 | python,arrays,numpy | 37,731,398 | 5 | false | 0 | 0 | They are very applicable in scientific computing. Right now, for instance, I am running simulations which output data in a 4D array: specifically
| Time | x-position | y-position | z-position |.
Almost every modern spatial simulation will use multidimensional arrays, along with programming for computer games. | 5 | 1 | 1 | I was surprised when I started learning numpy that there are N dimensional arrays. I'm a programmer and all I thought that nobody ever use more than 2D array. Actually I can't even think beyond a 2D array. I don't know how think about 3D, 4D, 5D arrays or more. I don't know where to use them.
Can you please give me exa... | Examples on N-D arrays usage | 0 | 0 | 0 | 141 |
22,143,644 | 2014-03-03T10:02:00.000 | 0 | 0 | 0 | 0 | python,arrays,numpy | 22,146,242 | 5 | false | 0 | 0 | There are so many examples... The way you are trying to represent it is probably wrong, let's take a simple example:
You have boxes and a box stores N items in it. You can store up to 100 items in each box.
You've organized the boxes in shelves. A shelf allows you to store M boxes. You can identify each box by a index... | 5 | 1 | 1 | I was surprised when I started learning numpy that there are N dimensional arrays. I'm a programmer and all I thought that nobody ever use more than 2D array. Actually I can't even think beyond a 2D array. I don't know how think about 3D, 4D, 5D arrays or more. I don't know where to use them.
Can you please give me exa... | Examples on N-D arrays usage | 0 | 0 | 0 | 141 |
22,143,644 | 2014-03-03T10:02:00.000 | 1 | 0 | 0 | 0 | python,arrays,numpy | 22,144,505 | 5 | false | 0 | 0 | A few simple examples are:
A n x m 2D array of p-vectors represented as an n x m x p 3D matrix, as might result from computing the gradient of an image
A 3D grid of values, such as a volumetric texture
These can even be combined in the case of a gradient of a volume in which case you get a 4D matrix
Staying with the g... | 5 | 1 | 1 | I was surprised when I started learning numpy that there are N dimensional arrays. I'm a programmer and all I thought that nobody ever use more than 2D array. Actually I can't even think beyond a 2D array. I don't know how think about 3D, 4D, 5D arrays or more. I don't know where to use them.
Can you please give me exa... | Examples on N-D arrays usage | 0.039979 | 0 | 0 | 141 |
22,143,644 | 2014-03-03T10:02:00.000 | 0 | 0 | 0 | 0 | python,arrays,numpy | 22,144,263 | 5 | false | 0 | 0 | For example, a 3D array could be used to represent a movie, that is a 2D image that changes with time.
For a given time, the first two axes would give the coordinate of a pixel in the image, and the corresponding value would give the color of this pixel, or a grey scale level. The third axis would then represent time. ... | 5 | 1 | 1 | I was surprised when I started learning numpy that there are N dimensional arrays. I'm a programmer and all I thought that nobody ever use more than 2D array. Actually I can't even think beyond a 2D array. I don't know how think about 3D, 4D, 5D arrays or more. I don't know where to use them.
Can you please give me exa... | Examples on N-D arrays usage | 0 | 0 | 0 | 141 |
22,143,644 | 2014-03-03T10:02:00.000 | 0 | 0 | 0 | 0 | python,arrays,numpy | 22,144,157 | 5 | false | 0 | 0 | Practical applications are hard to come up with but I can give you a simple example for 3D.
Imagine taking a 3D world (a game or simulation for example) and splitting it into equally sized cubes. Each cube could contain a specific value of some kind (a good example is temperature for climate modelling). The matrix can ... | 5 | 1 | 1 | I was surprised when I started learning numpy that there are N dimensional arrays. I'm a programmer and all I thought that nobody ever use more than 2D array. Actually I can't even think beyond a 2D array. I don't know how think about 3D, 4D, 5D arrays or more. I don't know where to use them.
Can you please give me exa... | Examples on N-D arrays usage | 0 | 0 | 0 | 141 |
22,144,504 | 2014-03-03T10:39:00.000 | 17 | 1 | 0 | 0 | python,automated-tests,coverage.py,python-behave | 23,836,778 | 1 | false | 0 | 0 | You can run any module with coverage to see the code usage.
In your case should be close to coverage run --source='.' -m behave
Tracking code coverage for Aceptace/Integration/Behaviour test will give a high coverage number easily but can lead to the idea that the code are properly tested.
Those are for see things wor... | 1 | 9 | 0 | We are using Behave BDD tool for automating API's. Is there any tool which give code coverage using our behave cases?
We tried using coverage module, it didn't work with Behave. | Test coverage tool for Behave test framework | 1 | 0 | 0 | 4,754 |
22,144,748 | 2014-03-03T10:51:00.000 | 5 | 1 | 1 | 0 | python,numpy,module,matplotlib,ipython | 22,144,980 | 1 | true | 0 | 0 | Repeated imports aren't a problem. No matter how many times a module is imported in a program, Python will only run its code once and only make one copy of the module. All imports after the first will merely refer to the already-loaded module object. If you're coming from a C++ background, you can imagine the modules a... | 1 | 4 | 0 | I'm writing a .py file which will be regularly imported at the start of some of my IPython sessions in the first cells but will also be imported from other non-interactive sessions, since it contains functions that can be run in batch in non-interactive mode.
It is basically a module containing many classes and functio... | Best practices when importing in IPython | 1.2 | 0 | 0 | 619 |
22,146,944 | 2014-03-03T12:34:00.000 | 1 | 0 | 0 | 1 | python,rabbitmq,celery | 56,632,082 | 3 | false | 0 | 0 | Celery can use several back-ends. If you are already using RabbitMQ, it makes that option attractive.
These are however different concerns. Use a generic RabbitMQ client library such as pika to implement a consumer for your messages, then, if needed, use Celery to schedule tasks. | 1 | 5 | 0 | The celery docs suggest that Rabbit-MQ must act like a middleman, where it is used as a messaging platform.
In my infrastructure, Rabbit-MQ is the primary server that serves me with some data every second. Now, whenever the data is served, I want Celery to do certain tasks.
Now, this throws out the whole publisher-wo... | How to use celery to get messages from a rabbit-mq server? | 0.066568 | 0 | 0 | 1,369 |
22,147,757 | 2014-03-03T13:13:00.000 | 4 | 0 | 1 | 0 | python,python-3.x,dictionary,iterable,memory-efficient | 22,147,887 | 2 | false | 0 | 0 | If you want to sort them, the iterable needs to be turned into a list (which sorted will handle for you)... but how often are you going to sort an enumerate object, compared to how often you're going to just iterate over it? What about sorting the items of a dict, compared to just iterating over them?
If your API produ... | 1 | 3 | 0 | In Python 3 a lot of functions (now classes) that returned lists now return iterables, the most popular example being range. In this case range was made an iterable in Python 3 to improve performance, and memory efficiency (since you don't have to build a list anymore).
Other "new" iterables are map, enumerate, zip an... | Iterators in Python 3 | 0.379949 | 0 | 0 | 1,342 |
22,148,917 | 2014-03-03T14:10:00.000 | 0 | 0 | 0 | 0 | python,pip,rackspace,iron.io,pyrax | 22,153,710 | 2 | false | 0 | 0 | It's difficult to know for sure what's happening without being able to see a traceback. Do you get anything like that which could be used to help figure out what's going on? | 2 | 1 | 0 | I created a Python script to use Rackspace's API (Pyrax) to handle some image processing. It works perfect locally, but when I upload it to Iron.io worker, it builds but does not import.
I am using a Windows 8 pc, but my boss runs OS X and uploading the exact worker package, it works fine. So I'm thinking it's somethi... | pip "pyrax" dependency with iron worker | 0 | 0 | 1 | 116 |
22,148,917 | 2014-03-03T14:10:00.000 | 2 | 0 | 0 | 0 | python,pip,rackspace,iron.io,pyrax | 22,153,804 | 2 | false | 0 | 0 | I figured out that it was a bad Ruby install. No idea why, but reinstalling it worked. | 2 | 1 | 0 | I created a Python script to use Rackspace's API (Pyrax) to handle some image processing. It works perfect locally, but when I upload it to Iron.io worker, it builds but does not import.
I am using a Windows 8 pc, but my boss runs OS X and uploading the exact worker package, it works fine. So I'm thinking it's somethi... | pip "pyrax" dependency with iron worker | 0.197375 | 0 | 1 | 116 |
22,150,395 | 2014-03-03T15:15:00.000 | 0 | 0 | 1 | 0 | python,cx-freeze,nonetype | 22,177,207 | 1 | true | 0 | 0 | After long investigation I found that the problem was with HOME environment variable (It has to be set).
When I set the environment variable HOME, it started to work properly.
I hope it will safe time and help somebody,
Honza | 1 | 0 | 0 | I have problem with python scripts built in cx_freeze. When I run the source script by python, everythink works. But when I run the compilled script,
it still ended with errors like: object of type 'NoneType' has no len().
Thank you for your help,
Honza | Python - cx_freeze script not working | 1.2 | 0 | 0 | 179 |
22,150,526 | 2014-03-03T15:21:00.000 | 0 | 0 | 0 | 1 | python,windows-7,scheduled-tasks,pythonw | 28,174,244 | 1 | false | 0 | 0 | I encountered a similar problem. While my code worked as expected using python.exe, it failed to work with pythonw.exe.
After much debugging, I identified the source as a call to sys.stdout.write(). With pythonw.exe, sys.stdout is null, so the program crashes, but, silently. I wrapped that call in "if sys.stdout is not... | 1 | 2 | 0 | I've got a python script set to log in to a mail server and transfer the files to a remote directory mapped on my machine. Since I don't want it popping up every 10 minutes, I saved it as a pyw file. It worked fine at first, but then it stopped working, showing 0x1 as the result of the last run in the Windows Task Sc... | pyw file not working intermittently / Task Scheduler | 0 | 0 | 0 | 648 |
22,156,258 | 2014-03-03T20:04:00.000 | 10 | 0 | 0 | 0 | python,pandas | 25,162,895 | 2 | true | 0 | 0 | In my practice, the strongest, easiest-to-see difference is that a Panel needs to be homogeneous in every dimension. If you look at a Panel as a stack of Dataframes, you cannot create it by stacking Dataframes of different sizes or with different indexes/columns. You can indeed handle more non-homogeneous type of data... | 1 | 14 | 1 | Using Pandas, what are the reasons to use a Panel versus a MultiIndex DataFrame?
I have personally found significant difference between the two in the ease of accessing different dimensions/levels, but that may just be my being more familiar with the interface for one versus the other. I assume there are more substanti... | Pandas MultiIndex versus Panel | 1.2 | 0 | 0 | 2,444 |
22,158,395 | 2014-03-03T22:00:00.000 | 2 | 0 | 0 | 0 | python,animation,matplotlib | 22,512,378 | 1 | false | 0 | 0 | I think you are right, although it is simple to go from a list to a function (just iterate over it) or back (store function values in an array).
So it really doesn't matter too much, but you can pick the one that best suits your code, as you described.
(Personally I find ArtistAnimation to be the most convenient)
If yo... | 1 | 2 | 1 | So in the examples of matplotlib.animation there are two main functions that are used to make animations: AritstAnimation and FuncAnimation.
According to the documentation the use of each of them is:
.ArtistAnimation:
Before calling this function, all plotting should have taken place and the relevant artists saved.
Fu... | ArtistAnimation vs FuncAnimation matplotlib animation matplotlib.animation | 0.379949 | 0 | 0 | 2,205 |
22,159,215 | 2014-03-03T22:48:00.000 | 5 | 0 | 1 | 0 | python,matplotlib,ipython | 22,161,688 | 3 | true | 0 | 0 | We (IPython) have kind of gone back and forth on the best location for config on Linux. We used to always use ~/.ipython, but then we switched to ~/.config/ipython, which is the XDG-specified location (more correct, for a given value of correct), while still checking both. In IPython 2, we're switching back to ~/.ipyth... | 2 | 1 | 1 | Over time, I have seen IPython (and equivalently matplotlib) using two locations for config files:
~/.ipython/profile_default/
~/.config/ipython/profile_default
which is the right one? Do these packages check both?
In case it matters, I am using Anaconda on OS X and on Linux | IPython & matplotlib config profiles and files | 1.2 | 0 | 0 | 555 |
22,159,215 | 2014-03-03T22:48:00.000 | 2 | 0 | 1 | 0 | python,matplotlib,ipython | 22,161,946 | 3 | false | 0 | 0 | As far as matplotlib is concerned, on OS X the config file (matplotlibrc) will be looked for first in the current directory, then in ~/.matplotlib, and finally in INSTALL/matplotlib/mpl-data/matplotlibrc, where INSTALL is the Python site-packages directory. With a standard install of Python from python.org, this is /Li... | 2 | 1 | 1 | Over time, I have seen IPython (and equivalently matplotlib) using two locations for config files:
~/.ipython/profile_default/
~/.config/ipython/profile_default
which is the right one? Do these packages check both?
In case it matters, I am using Anaconda on OS X and on Linux | IPython & matplotlib config profiles and files | 0.132549 | 0 | 0 | 555 |
22,159,351 | 2014-03-03T22:58:00.000 | 2 | 0 | 1 | 0 | python,text,machine-learning,classification,tf-idf | 22,159,481 | 1 | true | 0 | 0 | First, let's get some terminology clear. A term is a word-like unit in a corpus. A token is a term at a particular location in a particular document. There can be multiple tokens that use the same term. For example, in my answer, there are many tokens that use the term "the". But there is only one term for "the".
... | 1 | 0 | 1 | So I'm making a python class which calculates the tfidf weight of each word in a document. Now in my dataset I have 50 documents. In these documents many words intersect, thus having multiple same word features but with different tfidf weight. So the question is how do I sum up all the weights into one singular weight? | (Text Classification) Handling same words but from different documents [TFIDF ] | 1.2 | 0 | 0 | 722 |
22,159,824 | 2014-03-03T23:32:00.000 | 1 | 1 | 0 | 0 | python,paypal | 22,611,605 | 1 | true | 0 | 0 | At this moment, paying another user via API is not possible via REST APIs, so mass pay/Adaptive payments would be the current existing solution. It is likely that this ability will be part of REST in a future release. | 1 | 1 | 0 | I'm looking into the new paypal REST api.
I want the ability to be able to pay another paypal account, transfer money from my acount to their acount. All the documentation I have seen so far is about charging users.
Is paying someone with the REST api possible? Similar to the function of the mass pay api or adaptive pa... | Paypal REST Api for Paying another paypal account | 1.2 | 0 | 1 | 105 |
22,160,820 | 2014-03-04T00:59:00.000 | 0 | 0 | 0 | 0 | python,file-upload,amazon-web-services,amazon-s3 | 22,162,436 | 2 | false | 1 | 0 | This answer is relevant to .Net as language.
We had such requirement, where we had created an executable. The executable internally called a web method, which validated the app authenticated to upload files to AWS S3 or NOT.
You can do this using a web browser too, but I would not suggest this, if you are targeting big... | 1 | 0 | 0 | I would like for a user, without having to have an Amazon account, to be able to upload mutli-gigabyte files to an S3 bucket of mine.
How can I go about this? I want to enable a user to do this by giving them a key or perhaps through an upload form rather than making a bucket world-writeable obviously.
I'd prefer to ... | user upload to my S3 bucket | 0 | 1 | 0 | 141 |
22,162,538 | 2014-03-04T03:52:00.000 | 0 | 0 | 1 | 0 | python,gevent,greenlets | 31,352,615 | 3 | false | 0 | 0 | I would say that it is a thread safe object then it is not dangerous, but you should always think hard about it. If it isn't thread safe you need to worry about reentrancy of the methods and the consequence of the different object operations not being atomic. Some objects are stateful and they need to complete certai... | 1 | 4 | 0 | Is it safe to pass a multiprocessing object (queue, dictionary, etc...) to multiple gevent threads? Since they're not actually running concurrently, I don't think there's a problem. However, I know that gevent isn't supposed to be specifically compatible with multiprocessing. | Passing a multiprocessing queue/dictionary/etc.. to green threads | 0 | 0 | 0 | 599 |
22,165,086 | 2014-03-04T07:01:00.000 | 0 | 0 | 0 | 0 | python,web-scraping | 22,165,257 | 1 | true | 1 | 0 | robots.txt file does have limits.
Its better to inform the owner of the site if you are crawling too often and read reserved rights at the bottom of the site. It is a good idea to provide a link, to the source of your content. | 1 | 1 | 0 | I am working on creating a web spider in python. Do i have to worry about permissions from any sites for scanning there content? If so, how do i get those? Thanks in advance | Permission to get the source code using spider | 1.2 | 0 | 1 | 43 |
22,165,792 | 2014-03-04T07:41:00.000 | 2 | 0 | 0 | 0 | django,python-social-auth | 22,521,700 | 1 | false | 1 | 0 | remove SOCIAL_AUTH_USER_MODEL because you are using Django Default User model. | 1 | 3 | 0 | I work on django project that migrate from django social auth to python social auth.
Previously new social auth user first name/last name will be saved automatically for first time login.
Now after using python social auth, it's not.
Seems I have to use this setting:
SOCIAL_AUTH_USER_MODEL
but
SOCIAL_AUTH_USER_MODEL ... | Saving user's social auth name using python social auth in django | 0.379949 | 0 | 0 | 1,254 |
22,166,964 | 2014-03-04T08:49:00.000 | 0 | 0 | 1 | 0 | python | 22,167,226 | 3 | false | 0 | 0 | My idea would be to iterate through the list, but to keep three candidates in three variables. Then, as you progress through the list, you substitute them with new values based in order to approach the required value.
For example:
c1 = 1; c2 = 2; c3 = 3; 1+2+3 =/= 8
next element is 4
try to substitute the smallest cand... | 1 | 1 | 0 | Let's say my list is l = [1,2,3,4,5], and x = 8.
I'm thinking that I should iterate through the list using (for i in l:) and check to see if 2 numbers from the list add up to x-i using recursion. But that doesn't seem like the most efficient way to approach the problem.
Can someone show me a better way preferably in ... | Given a list of numbers, what's the most efficient way to find which 3 of them sum up to x? | 0 | 0 | 0 | 190 |
22,169,094 | 2014-03-04T10:19:00.000 | 1 | 0 | 0 | 0 | python,proxy,network-programming | 22,248,982 | 2 | true | 0 | 0 | I guess it's a Microsoft ISA server thing. You would have to get across to the network administrator to be able to have a measure of success in what you're trying to achieve. | 1 | 1 | 0 | How do I bypass very stubborn proxy in a workplace through python. By bypass, I mean I would be able to fill in the username and password and it would allow me access from my python scripts.
I noticed that it's only some selects apps like Web browsers that can pass through and a download-er that I use. My anti-virus ca... | Truely Bypass Stubborn Proxy | 1.2 | 0 | 0 | 103 |
22,169,372 | 2014-03-04T10:30:00.000 | 3 | 0 | 1 | 0 | python,django | 22,169,632 | 2 | true | 1 | 0 | Yes, that is setting the attribute on the class. But no, that would not necessarily make it available between requests, although it might.
Your question shows a misunderstanding of how Django requests work. Django is not necessarily served using multiple threads: in fact, in most server configuration, it is hosted by m... | 1 | 1 | 0 | I am a bit confused over the difference between setting an object's attribute and setting an attribute on an object's __class__ attribute. Roughly, obj.attr vs obj.__class__.attr. What's the difference between them?
Is the former setting an attribute on an instance and the latter setting an attribute on an instance's c... | Setting an attribute on object's __class__ attribute | 1.2 | 0 | 0 | 83 |
22,175,330 | 2014-03-04T14:56:00.000 | 0 | 0 | 1 | 0 | python,recursion,rename | 22,175,762 | 2 | false | 0 | 0 | You can use os.listdir to list the folders and files on some path. This returns a list that you can iterate through. For each list entry, use os.path.join to combine the file/folder name with the parent path and then use os.path.isdir to check if it is a folder. If it is a folder then check the last character's vali... | 1 | 1 | 0 | We just switched over our storage server to a new file system. The old file system allowed users to name folders with a period or space at the end. The new system considers this an illegal character. How can I write a python script to recursively loop through all directories and rename and folder that has a period or s... | recursive script to rename folders ending with a space or period | 0 | 0 | 0 | 457 |
22,175,349 | 2014-03-04T14:56:00.000 | 0 | 1 | 0 | 1 | python,bash,shell,emacs,ipython | 22,208,324 | 2 | false | 0 | 0 | After running your /etc/university/env.sh, start Emacs from this shell.
Then the variables set before are known. | 1 | 1 | 0 | I'm working for a university and they have their own libraries and paths for python libraries. Every time I start ipython, I need to run a shell script (e.g. /etc/university/env.sh)
The problem is that emacs doesn't recognize the env.sh file. When I do py-shell, emacs always envokes Python WITHOUT any pre-set environme... | how to load shell environment variables when Emacs starts py-shell? | 0 | 0 | 0 | 392 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.