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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
19,383,989 | 2013-10-15T14:37:00.000 | 0 | 0 | 0 | 0 | python,django,macos | 39,356,674 | 1 | true | 1 | 0 | I figured out the problem. Its the way I installed django in my system. Previously I used sudo easy_install , but this time I created a virtual env and installed django with pip and it worked well. Virtual environment is the best solution for package installation in python. It wont mess with system packages. | 1 | 0 | 0 | I installed Django 1.5.4 on my MAC OSX 10.6.8. I created a test project.
And I am unable to edit any of those files, it says read only. I can sudo it and do the modifications.
But what are the other files it may try to access during run time, if they are read only then my application is not working, for example: sqlite... | Django and file permissions problems | 1.2 | 0 | 0 | 125 |
19,386,254 | 2013-10-15T16:24:00.000 | 2 | 0 | 1 | 0 | ipython,julia,ijulia-notebook | 19,387,317 | 1 | true | 0 | 0 | Probably just a caching issue of the logo. Try executing some code to see if the kernel is actually python or Julia. IJulia notebook is actually an IPython notebook, but which talk to Julia in the back. | 1 | 4 | 0 | How can I use IJulia in my browser?
When I start to open it by executing ipython notebook --profile julia on my Terminal, a new window opens on my browse - however, it is IPython notebook, not IJulia notebook.
Why does it show IPython? For your information, I use Python 2.7.5 and iPython 1.1, and 0.2.0 for Julia. Also,... | Cannot open IJulia; it instead starts IPython | 1.2 | 0 | 0 | 2,547 |
19,393,098 | 2013-10-15T23:54:00.000 | 2 | 1 | 1 | 0 | c++,python,setup.py | 19,427,165 | 1 | false | 0 | 0 | I would recommend to use Make (other other build systems like CMake) for development and setup.py only for the final installation / deployment. I have done similar Python + C++ projects and it works great that way. | 1 | 6 | 0 | I'm developing a python package that contains a C++ extension. When I install the package using the setup.py script or using pip, the C++ source files are all compiled and linked to obtain a single .so library, which can then be imported in the Python source code. During development, I need to make multiple changes to ... | Python C++ extension: compile only modified source files | 0.379949 | 0 | 0 | 702 |
19,393,524 | 2013-10-16T00:50:00.000 | 1 | 0 | 0 | 0 | python,html,parsing,beautifulsoup | 19,393,621 | 1 | true | 1 | 0 | consider this example: http://www.pythonforbeginners.com/python-on-the-web/web-scraping-with-beautifulsoup/ there is line-by-line processing and matching of href(you need td)
additionaly consider: soup.find_all("td", limit=3) | 1 | 1 | 0 | I am parsing an HTML webpage with Python and Beautiful Soup (I am open to other solutions, though). I am wondering if it is possible to parse the file based on a line of HTML, i.e., get the td tag from line3. Is this possible? | Parse HTML by line | 1.2 | 0 | 1 | 378 |
19,394,658 | 2013-10-16T03:19:00.000 | 0 | 0 | 1 | 0 | python,ibm-mq,pymqi | 19,412,440 | 2 | false | 0 | 0 | You can only get messages by MsgID, CorrelID or GroupID. | 1 | 0 | 0 | Using the module pymqi how do you get a message in MQ queue using a parameter, for example "UserIdentifier"? So, I would only get messages from the queue that possess this parameter "UserIdentifier". Thank you for your attention. | Python - PyMQI - Get a message from a queue MQ using parameter | 0 | 0 | 0 | 1,295 |
19,397,436 | 2013-10-16T07:24:00.000 | 0 | 1 | 0 | 0 | c#,ironpython,dynamic-language-runtime | 19,430,707 | 2 | true | 0 | 1 | IronPython will always use BindGetMember and then Invoke the result because that's how Python works - get the attribute from the object, then call it. Your BindGetMember implementation should return another dynamic object that implements BindInvokeMember, which will have the arguments you need. | 1 | 1 | 0 | I have an hybrid c# object, with some instance properties and methods, and I pass it to IronPython. What I want is to syncronize the dispatch to the c# members, both static and dynamics, from Py code.
I implemented the IDynamicMetaObjectProvider on the c# object, and I noticed that when Py invokes the static methods of... | Intercepting method invocation to c# objects | 1.2 | 0 | 0 | 216 |
19,400,489 | 2013-10-16T10:04:00.000 | 0 | 0 | 0 | 0 | python,algorithm | 19,400,758 | 2 | false | 0 | 1 | You can map the 4 vertices on the coordinate axis. Suppose the A(x1, y1),B(x2, y1), C(x1, y2),D(x2, y2) and x1 <= x2 && y1 <= y2, if and only if x1<= x <=x2 and y1 <= y <= y2, the point p(x,y) falls into rectangle ABCD. | 1 | 4 | 0 | In 2D plane, I have a rectangle defined by 4 vertices, A, B, C and D. I now wish to find the integer points (coordinates are integer) that fall into rectangle ABCD.
Before asking, what I did is extremely expensive in computation. Briefly, I was enumerating all the integer points and checked whether that point was in th... | Find integer points within a rectangle in Python? | 0 | 0 | 0 | 1,554 |
19,401,302 | 2013-10-16T10:40:00.000 | -1 | 0 | 0 | 1 | python,python-2.7,redhat,python-2.4 | 32,932,552 | 1 | false | 0 | 0 | This page describes the main key differences between Python 2.4 and Python 2.7:
Multithreading
Python 2.4 : Not available.
Python 2.7: You can use the Python 2.7 threading library. All threads in a request must finish before the request deadline (60 seconds for online requests and 10 minutes for offline).
Concurrent... | 1 | 1 | 0 | I am running SLC5 (RedHat 4 Linux). The distributed Python version is 2.4. I have installed Python 2.7 in addition manually (altinstall).
Running in terminal mode (Runlevel 3), the key mapping in bash and the Python 2.4 interpreter are correct (backspace, key arrows, etc. are working fine). When running the Python 2.7 ... | Keymapping different between Python2.4 and Python2.7 on RedHat | -0.197375 | 0 | 0 | 103 |
19,406,170 | 2013-10-16T14:30:00.000 | 0 | 0 | 0 | 0 | python,django,django-models,django-south | 19,406,368 | 2 | false | 1 | 0 | South will run all the remaining migrations. | 2 | 1 | 0 | I couldn't find a clear cut answer to this via google or the south docs, so i'm posting it here.
I've been using south for a while to manage my django models, however, until now i've always done one migration, pushed to the production server and migrated on there as well. I was wondering, is it possible to do multiple... | Multiple migrations in django south | 0 | 0 | 0 | 117 |
19,406,170 | 2013-10-16T14:30:00.000 | 1 | 0 | 0 | 0 | python,django,django-models,django-south | 19,406,489 | 2 | true | 1 | 0 | South keeps track of the migrations that were done in a history table.
In your production environment database, it will reflect the migrations you have done in there and once you push one or more new migrations and run migrate, it will check your migrations against the history table and do the necessary. | 2 | 1 | 0 | I couldn't find a clear cut answer to this via google or the south docs, so i'm posting it here.
I've been using south for a while to manage my django models, however, until now i've always done one migration, pushed to the production server and migrated on there as well. I was wondering, is it possible to do multiple... | Multiple migrations in django south | 1.2 | 0 | 0 | 117 |
19,406,444 | 2013-10-16T14:42:00.000 | 0 | 1 | 0 | 1 | python,linux,terminal,raspberry-pi | 19,407,980 | 2 | false | 0 | 0 | What are you using to play the streams? Depending on how you boot up the second Raspberry it might not have started some daemons for audio/video playback?!
You should (if you're not already doing) write a log (import logging ;)) and write a logfile which you can track for errors. | 2 | 0 | 0 | Here's a short description of what I have:
I have to raspberry pi's in a local net work. I one of them I have a .py script named watchdog.py that starts a stream and then uses a sshpass command to the other pi to display the video stream.It also has some signaling LEDs a some push buttons for control
the problem is:
... | Run terminal command as startup reacts different from manually (linux raspberry pi) | 0 | 0 | 0 | 631 |
19,406,444 | 2013-10-16T14:42:00.000 | 0 | 1 | 0 | 1 | python,linux,terminal,raspberry-pi | 42,814,929 | 2 | false | 0 | 0 | answer moved from OP's question itself:
I found a way that seems to work so far. instead of running the python script as a service I tried running it as cron job at reboot, and it worked. now it all works straight from reboot and I have Audio and video. | 2 | 0 | 0 | Here's a short description of what I have:
I have to raspberry pi's in a local net work. I one of them I have a .py script named watchdog.py that starts a stream and then uses a sshpass command to the other pi to display the video stream.It also has some signaling LEDs a some push buttons for control
the problem is:
... | Run terminal command as startup reacts different from manually (linux raspberry pi) | 0 | 0 | 0 | 631 |
19,407,901 | 2013-10-16T15:46:00.000 | 0 | 0 | 1 | 0 | python,django,xcode,macos,python-imaging-library | 19,429,549 | 2 | true | 0 | 0 | Solved.
I've just install python by homebrew (not linked) and copy all files from /include to my /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
And all started work properly. | 1 | 1 | 0 | Recently i updated to OSX 10.9 DP.
And PIL stop working properly. Django debug said that "decoder jpeg don't working".
Using stackoverflow answer, i tried to reinstall PIL, but PIL said:
"fatal error: 'Python.h' file not found" when installing.
And again i used stackoverflow to find why this happening, and it said that... | OSX 10.9 and command line tools, PIL | 1.2 | 0 | 0 | 888 |
19,409,095 | 2013-10-16T16:44:00.000 | 1 | 1 | 1 | 0 | python,simulink | 22,297,932 | 1 | true | 0 | 0 | In Matlab simulink, there is block named TCP/IP receive.
after choosing this block, double click on it. You will see number of option regarding type of data that matlab receiving. | 1 | 0 | 0 | I have a Simulink block, accepting TCP/IP connections and reading the incoming data.
The data has to be integers of type int32.
Imagine we have a variable of any integer number in Python.
We can convert the number to a string and send it via a tcp socket. So far no Problem.
But how to convert the number to that kind ... | TCP/IP Message from Python to Simulink | 1.2 | 0 | 0 | 544 |
19,410,823 | 2013-10-16T18:19:00.000 | 0 | 0 | 1 | 0 | python,synchronization | 19,410,884 | 3 | false | 0 | 0 | When you write the config file write it to a temporary file first. When it's done, rename it to the correct name. The rename operation (os.rename) is normally implemented as an atomic operation on Unix systems, Linux and Windows, too, I think, so there will be no risk of the other process trying to read the config whil... | 1 | 1 | 0 | I'm a Python beginner and facing the following : I have a script periodically reading a settings file and doing something according to those settings . I have another script triggered by some UI that writes the settings file with user input values. I use the ConfigParser module to both read and write the file.
I am wo... | Consistent reading and writing a file in python | 0 | 0 | 0 | 2,469 |
19,411,039 | 2013-10-16T18:30:00.000 | 0 | 0 | 0 | 0 | python,push-notification,google-cloud-messaging | 19,411,494 | 1 | true | 1 | 0 | It is possible to send a notification to a single device on which the app is installed. Each device is assigned a registration ID when your app registers to GCM on that device. If you send this registration ID along with some identifier that identifies the user of the app on that device (the professor in your case), yo... | 1 | 0 | 0 | just I want to ask you about GCM technology,I have to use it for my client in his application(college application). So my question : Is it possible to send a message for someone let's say a professor working in that college(Hi Sir, please you have to be present in administration today at 9 Am), of course as I said just... | customed message for a specific person via GCM(google cloud messaging) | 1.2 | 0 | 0 | 84 |
19,411,111 | 2013-10-16T18:34:00.000 | 2 | 0 | 0 | 0 | python,gtk,custom-controls,scrollbar,pygtk | 19,477,901 | 1 | true | 0 | 1 | Most widgets in Gtk do not have scrollbars.
If you want to scroll the entire widget, you have to implement the GtkScrollable interface. Then, you add the widget to a GtkScrolledWindow. The scrolled window has the scrollbars, those GtkScrollbars are linked with GtkAdjustments which are passed to your custom widget throu... | 1 | 0 | 0 | I'm working on a X-plotter like widget that plots incomming data live.
I already searched for an solution to realize a scrolling along the x-axis if the widget has to much values and so they don't fit.
I had the folling approaches to realize it:
derive from a widget that supports scrolling and child widgets and add my... | Python: Creating own Widget with scrollbars | 1.2 | 0 | 0 | 574 |
19,411,652 | 2013-10-16T19:04:00.000 | 0 | 1 | 0 | 0 | php,python | 19,448,302 | 2 | true | 0 | 0 | The problem was the matplotlib backend setting. I changed to 'Agg' and the plot function worked fine. | 1 | 0 | 0 | I want to run Python script from PHP. The script's syntax is good, when I run it from command line it generates an image file next to it. When I run the PHP file (contains Python exec) from command line it generates an image file. It's good. The problem is: when I use browser and run PHP it isn't generate any image fil... | Run Python script from PHP | 1.2 | 0 | 0 | 408 |
19,414,847 | 2013-10-16T22:11:00.000 | 0 | 0 | 1 | 0 | python,floating-point,hex | 19,415,085 | 5 | false | 0 | 0 | Try float.hex(input) if input is already a float. | 1 | 3 | 0 | How to convert floating point number to base-16 numbers, 8 hexadecimal digits per 32-bit FLP number in python?
eg : input = 1.2717441261e+20 output wanted : 3403244E | How to convert floating point number in python? | 0 | 0 | 0 | 10,632 |
19,417,402 | 2013-10-17T02:47:00.000 | 1 | 0 | 0 | 0 | python,django,django-admin | 19,418,721 | 1 | true | 1 | 0 | There is the django.contrib.auth.signals.user_logged_in signal. If you only want to call the function for admin logins check the request against your admin urlconf. | 1 | 0 | 0 | I thought this would be simple thing to figure out but I have not been able find any examples.
I just want to run a function whenever a user logs in to the Django Admin. | Run Function When Loggin To Django Admin | 1.2 | 0 | 0 | 63 |
19,422,749 | 2013-10-17T09:22:00.000 | 0 | 0 | 0 | 0 | python,matplotlib | 19,423,078 | 2 | false | 0 | 0 | my 2 cents:
x^3+y^3+y^2+2xy^2=0
y^2=-x^3-y^3-2xy^2
y^2>0 => -x^3-y^3-2xy^2>0 => x^3+y^3+2xy^2<0 =>
x(x^2+2y^2)+y^3<0 => x(x^2+2y^2)<-y^3 => (x^2+2y^2)<-y^3/x
0<(x^2+2y^2) => 0<-y^3/x => 0>y^3/x =>
(x>0 && y<0) || (x<0 && y>0)
your graph will span across the 2nd and 4th quadrants | 1 | 2 | 1 | I would like to draw the curve a generic cubic function using matplotlib. I want to draw curves that are defined by functions such as: x^3 + y^3 + y^2 + 2xy^2 = 0. Is this possible to do? | how to draw a nonlinear function using matplotlib? | 0 | 0 | 0 | 2,800 |
19,426,810 | 2013-10-17T12:30:00.000 | 1 | 1 | 1 | 0 | c++,python,boost-python | 19,427,479 | 2 | false | 0 | 0 | It sounds like you want to subclass, which would be the other answer provided; however if you are looking to change an objects class on-the-fly, you could use object.__class__ = NewClass -- though this may be considered EVIL in some (probably most) circles. | 1 | 0 | 0 | I've used Boost.Python to expose my class into Python. I want to change this class or override some parts of it in Python as well as what we can do on classes in Python by default. | Expose a class to Python and change it in Python as well | 0.099668 | 0 | 0 | 56 |
19,430,346 | 2013-10-17T15:03:00.000 | 0 | 0 | 1 | 1 | python,pip,setuptools | 56,683,743 | 7 | false | 0 | 0 | This will display the version of your setuptools if it is installed already
$python -c "import sys; import setuptools; print(setuptools.version.__version__)" | 2 | 18 | 0 | I'm writing a quick shell script to make it easier for some of our developers to run Fabric. (I'm also new to Python.) Part of installing Fabric is installing pip, and part of installing pip is installing setuptools.
Is there any easy way to detect if setuptools is already installed? I'd like to make it possible to ... | How can I tell if Python setuptools is installed? | 0 | 0 | 0 | 68,259 |
19,430,346 | 2013-10-17T15:03:00.000 | 0 | 0 | 1 | 1 | python,pip,setuptools | 62,062,115 | 7 | false | 0 | 0 | Depends with the python version installed. you can try "pip list" or "pip3 list" and check for the setuptools and version installed. | 2 | 18 | 0 | I'm writing a quick shell script to make it easier for some of our developers to run Fabric. (I'm also new to Python.) Part of installing Fabric is installing pip, and part of installing pip is installing setuptools.
Is there any easy way to detect if setuptools is already installed? I'd like to make it possible to ... | How can I tell if Python setuptools is installed? | 0 | 0 | 0 | 68,259 |
19,430,713 | 2013-10-17T15:18:00.000 | 1 | 1 | 0 | 0 | python,web,nginx,apache2,webserver | 19,431,028 | 2 | true | 1 | 0 | I would probably go with - Apache2(mod_wsgi) + Nginx(Proxy) . Where Nginx will be serving the static content and directing the dynamic content request to Apache2 server . This will improve the performance of your application . | 1 | 0 | 0 | We want to write our Webapps in Python for High-Traffic use (800 req/sec), but we don't know which Webserver and module are the best one.
We actually think Apache2 + mod_wsgi is a good option, but maybe Apache2 + FastCGI or Nginx + mod_wsgi oder FastCGI could be better.
Any Ideas? | Which Webserver shall i take for High-Traffic Python Web-Pages? | 1.2 | 0 | 0 | 227 |
19,433,585 | 2013-10-17T17:41:00.000 | 0 | 0 | 1 | 0 | python,module,beautifulsoup,ipython-notebook,anaconda | 23,173,707 | 1 | false | 1 | 0 | There are two possible answers to your question. If you have no need for running multiple copies of Python running different modules, you can simply change all instances of the string "Python27" in your PATH to "Anaconda" (assuming you want to run the Anaconda Python) as suggested in the comments.
Alternately, if you ... | 1 | 1 | 0 | When I try and import BeautifulSoup into IPython Notebook I get an error message: ImportError: No module named BeautifulSoup. The package is installed and works perfectly in IDLE. When I check system version, it returns 2.7.5 |Anaconda 1.7.0 (64-bit)| (default, Jul 1 2013, 12:37:52) [MSC v.1500 64 bit (AMD64)]. This w... | Importing Packages in Ipython Notebook | 0 | 0 | 0 | 1,282 |
19,434,458 | 2013-10-17T18:29:00.000 | 0 | 0 | 0 | 0 | google-api,google-apps,google-api-python-client,google-admin-sdk,google-apps-for-education | 19,525,414 | 1 | true | 1 | 0 | You cannot, that's the answer. | 1 | 1 | 0 | This is for users in Google Apps for Business or Education.
Using the Reports API in the Admin SDK I can see when the admin changed another user's password, but I cannot find an API that will tell me when a user has changed their password. I have changed mine twice in the past couple days and it does not come up in Re... | How do I find the time the user changed their password using the Google APIs? | 1.2 | 0 | 1 | 1,254 |
19,436,220 | 2013-10-17T20:06:00.000 | 0 | 0 | 0 | 0 | python,excel,pandas | 41,857,586 | 1 | false | 0 | 0 | It sounds to me like your python code is inserting a carriage return either before or after the value.
I've replicated this behavior in Excel 2016 and can confirm that the cell appears blank, but does contain a value.
Furthermore, I've verified that using the text to columns will parse the carriage return out. | 1 | 2 | 1 | I used the Python Pandas library as a wrap-around instead of using SQL. Everything worked perfectly, except when I open the output excel file, the cells appear blank, but when I click on the cell, I can see the value in the cell above. Additionally, Python and Stata recognize the value in the cell, even though the ey... | Python Pandas Excel Display | 0 | 0 | 0 | 311 |
19,438,160 | 2013-10-17T22:07:00.000 | 2 | 1 | 0 | 1 | python,linux,ubuntu,cron | 19,448,431 | 1 | false | 0 | 0 | The GPL is not anti-commercial. python-crontab can be used in commercial products and services. You must only follow the copy-left rules witch state that the actual code itself can't be made proprietary. You can sell it as much as you like, and as the author I encourage you to make money from my work.
Besides that erro... | 1 | 2 | 0 | I have a Python script that runs in several modes. One of those modes monitors certain files, and if those files have been modified, the script restores them. The way I do this is to run the script every minute via cron.
Another cron job exists (actually the same script called with a different argument) to remove the s... | Modifying a crontab from a cron job | 0.379949 | 0 | 0 | 1,397 |
19,438,580 | 2013-10-17T22:43:00.000 | 1 | 0 | 1 | 1 | python,environment-variables,virtualenv | 20,532,631 | 1 | true | 0 | 0 | I discovered that the reason my virtual environment's environment variables were keeping their previous values was because I was still in the same terminal session. Restarting my terminal fixed the issue. | 1 | 1 | 0 | When I created my virtual environment, it inherited all of the environment variables that were currently on my Windows machine. I have since changed many of those variables, and my virtual environment is now stuck with the old values. How can I change the environment variables within my virtual environment? | Why does my virtualenv inherit the system's old environment variables? | 1.2 | 0 | 0 | 410 |
19,440,448 | 2013-10-18T02:09:00.000 | 0 | 0 | 1 | 0 | python-2.7 | 19,440,477 | 1 | false | 0 | 0 | Dictionary literals are created by the compiler (or rather, the compiler emits bytecode to create them directly). If you want to override this then you'll need to compile the source into into bytecode yourself and then iterate through the bytecode, replacing the dict creation with a bytecode sequence of your choosing. | 1 | 0 | 0 | Can I overload the {} dictionary definition meta-characters/operator for a particular python namespace?
What I am asking is how to (in pure python), replace the type({}) == dict with type({}) == instance && isinstance({}, MyDict) == True.
I have a configuration file in python syntax. I'd the user to be able to define d... | Can I overload the {} dictionary definition meta-characters/operator for a particular python namespace? | 0 | 0 | 0 | 24 |
19,441,031 | 2013-10-18T03:20:00.000 | 2 | 0 | 1 | 0 | python,offline | 19,441,388 | 9 | false | 0 | 0 | Windows Idle - F1 from shell window or editing window gets you a windows help file of all the docs. I think it's better than the online version - it's easier to find stuff. | 3 | 40 | 0 | In python I can get some rudimentary documentation for any object using help(<object>). But to be able to search the documentation, I have to go online. This isn't really helpful if I'm somewhere where the internet isn't accessible.
In R, there is a handy double question mark feature (??<topic>) that allows me to searc... | Search python docs offline? | 0.044415 | 0 | 1 | 17,711 |
19,441,031 | 2013-10-18T03:20:00.000 | 29 | 0 | 1 | 0 | python,offline | 20,266,169 | 9 | false | 0 | 0 | pydoc comes with python and can do searches but only in the synopsis lines of available modules. Quoting pydoc --help:
pydoc -k
Search for a keyword in the synopsis lines of all available modules.
Note that into pydoc you can perform searches using "/". | 3 | 40 | 0 | In python I can get some rudimentary documentation for any object using help(<object>). But to be able to search the documentation, I have to go online. This isn't really helpful if I'm somewhere where the internet isn't accessible.
In R, there is a handy double question mark feature (??<topic>) that allows me to searc... | Search python docs offline? | 1 | 0 | 1 | 17,711 |
19,441,031 | 2013-10-18T03:20:00.000 | 2 | 0 | 1 | 0 | python,offline | 20,134,465 | 9 | false | 0 | 0 | Although there are certainly better documentations built into your computer than help() like windows idle, another option for some of the more common topics would just be to save some of the online documentation to your computer. For the modules you use a lot and want to access offline, you could just download a text f... | 3 | 40 | 0 | In python I can get some rudimentary documentation for any object using help(<object>). But to be able to search the documentation, I have to go online. This isn't really helpful if I'm somewhere where the internet isn't accessible.
In R, there is a handy double question mark feature (??<topic>) that allows me to searc... | Search python docs offline? | 0.044415 | 0 | 1 | 17,711 |
19,445,789 | 2013-10-18T09:10:00.000 | 0 | 0 | 1 | 0 | python,regex,python-2.7 | 19,445,831 | 2 | true | 0 | 0 | Wrap each sub-regexp in (). After the match, you can go through all the groups in the matcher (match.group(index)). The non-empty group will be the one that matched. | 1 | 0 | 0 | I have a multiple regex which combines thousands of different regexes e.g r"reg1|reg2|...".
I'd like to know which one of the regexes gave a match in re.search(r"reg1|reg2|...", text), and I cannot figure how to do it since `re.search(r"reg1|reg2|...", text).re.pattern gives the whole regex.
For example, if my regex i... | Find which part of a multiple regex gave a match | 1.2 | 0 | 0 | 89 |
19,446,500 | 2013-10-18T09:45:00.000 | 10 | 0 | 0 | 0 | django,python-sphinx | 19,479,061 | 1 | true | 1 | 0 | In for sphinx-doc (i have never used django-sphinx) it would never work to run make html inside the build folder. You need to go one folder level up so that the folders build and source ar visible. Most likely you will see the Makefile file here as well.
Try to change directories and run make html again. | 1 | 4 | 0 | I have installed django sphinx for my project.After successful installation and sphinx quickstart operation, i tried for creating html inside the "build" folder using the command "make html" and it gives me the error
"make: * No rule to make target `html'. Stop.".
Any help..Thanks in advance. | Error while executing django sphinx | 1.2 | 0 | 0 | 4,743 |
19,446,843 | 2013-10-18T10:00:00.000 | 1 | 0 | 1 | 0 | python-3.x | 19,446,876 | 2 | false | 0 | 0 | If you are using Python 3.x, you have to do print('hello world').
In Python 2.x, print was a statement, like if, for, etc. Now it is a function, thus the (). | 2 | 0 | 0 | I have just downloaded Python 3.3.2 to use on windows7 and run the msi file to install. After installation I have tried using the prog only to find that every time I run my initial print 'hello world' it keeps reporting a syntax error.
I have tried both single and double quotes but each time reports a syntax. It will ... | Novice with Python | 0.099668 | 0 | 0 | 45 |
19,446,843 | 2013-10-18T10:00:00.000 | 1 | 0 | 1 | 0 | python-3.x | 19,446,883 | 2 | false | 0 | 0 | You're probably using instructions for a python-2 program, where print was a statement, rather than a function. In python >= 3, you have to do print(something), rather than just print something. | 2 | 0 | 0 | I have just downloaded Python 3.3.2 to use on windows7 and run the msi file to install. After installation I have tried using the prog only to find that every time I run my initial print 'hello world' it keeps reporting a syntax error.
I have tried both single and double quotes but each time reports a syntax. It will ... | Novice with Python | 0.099668 | 0 | 0 | 45 |
19,447,427 | 2013-10-18T10:29:00.000 | 1 | 0 | 0 | 0 | python,django,django-templates | 19,448,846 | 4 | false | 1 | 0 | That happens by default, because of Django's autoescaping. You have to specifically mark content as safe before it will be interpreted as HTML. | 3 | 0 | 0 | Is it possible in django to print a string keeping the html tags?
So if I write {{ variable }} the html content inside the variable doesn't get interpreted by the browser as html.
(Really a newbie)
Thanks | Print html tags in Django | 0.049958 | 0 | 0 | 2,731 |
19,447,427 | 2013-10-18T10:29:00.000 | 2 | 0 | 0 | 0 | python,django,django-templates | 19,447,655 | 4 | false | 1 | 0 | You can use the escape filter {{variable|escape}}
Same as php's htmlentities or htmlspecialchars | 3 | 0 | 0 | Is it possible in django to print a string keeping the html tags?
So if I write {{ variable }} the html content inside the variable doesn't get interpreted by the browser as html.
(Really a newbie)
Thanks | Print html tags in Django | 0.099668 | 0 | 0 | 2,731 |
19,447,427 | 2013-10-18T10:29:00.000 | 0 | 0 | 0 | 0 | python,django,django-templates | 61,307,178 | 4 | false | 1 | 0 | You can use the safe filter {{variable|safe}} | 3 | 0 | 0 | Is it possible in django to print a string keeping the html tags?
So if I write {{ variable }} the html content inside the variable doesn't get interpreted by the browser as html.
(Really a newbie)
Thanks | Print html tags in Django | 0 | 0 | 0 | 2,731 |
19,448,553 | 2013-10-18T11:26:00.000 | 0 | 0 | 1 | 1 | python,windows-7,intellij-idea,virtualenv,python-2.6 | 19,448,864 | 2 | false | 0 | 0 | Just install an appropriate python and virtualenv for that python directly on the windows 7 machine. | 2 | 1 | 0 | I have Python application and virtualenv for it. I run it on Debian virtual machine. Is it possible to configure IntelliJ to start application and use IntelliJ debug tools? The problem is how to use virtualenv for debian in Windows 7 system. | IntelliJ IDEA - unix python virtualenv on WIndows | 0 | 0 | 0 | 426 |
19,448,553 | 2013-10-18T11:26:00.000 | 0 | 0 | 1 | 1 | python,windows-7,intellij-idea,virtualenv,python-2.6 | 19,809,928 | 2 | false | 0 | 0 | I solved it. If connect with my virtual machine by remote debug tool. I add one line with IntellJ/PyCharm generate to entry point of paster script. Before debug i run script (using IntelliJ remote tool) with run application on virtual machine. | 2 | 1 | 0 | I have Python application and virtualenv for it. I run it on Debian virtual machine. Is it possible to configure IntelliJ to start application and use IntelliJ debug tools? The problem is how to use virtualenv for debian in Windows 7 system. | IntelliJ IDEA - unix python virtualenv on WIndows | 0 | 0 | 0 | 426 |
19,452,172 | 2013-10-18T14:28:00.000 | 5 | 0 | 0 | 1 | python,google-app-engine | 19,454,685 | 2 | true | 1 | 0 | If you use the ancestor in the key you will create a big entity group (assuming a single root to the tree/hierarchy) which may in fact not be what you want from a write performance point of view. Also a deep hierarchy can mean very big keys.
If you want to move nodes around using ancestor keys, you have to delete an... | 1 | 3 | 0 | I'm trying to store a hierarchy in NDB and I'm confused about if I should use just the 'parent' parameter while constructing the keys to new entities or should I include an extra property in my models to hold the parent key? | Hierarchy in Google App Engine NDB | 1.2 | 0 | 0 | 1,057 |
19,455,782 | 2013-10-18T17:35:00.000 | 5 | 0 | 1 | 0 | python,performance | 19,455,848 | 4 | true | 0 | 0 | Python's regex module does cache the compiled versions of recently-used regexes, so you can probably remove the explicit compiles and not have an issue. | 2 | 2 | 0 | I have a function that iterates over a text file to extract certain information by using regular expressions to find the information. But, the program goes over multiple files and so calls this function several times.
Currently, I have the regular expressions compile as the first steps of the function. But I started ... | Python: Where to compile an RE? | 1.2 | 0 | 0 | 151 |
19,455,782 | 2013-10-18T17:35:00.000 | 0 | 0 | 1 | 0 | python,performance | 19,456,056 | 4 | false | 0 | 0 | There's nothing wrong with having the re's compiled and available as module-level objects. Not that it's always current best practice, but it's what's used in various modules in the stdlib.
To me, using module-level compiled re objects would be preferable to 3.3's caching as the cache relies on an implementation detail... | 2 | 2 | 0 | I have a function that iterates over a text file to extract certain information by using regular expressions to find the information. But, the program goes over multiple files and so calls this function several times.
Currently, I have the regular expressions compile as the first steps of the function. But I started ... | Python: Where to compile an RE? | 0 | 0 | 0 | 151 |
19,458,338 | 2013-10-18T20:17:00.000 | 0 | 0 | 0 | 0 | python,google-bigquery | 19,459,294 | 2 | true | 0 | 0 | Unfortunately, there isn't a way to do this right now, since, as you realized, all results are flattened. | 1 | 1 | 0 | I have a few large hourly upload tables with RECORD fieldtypes. I want to pull select records out of those tables and put them in daily per-customer tables. The trouble I'm running into is that using QUERY to do this seems to flatten the data out.
Is there some way to preserve the nested RECORDs, or do I need to rethin... | Bigquery: how to preserve nested data in derived tables? | 1.2 | 1 | 0 | 234 |
19,460,457 | 2013-10-18T23:18:00.000 | 0 | 0 | 1 | 0 | python | 19,460,500 | 5 | false | 0 | 0 | Take a look pickle Object serialization. With pickle you can serialize your list and then save it to a text file. Later you can 'unpickle' the data from the text file. The data will be unpickled to a list and you can use it again in python. @inspectorG4dget beat me to the answer so take a look at. | 1 | 4 | 0 | I have a list of 16 elements, and each element is another 500 elements long. I would like to write this to a txt file so I no longer have to create the list from a simulation. How can I do this, and then access the list again? | How can I write a list of lists into a txt file? | 0 | 0 | 0 | 6,780 |
19,463,702 | 2013-10-19T07:42:00.000 | 1 | 0 | 0 | 0 | python,django,structure | 19,463,759 | 2 | true | 1 | 0 | If the module is independent from Django, then it should be a standalone Python package, complete with a setup.py to install it. The Django models and webservices that use it can import like any other external dependencies.
If the module depends on you Django app, then it should be inside the app's directory. If it doe... | 1 | 4 | 0 | I'm currently working on a django project. I'm not completly new in django, but have some difficulties figuring out how would be the most 'djangonic' way to organize some files.
I have some classe that compute stuff, and can be used from the manage.py's cli, and by a webservice app. Those computation uses models from m... | Django, project structure | 1.2 | 0 | 0 | 2,336 |
19,465,158 | 2013-10-19T10:44:00.000 | 0 | 0 | 0 | 1 | python,shared-hosting,mezzanine | 21,524,630 | 2 | false | 1 | 0 | Now supporting with Mezzanine 3.x | 1 | 0 | 0 | I'm trying to use Mezzanine cms in a shared hosting at 1and1. I installed a recent python version 3.3.2.
setup works well but when i try to create a project I got the following error message:
~/Mezzanine-1.4.16 > mezzanine-project blog
Traceback (most recent call last):
File "/kunden/homepages/x/dxxxxxxx/htdocs/custo... | Issue creating project with mezzanine - shared hosting | 0 | 0 | 0 | 265 |
19,469,608 | 2013-10-19T18:37:00.000 | 1 | 0 | 1 | 0 | python,memory,logging,exception-handling,out-of-memory | 19,469,698 | 3 | false | 0 | 0 | In general, an out of memory error is likely to be the toughest problem to deal with in your program since you are out of the main resource that would let you do anything. Perhaps the program could be run in a script that detects the failure from the output and logs it.
You could try using some memory whose sole purpos... | 1 | 5 | 0 | As part of one of my programs, I want to catch any MemoryError and log them. Currently, I'm using traceback.format_exception to format all other exceptions; I would like to do that for MemoryError as well.
However, using format_exception requires using more memory, which is exactly what I cannot do when I'm out of mem... | How to log a python MemoryError (when I'm out of memory) | 0.066568 | 0 | 0 | 3,532 |
19,470,798 | 2013-10-19T20:28:00.000 | 1 | 0 | 0 | 0 | c#,python,sockets | 19,470,856 | 1 | false | 0 | 0 | Socket addresses are a host and port, not just a host. And different connections from the same host will always have different ports. (I'm assuming TCP, not UDP, here.)
Or, even more simply, you can just compare the file descriptors (or, in Python, the socket objects themselves) instead of their peer addresses.
Meanwhi... | 1 | 1 | 0 | I'm looking to create some kind of a gateway that sits between a server and a client.
The so called gateway is supposed to filter some packets sent by the client and forward 99% of them.
Here are my questions:
Client opens a new socket to the gateway, i open a socket to the server from the gateway and store it in a li... | Sockets packet forwarding | 0.197375 | 0 | 1 | 1,277 |
19,472,177 | 2013-10-19T23:16:00.000 | 0 | 1 | 0 | 0 | python,http,session,login,urllib2 | 19,481,620 | 1 | false | 0 | 0 | As you mentioned yourself, the logged-in state is most of the time determined by validity of specific cookie. You can check if the cookie is still valid by comparing it's expiry time with the current time. Alternatively you can make HEAD request which allows you to get cookies (and other headers) without the need to do... | 1 | 0 | 0 | I wrote a program to login to a website and do some automatic stuff (by making HTTP requests).
Most of these automatic stuff requires the program/session is in logged-in state (if the cookie expires, the program/session can not be considered in logged-in state), so I am implementing a isLoggedIn function to test it.
My... | What is the fastest way to test whether logged in or not when use python to login to a website? | 0 | 0 | 1 | 47 |
19,473,185 | 2013-10-20T02:10:00.000 | 3 | 0 | 1 | 0 | python,variables,if-statement | 60,411,091 | 9 | false | 0 | 0 | All of these are good answers but I think there's more to explain why None is useful.
Imagine you collecting RSVPs to a wedding. You want to record whether each person will attend. If they are attending, you set person.attending = True. If they are not attending you set person.attending = False. If you have not receive... | 1 | 142 | 0 | I have been studying Python, and I read a chapter which describes the None value, but unfortunately this book isn't very clear at some points. I thought that I would find the answer to my question, if I share it there.
I want to know what the None value is and what do you use it for?
And also, I don't get this part of ... | What is a None value? | 0.066568 | 0 | 0 | 208,445 |
19,473,378 | 2013-10-20T02:48:00.000 | 0 | 1 | 0 | 1 | macos,terminal-emulator,python-mode,jedi-vim | 19,501,157 | 1 | false | 0 | 0 | Solved. I have "set paste" and it disabled all user-defined key mappings under insert mode.
It didn't influence GUI macvim since pasted mode was unnecessary for GUI editors. | 1 | 0 | 0 | I want to use python-mode and jedi for autocompletion in Vim for python. However under my environment (vim 7.3 in terminal.app on OSX 10.8), I just cannot have the key-combination work.
I read many related articles and knows that it is because terminal.app interpret as and I tried to use inoremap to change it but it... | How to make work in terminal.app on mac? | 0 | 0 | 0 | 437 |
19,474,693 | 2013-10-20T06:48:00.000 | 0 | 0 | 0 | 0 | python,pandas | 58,662,181 | 3 | false | 0 | 0 | Transpose df, reset index, and transopse again.
df.T.reset_index().T | 1 | 6 | 1 | Is there a reset_index equivalent for the column headings? In other words, if the column names are an MultiIndex, how would I drop one of the levels? | Pandas DataFrame.reset_index for columns | 0 | 0 | 0 | 4,607 |
19,476,982 | 2013-10-20T11:48:00.000 | 2 | 0 | 0 | 1 | python,google-app-engine,app-engine-ndb | 19,514,013 | 1 | true | 0 | 0 | Inside the same transaction you can delete 200 entities/keys in one go.
The 1/second limit (more likely 5/second) should be read as: How often can I start (and commit) an independent transaction on an entity group or x-group. T.i. because each transaction needs a lock on the root element you're commiting. | 1 | 0 | 0 | I'm deciding whether or not to include a "fetch 200/delete 200" routine of a pipeline inside a transaction.
If not included and the request/instance dies abruptly, the fetched entities would be lost.
Since with xg=True, the entity group limit is 5, the 200 entities need to have the same parent to be included in the tra... | Does ndb.delete_multi with all keys from the same parent count as a single update to the entity group? | 1.2 | 0 | 0 | 212 |
19,477,250 | 2013-10-20T12:21:00.000 | 1 | 0 | 1 | 0 | python,image,file | 19,477,441 | 2 | false | 0 | 0 | I'm not going to tell you your code is horrendous. But you could simplify it.
Everything in the try routine could be replaced by a single line:
print 'Space for about', int(totstor*1048576/25), 'standard jpg image files available'
In other words you can print the result of the calculation directly. Let int() take care ... | 1 | 0 | 0 | Someone on here asked a question similar to this, but it got quickly downvoted and closed due to the newbiness of it's nature. So I decided to answer it myself, and for others who want to know how to make this nifty program, because it isn't really such a bad idea. So here goes nothing! | Python Program to tell amount of image files that will fit on a disk/flash drive | 0.099668 | 0 | 0 | 94 |
19,484,981 | 2013-10-21T01:35:00.000 | 2 | 1 | 1 | 0 | python,python-2.7,licensing,gpl | 19,485,013 | 2 | true | 0 | 0 | You have no requirement to say that you modified it at all - your only obligation is to offer the source code to anyone who uses your version.
However the best solution for you, the original authors and future users is probably to have your changes put back into the main source tree, assuming that they would be useful ... | 1 | 1 | 0 | So I created my own modified version of a program with the GPLv3, and it's open source and everything.
My question is how am I supposed to state that I modified it?
Do I just put in a comment saying # Modified by yentup ?
I've tried researching about this topic but I haven't found any directions on how to do so. | Is there a formal way to state modifications of a program covered with GPL? | 1.2 | 0 | 0 | 685 |
19,485,641 | 2013-10-21T03:04:00.000 | 1 | 0 | 0 | 0 | python,random,numpy | 69,479,472 | 4 | false | 0 | 0 | Using the numpy.random.randint function, you generate a list of random numbers, meaning that you can select certain datapoints twice. | 1 | 29 | 1 | I have two numpy arrays x and y, which have length 10,000.
I would like to plot a random subset of 1,000 entries of both x and y.
Is there an easy way to use the lovely, compact random.sample(population, k) on both x and y to select the same corresponding indices? (The y and x vectors are linked by a function y(x) say.... | Python random sample of two arrays, but matching indices | 0.049958 | 0 | 0 | 15,029 |
19,486,708 | 2013-10-21T05:15:00.000 | 0 | 0 | 1 | 0 | python,plugins,notepad++ | 30,208,084 | 4 | false | 0 | 0 | I have met the same error. It is probably because that you have got the wrong download.
For my case, at first I download the file PythonScript_TclTk_1.0.8.0.7z . This is not the right version to be install manually (by copying the extracted zip to the plugin folder of Notepad++). In fact, the structure is completely di... | 3 | 0 | 0 | There is a problem when I try to run Notepad++ with Python Script plugin.
I downloaded the latest versions of both, v6.5 of Notepad++ and v0.92 of Python Script plugin.
However the two reject to work together, throwing the error:
This ANSI plugin is not compatible with your Unicode Notepad++. This
plugin is not com... | Python Script plugin of Notepad++ not working | 0 | 0 | 0 | 5,413 |
19,486,708 | 2013-10-21T05:15:00.000 | 0 | 0 | 1 | 0 | python,plugins,notepad++ | 46,127,087 | 4 | false | 0 | 0 | You might have downloaded the .zip file. Try downloading and installing through .msi installer.
That worked for me. | 3 | 0 | 0 | There is a problem when I try to run Notepad++ with Python Script plugin.
I downloaded the latest versions of both, v6.5 of Notepad++ and v0.92 of Python Script plugin.
However the two reject to work together, throwing the error:
This ANSI plugin is not compatible with your Unicode Notepad++. This
plugin is not com... | Python Script plugin of Notepad++ not working | 0 | 0 | 0 | 5,413 |
19,486,708 | 2013-10-21T05:15:00.000 | 1 | 0 | 1 | 0 | python,plugins,notepad++ | 19,486,931 | 4 | false | 0 | 0 | Three options:
Find a Unicode version of the plug-in
Modify the existing plug-in yourself and ideally share it back.
Use an older version of Notepad++. | 3 | 0 | 0 | There is a problem when I try to run Notepad++ with Python Script plugin.
I downloaded the latest versions of both, v6.5 of Notepad++ and v0.92 of Python Script plugin.
However the two reject to work together, throwing the error:
This ANSI plugin is not compatible with your Unicode Notepad++. This
plugin is not com... | Python Script plugin of Notepad++ not working | 0.049958 | 0 | 0 | 5,413 |
19,487,291 | 2013-10-21T06:06:00.000 | 3 | 0 | 1 | 1 | python,macos,py2app,dmg | 19,920,734 | 2 | true | 0 | 0 | You can use py2app. It makes a standard app. All it needs is a python script and setup.py. | 1 | 1 | 0 | I am making an app in python, which is able to open different file types. This code is running fine on eclipse while passing filename which I want to open and configuration file as arguments respectively selectedFileName=(sys.argv)[1]
cfgFile=(sys.argv)[2]. Now I converted this into application by using py2app. So, the... | How to convert python code (.py) to an app on mac osx | 1.2 | 0 | 0 | 4,091 |
19,492,277 | 2013-10-21T10:39:00.000 | 0 | 0 | 1 | 0 | python,multithreading,qt,thread-safety,pyqt | 19,494,905 | 2 | false | 0 | 1 | There's no point really using Qt/PyQt if your're not using the signal-and-slot mechanism and rolling your own event loop. Basically, you'd be reimplementing the core of the framework itself. But I'm guessing this is not what you're asking about.
It would be nice if you could clarify your question a bit, (because of whi... | 1 | 0 | 0 | Anyone who has worked with Multithreaded PyQt4 apps? I was just wondering if the inbuilt signal/slot mechanism coupled with QtThread of PyQt4 framework has any benefit over the standard Python threads (which are designed in my code to handle the UI components in a thread safe way offcourse) using event driven async cal... | PyQt4: Conventional multithreaded UI over Signal/Slot mechanism? | 0 | 0 | 0 | 257 |
19,497,587 | 2013-10-21T14:43:00.000 | 3 | 0 | 0 | 1 | python,subprocess,stdout,gevent | 19,500,240 | 3 | true | 0 | 0 | I solved this using a little hack. Just flush Pythons line-buffer w/ self.stream.flush() and a helper class whenever a line is written to stdout. | 1 | 5 | 0 | I'm trying to get the stdout of a process via POPEN as soon as it's there.
With gevent 1.0 readline() and read() still block process and wait for process to finish.
Any clues? And yes, I searched high and low for a simple solution. It has to be possible without threading, right? | Get live stdout from gevent-subprocess? | 1.2 | 0 | 0 | 3,089 |
19,498,155 | 2013-10-21T15:07:00.000 | 0 | 0 | 1 | 1 | python,tcl,file-access | 19,499,632 | 1 | false | 0 | 0 | I tested writes and reads with Python and TCL and it looks like python will write when TCL has a file open for reading. TCL can write when python has a file open for reading. | 1 | 1 | 0 | I have to concurrently run TCL and Python scripts which access the same files. I have decided to restrict each program so that they have exclusive write access to exactly one file. Each program has read access to all files (say two programs and two files). I don't care about dirty reads (ie reading a partially finis... | python write to a file that is open for reading by another program (TCL) | 0 | 0 | 0 | 1,515 |
19,499,079 | 2013-10-21T15:48:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine,webapp2 | 19,500,983 | 1 | false | 1 | 0 | A RedirectRoute will issue a HTTP redirect telling the browser to go to the new URL, then the browser will make a new request at that URL.
How this is implemented is that two routes are created - your original route, and one for redirecting.
So, in your case, a route with /do/some/<action:.*>/ would be created that red... | 1 | 1 | 0 | I have a RESTful API like /do/some/<action:.*> so my app with get <action> and run it.
My question is, if I use RedirectRoute and strict_slash=True, will my app keep getting <action> as argument or will it start getting <action>/ (notice the / at the end)?
EDIT: I'm using webapp2 | RedirectRoute in Google App Engine and url arguments | 0.197375 | 0 | 0 | 156 |
19,500,625 | 2013-10-21T17:07:00.000 | 2 | 1 | 1 | 0 | python,django-haystack,whoosh | 19,500,864 | 1 | true | 0 | 0 | I've done this "by hand" before--as it turns out, .(doc|ppt|xls)x files are just zip files which contain .xml files with all of your content. So you can use zipfile and your favorite xml parser to read the contents if you can find no better tool to do it. | 1 | 1 | 0 | I'm looking for a simple way to extract text from excel/word/ppt files. The objective is to index contents in whoosh for search with haystack.
There are some packages like xlrd and pandas that work for excel, but they go way beyond what I need, and I'm not really sure that they will actually just print the cell's unfor... | Extract text from ms office files with python | 1.2 | 1 | 0 | 631 |
19,500,897 | 2013-10-21T17:23:00.000 | 0 | 0 | 0 | 0 | python,django | 19,501,434 | 1 | false | 1 | 0 | The problem lies in the to_upload method, I was getting filename and using it as it came.
The fix was to do: filename = os.path.basename(filename) and use that | 1 | 0 | 0 | I have this custom ModelAdmin that unzips the uploaded file to /tmp and the sets the unzipped file to a FileField in a model doing mymodel.myfilefield = File(open(path_to_file))
The thing is that after doing that the new file is copied to <MEDIA_ROOT>/<upload_to>/tmp/<filename>
And that's not desired. Why is appending ... | Django FileField appending temporary path name to media_root path on save | 0 | 0 | 0 | 343 |
19,501,279 | 2013-10-21T17:46:00.000 | 1 | 0 | 1 | 0 | python,integer,rounding | 19,501,335 | 6 | false | 0 | 0 | I'm not sure whether you want math.floor, math.trunc, or int, but... it's almost certainly one of those functions, and you can probably read the docs and decide more easily than you can explain enough for usb to decide for you. | 1 | 10 | 1 | I will have this random number generated e.g 12.75 or 1.999999999 or 2.65
I want to always round this number down to the nearest integer whole number so 2.65 would be rounded to 2.
Sorry for asking but I couldn't find the answer after numerous searches, thanks :) | How do I ONLY round a number/float down in Python? | 0.033321 | 0 | 0 | 42,133 |
19,503,460 | 2013-10-21T19:52:00.000 | 1 | 0 | 1 | 0 | python,string,file,line | 19,503,478 | 3 | false | 0 | 0 | I think you want \n, rather than /n. | 1 | 1 | 0 | I'm trying to write some text to a file in Python. I use /n to try and create a new line but it just comes out like this in the file which is created:
Player 1 - \nBob - Score - 12 - Goals - 12
I would prefer it if the solution did not contain the os module, thanks.
EDIT: I've just realised this works on one computer a... | How do you write to a new line when writing to a file in Python? | 0.066568 | 0 | 0 | 246 |
19,503,736 | 2013-10-21T20:07:00.000 | 0 | 0 | 1 | 1 | python,pywin32 | 19,503,816 | 2 | false | 0 | 0 | Yes, SetFilePointer is less than obvious. The current file position is also found using SetFilePointer, specify a move method of FILE_CURRENT and a distance of zero. | 1 | 2 | 0 | I am trying to use python to create a tail-like utility that can read from a file that is actively open and being written to in another process. It needs to work on windows so I am having to use the win32file module. I will need to open this file and seek to a previously saved location. I have found the SetFilePointer ... | How can I get the current read position in a win32file file handle? | 0 | 0 | 0 | 1,118 |
19,505,540 | 2013-10-21T21:59:00.000 | 3 | 0 | 1 | 0 | python,audio,pygame | 19,908,356 | 2 | true | 0 | 0 | These are the main differences, as far as I understood it:
Music:
Play one file at once
Queue multiple files in a playlist
Have more control over this one stream: Pause it, rewind it, set endevents
Get more information: Get current position, get endevents
Sound:
Play as many files as you want
Play each file you load... | 1 | 2 | 0 | What are the key differences between the Sound and Music classes in Pygame?
What are the limitations of each?
In what situation would one use one or the other? Is there a benefit to using them in an unintuitive way such as using Sound objects to play music files or visa-versa?
Are there specifically issues with chan... | Difference between Sound and Music | 1.2 | 0 | 0 | 1,652 |
19,507,887 | 2013-10-22T02:12:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine | 19,508,340 | 1 | true | 1 | 0 | Pack more data into an entity, and arrange to not index any fields you're never going to query on. That may interfere with querying your logs, but if writes predominate, pack more into each write, saving writes and index updates. You'll pay for it later when querying, but if queries are infrequent, it may be a net win. | 1 | 0 | 0 | I'm trying to handle remote logging with app engine, but I find just by myself I'm exceeding the daily write limit. Are there any datastore tricks I can use to consume less of my write quota while posting data to the server constantly? | How to avoid hitting App Engines free limits with tons of writes? | 1.2 | 0 | 0 | 49 |
19,509,244 | 2013-10-22T04:54:00.000 | 0 | 0 | 0 | 0 | python-3.x,window,tkinter,multiple-monitors | 19,516,336 | 1 | true | 0 | 1 | Probably not a very portable solution, but what I have seen done in the past is to use absolute positioning (using wxPython, though). So if you have two monitors set at 1024X768 in a side by side setup, the first screen's x would be 0, and the second screen's x would be 1024 (or 768 if I have my x's and y's mixed up ;... | 1 | 1 | 0 | I have a program that opens two separate windows, one of which is full screen. I would like to open the full screen window on the secondary display (this program will require at least 2 screens to be properly functional, but is not enforced) and the other window on the main display.
Is there any way to do this in pytho... | python 3 open window on screen 2 by default (multi displays) | 1.2 | 0 | 0 | 2,170 |
19,509,314 | 2013-10-22T05:00:00.000 | 4 | 0 | 0 | 0 | python,numpy,reshape | 19,510,028 | 1 | false | 0 | 0 | Using reshape is never ambiguous. It doesn't change the memory-layout of the data.
Indexing is always done using the strides determined by the shape.
The right-most axis has stride 1, while the axes to the left have strides given by the product of the sizes to their right.
That means for you: as long as you collect nei... | 1 | 4 | 1 | Basically I want to reshape tensors represented by numpy.ndarray.
For example, I want to do something like this (latex notation)
A_{i,j,k,l,m,n,p} -> A_{i,jk,lm,np}
or
A_{i,j,k,l,m,n,p} -> A_{ij,k,l,m,np}
where A is an ndarray. i,j,k,... denotes the original axes.
so the new axis 2 becomes the "flattened" version of ax... | How to merge specific axes without ambuigity with numpy.ndarray | 0.664037 | 0 | 0 | 802 |
19,509,911 | 2013-10-22T05:47:00.000 | 1 | 1 | 0 | 1 | python | 22,898,338 | 7 | false | 0 | 0 | It's Nautilus's fault. Open Nautilus (the file manager), go to Menu > Preferences.
Select the "Behaviour" section.
On the field titled "Executable text files", select the option "Execute executable text files when opened". | 6 | 2 | 0 | I am trying to make my python script executable without going through the terminal typing like
python test.py
I want to make it able to run when i click on the file.
How i going to do this in my fedora machine. | how to make python script executable when click on the file | 0.028564 | 0 | 0 | 12,507 |
19,509,911 | 2013-10-22T05:47:00.000 | 2 | 1 | 0 | 1 | python | 19,510,082 | 7 | false | 0 | 0 | Add #!/usr/bin/env python at the very beginning of file.
Make chmod u+x filename.py
Change your extension from .py to .sh, so your linux distro's UI will recognize it as shell script and try to execute. | 6 | 2 | 0 | I am trying to make my python script executable without going through the terminal typing like
python test.py
I want to make it able to run when i click on the file.
How i going to do this in my fedora machine. | how to make python script executable when click on the file | 0.057081 | 0 | 0 | 12,507 |
19,509,911 | 2013-10-22T05:47:00.000 | 0 | 1 | 0 | 1 | python | 19,510,040 | 7 | false | 0 | 0 | If you don't have any specific version requirement then using first line as #!/usr/bin/env python will be more efficient and give the execute permission chmod u+x test.py | 6 | 2 | 0 | I am trying to make my python script executable without going through the terminal typing like
python test.py
I want to make it able to run when i click on the file.
How i going to do this in my fedora machine. | how to make python script executable when click on the file | 0 | 0 | 0 | 12,507 |
19,509,911 | 2013-10-22T05:47:00.000 | 5 | 1 | 0 | 1 | python | 19,509,956 | 7 | false | 0 | 0 | Add #!/bin/python as the very first line of your file. Or, if you don't know where your python executable is, type which python in a terminal; then copy the result of that and put it after the #!.
Change the permissions of the file so that its executable chmod u+x test.py
i try but it still open back as gedit
Righ... | 6 | 2 | 0 | I am trying to make my python script executable without going through the terminal typing like
python test.py
I want to make it able to run when i click on the file.
How i going to do this in my fedora machine. | how to make python script executable when click on the file | 0.141893 | 0 | 0 | 12,507 |
19,509,911 | 2013-10-22T05:47:00.000 | 0 | 1 | 0 | 1 | python | 55,925,012 | 7 | false | 0 | 0 | I use raspibian os (Linux)
Add #!/usr/bin/python as the first line of the file.py
right click file >> open with >> chose customize >> custom command line >> type python3
execute file with double click is working | 6 | 2 | 0 | I am trying to make my python script executable without going through the terminal typing like
python test.py
I want to make it able to run when i click on the file.
How i going to do this in my fedora machine. | how to make python script executable when click on the file | 0 | 0 | 0 | 12,507 |
19,509,911 | 2013-10-22T05:47:00.000 | 0 | 1 | 0 | 1 | python | 19,509,975 | 7 | false | 0 | 0 | Add #!/usr/bin/python as the first line of the file and set the permission to executable chmod 755 yourfile. | 6 | 2 | 0 | I am trying to make my python script executable without going through the terminal typing like
python test.py
I want to make it able to run when i click on the file.
How i going to do this in my fedora machine. | how to make python script executable when click on the file | 0 | 0 | 0 | 12,507 |
19,509,950 | 2013-10-22T05:50:00.000 | 1 | 0 | 0 | 0 | python,cursor,pyqt,qlineedit | 19,513,341 | 1 | true | 0 | 1 | It was my mistake. I was trying to use setFocus before i add the widget to the layout.
Now, I used the setFocus method after the wiget is added to the layout and it works fine. | 1 | 0 | 0 | I have a Qlineedit widget which i will use to accept the username. It will be displayed as soon as user launch the application. I want the Qlineedit widget ready for typing (ie, with cursor already in place) without needing the user to use mouse to click on the widget before typing.
I have tried .setFocus() and .set... | Tkinter .focus_set() equivalent in PyQt4 | 1.2 | 0 | 0 | 148 |
19,512,250 | 2013-10-22T08:01:00.000 | 1 | 0 | 0 | 0 | python,infinite-scroll | 19,512,436 | 2 | true | 1 | 0 | Those pages update their html with AJAX. Usually you just need to find the new AJAX requests send by browser, guess the meaning of the AJAX url parameters and fetch the data from the API.
API servers may validate the user agent, referer, cookie, oauth_token ... of the AJAX request, keep an eye on them. | 1 | 1 | 0 | I'm trying to parse the HTML of a page with infinite scrolling. I want to load all of the content so that I can parse it all. I'm using Python. Any hints? | Parse HTML Infinite Scroll | 1.2 | 0 | 1 | 1,165 |
19,513,621 | 2013-10-22T09:11:00.000 | 1 | 0 | 0 | 0 | ipython-notebook | 19,535,347 | 4 | false | 0 | 0 | $ ipython nbconvert ... --to slides (no serve option necessary) create a standalone html file you should be able to mail, or whatever.
The skip/- logic can be applied to pdf generation too, you just have to write your own extended template (which is not that hard, wild guess ~20 lines) | 2 | 2 | 0 | so I am adoring the new IPython notebook slideshow feature, however I could not figure out how to distribute such a slideshow in a userfriendly (I am no HTML/JS guy) way.
My usecase is:
I have a somewhat messy notebook which I want to filter by tagging cells as slides/skip/- etc.
In an optimal world there would be a fi... | Distribute a slideshow from IPython notebook | 0.049958 | 0 | 0 | 2,339 |
19,513,621 | 2013-10-22T09:11:00.000 | 1 | 0 | 0 | 0 | ipython-notebook | 21,978,035 | 4 | false | 0 | 0 | You can print it as a pdf file from Chrome.
Add "?print-pdf" at the end of your URL.e.g: 127.0.0.1:8000/index.html?print-pdf
Select print menu from Chrome.
Select Save As pdf, then print it out. | 2 | 2 | 0 | so I am adoring the new IPython notebook slideshow feature, however I could not figure out how to distribute such a slideshow in a userfriendly (I am no HTML/JS guy) way.
My usecase is:
I have a somewhat messy notebook which I want to filter by tagging cells as slides/skip/- etc.
In an optimal world there would be a fi... | Distribute a slideshow from IPython notebook | 0.049958 | 0 | 0 | 2,339 |
19,521,032 | 2013-10-22T14:42:00.000 | 3 | 0 | 1 | 0 | python,list | 19,521,125 | 3 | false | 0 | 0 | In the slice notation [a:b], the second value (b) is not length, but a upper bound.
To get five elements starting from 44 you should use [44:49] (49 = 44 + 5)
If upper bound is smaller than lower bound, you get empty sequence. | 1 | 9 | 0 | I have a list of unicode values. To the best of my knowledge I can use list[starting location:length to select] to select a range of values from a list, right?
I have a list of 78 unicode values, which are not all unique. When I select a range of 5 values beginning from the 0 position in the list (example: list[0:5])... | Extracting a range of data from a python list | 0.197375 | 0 | 0 | 100,399 |
19,523,680 | 2013-10-22T16:43:00.000 | 14 | 0 | 1 | 0 | python,thread-safety,boto,amazon-dynamodb | 19,542,645 | 1 | true | 0 | 0 | The boto library uses httplib which has never been, and to my knowledge still is not, thread-safe. The workaround is to make sure each thread creates its own connection to DynamoDB and you should be good. | 1 | 13 | 0 | Specifically I'm interested in using a DynamoDB table object from multiple threads (puts, gets, updates, etc). If that's not safe, then is there a safe way (i.e., maybe one table object per thread)? Any other gotchas or tips about working with threads in boto appreciated. | Is boto library thread-safe? | 1.2 | 0 | 1 | 3,394 |
19,524,905 | 2013-10-22T17:50:00.000 | 4 | 0 | 0 | 0 | python,opencv | 19,540,052 | 2 | false | 0 | 0 | I would transform the images to the HSV color space and then compute a histogram of the H values. Then, take the bins with the largest values. | 1 | 3 | 1 | Hi I'm using Opencv and I want to find the n most common colors of an image using x sensitivity. How could I do this? Are there any opencv functions to do this?
Cheers!
*Note: this isn't homework, i'm just using opencv for fun! | Get most common colours in an image using OpenCV | 0.379949 | 0 | 0 | 4,153 |
19,527,097 | 2013-10-22T19:54:00.000 | 2 | 0 | 1 | 0 | python,django,web | 19,527,376 | 2 | true | 1 | 0 | Yes, since the arguments will need to be converted to strings before outputting and that can be a costly operation.
However, using print causes another issue. Some WSGI containers, notably mod_wsgi among them, do not like anything sent to stdout by default and so will raise an exception whenever that happens. You can f... | 1 | 0 | 0 | We are using the python/Django for web development. While development phase wile coding i tends to put print statement a lot places to check the control flow of the code.
And same code with print statement is uploaded for server,
I know logging is a place to be more suitable but i find myself more comfortable with prin... | Does print statement will make performance issue for a website | 1.2 | 0 | 0 | 1,976 |
19,528,277 | 2013-10-22T21:01:00.000 | 0 | 0 | 0 | 0 | python,google-chrome,python-3.x | 19,528,475 | 2 | false | 0 | 0 | The Web server on which the file is hosted sends a header that suggests to the browser how it might handle the file, and the user's preferences hold some sway as well. You likely won't be able to override it easily.
You can avoid this by not using a Web browser from Python. urllib2 or better yet, the third-party reques... | 1 | 0 | 0 | I'm trying to download files using python 3. I use webbrowser.open_new(url) to open file locations. some files are downloaded automatically by chrome's downloader, and some are just opened in a chorme window. How can I choose between the options? | using google chrome's downloader - python 3 | 0 | 0 | 1 | 86 |
19,529,573 | 2013-10-22T22:32:00.000 | 1 | 0 | 0 | 1 | python,zope,grok | 19,538,042 | 1 | false | 0 | 0 | No, the project has not been deprecated.
Like many open source software projects there is a natural cycle in interest and activity, with the only difference being the speed in which the cycle progresses.
Deprecation is an explicit choice by the maintainers; no such choice has been made. It's just that most interest in ... | 1 | 1 | 0 | Since the last version is 1.9, released on 2011, but the documentation only covers from 1.0 to 1.5. Also Windows Installers aren't available. It seems that there's poor activity around the framework, also in the mailing list and IRC channel.
Edited the title because of the confusions. Thanks to everyone for the replies... | Is Grok inactive? | 0.197375 | 0 | 0 | 141 |
19,530,015 | 2013-10-22T23:17:00.000 | -8 | 1 | 0 | 1 | python,linux,ubuntu | 28,650,632 | 5 | false | 0 | 0 | First create the file you want, with any editor like vi r gedit. And save with. Py extension.In that the first line should be
!/usr/bin/env python | 3 | 15 | 0 | I'm new with python, I've been learning for a few weeks. However now I've just changed my OS and I'm now using ubuntu and I can't run any script on my terminal.
I made sure to have the #!/usr/bin/env python
but when I go to the terminal and type, for example python test.py
the terminal shows an error message like this... | How to run python script on terminal (ubuntu)? | -1 | 0 | 0 | 205,865 |
19,530,015 | 2013-10-22T23:17:00.000 | 0 | 1 | 0 | 1 | python,linux,ubuntu | 42,282,440 | 5 | false | 0 | 0 | Save your python file in a spot where you will be able to find it again. Then navigate to that spot using the command line (cd /home/[profile]/spot/you/saved/file) or go to that location with the file browser. If you use the latter, right click and select "Open In Terminal." When the terminal opens, type "sudo chmod +x... | 3 | 15 | 0 | I'm new with python, I've been learning for a few weeks. However now I've just changed my OS and I'm now using ubuntu and I can't run any script on my terminal.
I made sure to have the #!/usr/bin/env python
but when I go to the terminal and type, for example python test.py
the terminal shows an error message like this... | How to run python script on terminal (ubuntu)? | 0 | 0 | 0 | 205,865 |
19,530,015 | 2013-10-22T23:17:00.000 | 0 | 1 | 0 | 1 | python,linux,ubuntu | 61,037,599 | 5 | false | 0 | 0 | Sorry, Im a newbie myself and I had this issue:
./hello.py: line 1: syntax error near unexpected token "Hello World"'
./hello.py: line 1:print("Hello World")'
I added the file header for the python 'deal' as #!/usr/bin/python
Then simple executed the program with './hello.py' | 3 | 15 | 0 | I'm new with python, I've been learning for a few weeks. However now I've just changed my OS and I'm now using ubuntu and I can't run any script on my terminal.
I made sure to have the #!/usr/bin/env python
but when I go to the terminal and type, for example python test.py
the terminal shows an error message like this... | How to run python script on terminal (ubuntu)? | 0 | 0 | 0 | 205,865 |
19,531,480 | 2013-10-23T02:00:00.000 | 0 | 0 | 1 | 0 | python-3.x,compatibility | 20,641,011 | 1 | true | 0 | 0 | I accept the answer from Billy ONeal in the comment above | 1 | 1 | 0 | Something I'm doing works under the latest Windows Python 2 and 3, latest Debian Python 2 and 3, and Cygwin Python 2, but fails under Cygwin Python 3.2.3. Known bug fixes after 3.2.3 on Windows deal with the problem.
Where does that realistically leave me concerning deployment, if the latest version using traditional ... | When Python 3.2.3 isn't good enough | 1.2 | 0 | 0 | 75 |
19,532,159 | 2013-10-23T03:18:00.000 | 1 | 0 | 0 | 0 | python,sqlite,csv | 19,532,207 | 3 | false | 0 | 0 | I would write all the lines to one file. For 10,000 lines it's probably not worthwhile, but you can pad all the lines to the same length - say 1000 bytes.
Then it's easy to seek to the nth line, just multiply n by the line length | 1 | 0 | 1 | baseline - I have CSV data with 10,000 entries. I save this as 1 csv file and load it all at once.
alternative - I have CSV data with 10,000 entries. I save this as 10,000 CSV files and load it individually.
Approximately how much more inefficient is this computationally. I'm not hugely interested in memory concerns.... | Most efficient way to store data on drive | 0.066568 | 0 | 0 | 1,356 |
19,532,445 | 2013-10-23T03:51:00.000 | 0 | 0 | 0 | 1 | python,celery,zeromq,pyinstaller,pyro | 20,719,307 | 1 | true | 0 | 0 | if the individual tasks dont need to communicate to other tasks then use Celery, otherwise Pyro as it allows communication between tasks/objects running parallely on worker nodes. | 1 | 0 | 0 | Hi Everyone,
I have been developing with python for about a year. Now i have a need to develop distributed applications which communicate with each other.
I do not have an idea which modulue will be the best to learn, so i need your help and advise on this.
My app needs are,
Client Server must be able to ... | Distributed Networked Applications (Python, Celery, 0MQ, etc) | 1.2 | 0 | 0 | 299 |
19,533,736 | 2013-10-23T05:47:00.000 | 2 | 0 | 0 | 0 | python,flask | 19,535,937 | 2 | true | 1 | 0 | Redirect with parameter: you set parameter for page1 link/form on page2 and if parameter set for page1 then show message. Good solution.
Redirect with special route: you have special route for page1 redirection from page2. It's similar to parameter.
Redirect with referer: you check http referer header to page2 for page... | 1 | 0 | 0 | I have a use case where, when page2 redirects user to page1, page 1 is supposed to show a flash message (e..g Your order was successfully placed). When a user visits page1 directly without being redirected from page2, I don't show any flash messages.
What is the best way to send flash_message from page2 to page1 while ... | Passing flash messages in flask framework | 1.2 | 0 | 0 | 4,516 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.