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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
31,927,271 | 2015-08-10T19:09:00.000 | 3 | 0 | 1 | 0 | python,whitespace,pycharm | 31,929,112 | 2 | true | 0 | 0 | There are two more settings you might want to check:
Preferences > Editor > General > Other > Strip trailing spaces on Save
Preferences > Editor > Code style > Python > Tabs and Spaces > Use tab character | 1 | 2 | 0 | I am having an issue with Pycharm where certain files tracked by git will show up as having been modified when I haven't done anything but visit the file. Usually the modifications are tabs being changed to spaces or vice-versa, or tabs being added to/removed from empty lines. Once this kind of modification is made, I ... | Pycharm converts whitespace and won't convert back | 1.2 | 0 | 0 | 1,902 |
31,929,287 | 2015-08-10T21:13:00.000 | 0 | 0 | 0 | 0 | python,django,django-models,django-orm | 43,764,100 | 2 | false | 1 | 0 | When you make an insert with another thread, the database blocks another insert transaction as long as there is conflict by a constraint (primary key, unique index, etc.) | 2 | 0 | 0 | Can you use Django's select_for_update to lock a row that doesn't exist yet to lock that row from other threads reading it while you create and then save a model? | Django select_for_update when row doesn't exist yet | 0 | 0 | 0 | 469 |
31,929,287 | 2015-08-10T21:13:00.000 | 1 | 0 | 0 | 0 | python,django,django-models,django-orm | 32,100,507 | 2 | true | 1 | 0 | Answer: no, you cannot do that. | 2 | 0 | 0 | Can you use Django's select_for_update to lock a row that doesn't exist yet to lock that row from other threads reading it while you create and then save a model? | Django select_for_update when row doesn't exist yet | 1.2 | 0 | 0 | 469 |
31,929,458 | 2015-08-10T21:25:00.000 | 0 | 0 | 1 | 0 | python | 60,053,041 | 2 | false | 0 | 0 | extract all the details you need using ezdxf library.
using matplotlib library plot them as graph using matplotlib commands.
save the file as you need using same matplotlib library. | 1 | 1 | 0 | Do you know good library (write on python) for converting dxf files to bmp?
I have a folder with "filename_number" dxf files.
I want read it and convert it to bmp. Also I want keep file's dimension size. | Convert dxf to bmp write on python | 0 | 0 | 0 | 3,100 |
31,930,351 | 2015-08-10T22:40:00.000 | 1 | 0 | 1 | 0 | python,python-3.x,numbers,boolean,zero | 31,930,392 | 3 | false | 0 | 0 | From all integers, 0 is the only one that is evaluated to False. In fact, False's value is 0 (you can try print False + 0) - so you get the second expression's result (X % Y == Z which is True/False).
Any other integer and the first argument is what is returned (int) since and stops and returns the first expression fal... | 1 | 2 | 0 | Hey my question is pretty basic, while I was playing around in the expresssion
3 and 3%3 == False returns True
BUT
0 and 0%3 == False returns 0
With other numbers instead of 0 the result is either True or False but never 0.
I wanted to know what does make 0 so special. | Exception with 0 in comparison | 0.066568 | 0 | 0 | 49 |
31,930,634 | 2015-08-10T23:11:00.000 | 0 | 1 | 0 | 0 | python,python-2.7,arduino,arduino-yun | 31,950,208 | 1 | false | 0 | 0 | In a Python script, you can give yourself messages like this: print("var x = {0}; y = {1}".format(x, y))
Run python path/to/file.py (while SSH'ed) to access the server w/real-time logs.
If the server is already running, you can do ps | grep python then kill XXXX for the running process, then run the above instruction a... | 1 | 0 | 0 | How can you:
Print debugging messages from a Python script?
Access those messages in real-time on a remote device (Arduino Yun) you're SSH'ed into?
So far, I've been making changes, copying them to the Yun, restarting it, and doing all this without the benefit of debugging. (I have to test on the Yun itself.) | How to debug Python on Arduino Yun | 0 | 0 | 0 | 152 |
31,931,087 | 2015-08-11T00:04:00.000 | 1 | 0 | 1 | 1 | linux,python-2.7,build,compilation,mod-wsgi | 31,931,647 | 1 | false | 0 | 0 | I'll document this here as the fix, also to hopefully get a comment from Graham as to why this might be needed;
Changing
make
to
LD_RUN_PATH=/usr/local/lib make
was the answer, but i had to use this for building both python2.7.10 and mod_wsgi. Without using LD_RUN_PATH on mod_wsgi I still got the dreaded;
[warn] mod_... | 1 | 2 | 0 | System : SMEServer 8.1 (CentOS 5.10) 64bit, system python is 2.4.3
There is an alt python at /usr/local/bin/python2.7 (2.7.3) which was built some time ago.
Goal : build python2.7.10, mod_wsgi, django. First step is python 2.7.10 to replace the (older and broken) 2.7.3
What happens:
When i build the latest 2.7 python a... | "make" builds wrong python version | 0.197375 | 0 | 0 | 364 |
31,932,218 | 2015-08-11T02:25:00.000 | 3 | 0 | 0 | 0 | python,django,heroku | 31,932,292 | 2 | false | 1 | 0 | To my knowledge you can not get an ip for a heroku application. You could create a proxy with a known ip that serves as a middleman for the application. Otherwise you might want to look at whether heroku is still the correct solution for you | 1 | 18 | 0 | So in my django application, i'm running a task that will request from an api some data in the form of json.
in order for me to get this data, i need to give the IP address of where the requests are going to come from (my heroku app)
how do i get the ip address in which my heroku application will request at | what is the IP address of my heroku application | 0.291313 | 0 | 0 | 40,929 |
31,938,658 | 2015-08-11T09:56:00.000 | 0 | 1 | 0 | 0 | python,instagram | 55,689,785 | 10 | false | 0 | 0 | It's a bit heavy, but you can use Selenium and do a bot on your browser. You can even make automatic clicks on the window if you don't want to read web codes. | 2 | 7 | 0 | Ok so I know nothing about programming with python yet but I have wanted to make a bot to post to instagram for a while so thought it would be a good way to 'hit the ground running'.
I dont have a specific time frame so no rush.
I don't know any programming languages yet but have wanted to branch out since I use a GU... | Making an instagram posting bot with python? | 0 | 0 | 1 | 36,619 |
31,938,658 | 2015-08-11T09:56:00.000 | 6 | 1 | 0 | 0 | python,instagram | 31,963,001 | 10 | false | 0 | 0 | You should note that while you can follow and unfollow users and like and unlike media. you CAN NOT post to Instagram using their API. | 2 | 7 | 0 | Ok so I know nothing about programming with python yet but I have wanted to make a bot to post to instagram for a while so thought it would be a good way to 'hit the ground running'.
I dont have a specific time frame so no rush.
I don't know any programming languages yet but have wanted to branch out since I use a GU... | Making an instagram posting bot with python? | 1 | 0 | 1 | 36,619 |
31,939,714 | 2015-08-11T10:48:00.000 | 0 | 0 | 0 | 0 | python,django,django-admin,virtualenv | 56,271,468 | 4 | false | 1 | 0 | I had the same problem. Could be related to your zsh/bash settings.
I realized that using zsh (my default) I would get django-admin version 1.11 despite the Django version was 2.1! When I tried the same thing with bash I would get django-admin version 2.1 (the correct version). Certainly a misconfiguration.
So, I stron... | 2 | 1 | 0 | I've created a n new directory, a virtualenv and installed a django-toolbelt inside it. The django-version should be 1.8 but when I call 'django-admin.py version' it says 1.6. So when I start a new project it creates a 1.6. I thought virtualenv was supposed to prevent this. What am I doing wrong?
Edit: I think it has t... | Django-admin creates wrong django version inside virtualenv | 0 | 0 | 0 | 1,969 |
31,939,714 | 2015-08-11T10:48:00.000 | 3 | 0 | 0 | 0 | python,django,django-admin,virtualenv | 47,748,881 | 4 | false | 1 | 0 | I came across this problem too. In the official document, I found that, in a virtual environment, if you use the command 'django-admin', it would search from PATH usually in '/usr/local/bin'(Linux) to find 'django-admin.py' which is a symlink to another version of django. This is the reason of what happened finally.
... | 2 | 1 | 0 | I've created a n new directory, a virtualenv and installed a django-toolbelt inside it. The django-version should be 1.8 but when I call 'django-admin.py version' it says 1.6. So when I start a new project it creates a 1.6. I thought virtualenv was supposed to prevent this. What am I doing wrong?
Edit: I think it has t... | Django-admin creates wrong django version inside virtualenv | 0.148885 | 0 | 0 | 1,969 |
31,941,685 | 2015-08-11T12:23:00.000 | 0 | 0 | 1 | 1 | python,python-2.7,python-3.4,anaconda | 31,965,393 | 1 | false | 0 | 0 | I think I can answer my own question. Python 2.7 seems to be the default. If I activate 3.x with
source activate py3k
I need to reboot to go back to 2.7, which, being the default, happens automatically.
If anyone knows a cleaner way, please let me know. | 1 | 0 | 0 | I do most of my work in Python 2.7, but I've recently encountered some tutorials that require 3.4. Fine. I checked and Anaconda allows installation of both under Linux (Fedora 22 to be precise). However, now I seem to be stuck in 3.4. I followed the Anaconda directions, entering:
conda create -n py3k python=3 anac... | linux switch between ananconda python 3.4 and 2.7 | 0 | 0 | 0 | 259 |
31,942,911 | 2015-08-11T13:18:00.000 | 1 | 0 | 0 | 0 | python,ckan | 32,591,030 | 1 | true | 0 | 0 | I'm not aware of any extensions that do this.
You could write one to add this info in a dataset extra field. You may wish to store it as JSON and record the ratings given by each user.
Alternatively you could try the rating_create API function - this is old functionality which has no UI, but it may just do what you wan... | 1 | 0 | 1 | I have used ckanext-qa but its seems its not as per my requirement I am looking for extension by which Logged in user can be able to rate form 1 to 5 for each dataset over ckan.
Anybody have an idea how to do like that | How to show star rating on ckan for datasets | 1.2 | 0 | 0 | 261 |
31,943,483 | 2015-08-11T13:43:00.000 | 0 | 0 | 1 | 0 | python,pip | 31,943,943 | 3 | false | 0 | 0 | @Simeon Visser's answer is a good way to deal with that. Mine is to build my python project with buildout. | 2 | 6 | 0 | I have a project with multiple dependencies installed using virtualenv and pip. I want to run my project on a server which does not have pip installed. Unfortunately, installing pip is not an option.
Is there a way to export my required packages and bundle them with my project? What is the common approach in this situa... | Export pip packages | 0 | 0 | 0 | 6,027 |
31,943,483 | 2015-08-11T13:43:00.000 | 0 | 0 | 1 | 0 | python,pip | 31,944,991 | 3 | false | 0 | 0 | This may be outside of scope of the question, but if your need is deploying applications to servers with their dependencies, have a look at virtualization and linux containers.
It is by far the most used solution to this problem, and will work with any type of application (python or not), and it is lightweight (the per... | 2 | 6 | 0 | I have a project with multiple dependencies installed using virtualenv and pip. I want to run my project on a server which does not have pip installed. Unfortunately, installing pip is not an option.
Is there a way to export my required packages and bundle them with my project? What is the common approach in this situa... | Export pip packages | 0 | 0 | 0 | 6,027 |
31,944,799 | 2015-08-11T14:37:00.000 | 3 | 0 | 0 | 0 | python,machine-learning,scikit-learn,svm | 31,945,716 | 1 | true | 0 | 0 | Using class weighting has nothing to do w linear/non-linear kernel. It simply controls the cost of missclassifing particular sample during training. Per-class weight simply put constant weight on each sample in a given class. When you use auto, classes samples gets weightes invertibly proportional to the class size. So... | 1 | 2 | 1 | I'm using Scikit-learn SVM classifier to make predictions and i'm using a rbf kernel. I have set the class_weight = 'auto'. Am I right in thinking that classes that appear more often will get lower weights? Say I had two classes, A and B. If A appeared a lot more than B does that mean that later on when making the pred... | How does one interpret class weight when working with non linear SVMs? | 1.2 | 0 | 0 | 847 |
31,949,312 | 2015-08-11T18:26:00.000 | 1 | 0 | 0 | 0 | python,sql,sql-server,ms-access,pandas | 31,949,357 | 3 | false | 0 | 0 | use sql server import export module to convert, but you will need table structure ready in sql server or there may be many other utilities | 1 | 0 | 0 | Let's say I have the following Microsoft Access Database: random.mdb.
The main thing I'm trying to achieve is to use read_sql() from pandas so that I can work with the data I have using python. How would I approach this? Is there a way to convert the Microsoft Access database to a SQL database... to eventually pass in ... | How to convert a Microsoft Access Database to a SQL database (and then open it with pandas)? | 0.066568 | 1 | 0 | 2,680 |
31,950,928 | 2015-08-11T20:02:00.000 | 0 | 0 | 1 | 0 | python,multithreading,csv,plot,real-time | 31,951,440 | 1 | false | 0 | 0 | Short answer: it depends on your use case.
If you simply want a static graph that updates in real time, then your approach is totally fine.
On the other hand, threading is useful when the user needs to somehow interact with the plot (like zoom in/out, etc) because otherwise I/O operations would block the main routine ... | 1 | 0 | 1 | In python, is it necessary to use threading when plotting in real time? In my specific case, I wish to continuously plot from a .csv that is having lines of data added to it indefinitely. Can't I just create a function that re-reads the data source with every iteration of the plot update? | Plotting in real time | 0 | 0 | 0 | 82 |
31,951,980 | 2015-08-11T21:08:00.000 | 127 | 0 | 1 | 0 | python,numpy,statistics,exp | 31,952,102 | 3 | false | 0 | 0 | The exponential function is e^x where e is a mathematical constant called Euler's number, approximately 2.718281. This value has a close mathematical relationship with pi and the slope of the curve e^x is equal to its value at every point. np.exp() calculates e^x for each value of x in your input array. | 2 | 120 | 1 | I'm very confused as to what np.exp() actually does. In the documentation it says that it: "Calculates the exponential of all elements in the input array." I'm confused as to what exactly this means. Could someone give me more information to what it actually does? | What exactly does numpy.exp() do? | 1 | 0 | 0 | 221,837 |
31,951,980 | 2015-08-11T21:08:00.000 | 62 | 0 | 1 | 0 | python,numpy,statistics,exp | 31,952,092 | 3 | false | 0 | 0 | It calculates ex for each x in your list where e is Euler's number (approximately 2.718). In other words, np.exp(range(5)) is similar to [math.e**x for x in range(5)]. | 2 | 120 | 1 | I'm very confused as to what np.exp() actually does. In the documentation it says that it: "Calculates the exponential of all elements in the input array." I'm confused as to what exactly this means. Could someone give me more information to what it actually does? | What exactly does numpy.exp() do? | 1 | 0 | 0 | 221,837 |
31,952,327 | 2015-08-11T21:31:00.000 | 1 | 0 | 0 | 1 | python,django,batch-processing | 31,952,520 | 1 | true | 1 | 0 | I'm not sure how your celery configuration makes it unstable but sounds like it's still the best fit for your problem. I'm using redis as the queue system and it works better than rabbitmq from my own experience. Maybe you can try it see if it improves things.
Otherwise, just use cron as a driver to run periodic tasks.... | 1 | 1 | 0 | I have a Django app that is intended to be run on Virtualbox VMs on LANs. The basic user will be a savvy IT end-user, not a sysadmin.
Part of that app's job is to connect to external databases on the LAN, run some python batches against those databases and save the results in its local db. The user can then explore t... | what is a robust way to execute long-running tasks/batches under Django? | 1.2 | 0 | 0 | 1,698 |
31,953,873 | 2015-08-11T23:53:00.000 | -2 | 0 | 1 | 0 | python,list,memory | 31,953,907 | 1 | false | 0 | 0 | There would be very, very little overhead. Organize your data in whichever way makes the most semantic sense, and don't worry about performance until it's actually a problem. In this case, it's highly unlikely that it would ever become an issue. | 1 | 2 | 0 | I have a bunch of numbers that I have to organize and am thinking of organizing in lists them by their semantic meaning.
What is the overhead in terms of memory usage of organizing data as
a list of lists versus a single flat list in python?
I.e.
[[x1,y1,v1],[x2,y2,v2], ... , [xn,yn,vn]]
[x1,y1,v1,x2,y2,v2, ... , ... | List of lists vs single list memory usage in Python | -0.379949 | 0 | 0 | 149 |
31,954,303 | 2015-08-12T00:48:00.000 | 3 | 0 | 1 | 0 | python,regex | 31,954,331 | 2 | true | 0 | 0 | Try using ^ and $ to match the whole string:
^[\d\.e\-,]+$
^ matches the beginning of a string, $ the end. | 1 | 0 | 0 | Match 3.14529
Match -255.34
Match 128
Match 1.9e10
Match 123,340.00
Skip 720p
In order to skip the last one, I tried this regex:
([\d\.e\-,])
The criteria is this: If every character in the string is either a digit(\d) or a dot(.) or exponent (e) or negative (-) or a comma(,), match the string, if any other character... | Only match if all characters belong to what is specified | 1.2 | 0 | 0 | 49 |
31,954,968 | 2015-08-12T02:14:00.000 | 2 | 1 | 0 | 1 | python,amazon-web-services,amazon-elastic-beanstalk,pyramid | 31,955,222 | 1 | false | 1 | 0 | Are you committing your changes before deploying?
eb deploy will deploy the HEAD commit.
You can do eb deploy --staged to deploy staged changes. | 1 | 2 | 0 | I'm new to the world of AWS, and I just wrote and deployed a small Pyramid application. I ran into some problems getting set up, but after I got it working, everything seemed to be fine. However, now, my deployments don't seem to be making a difference in the environment (I changed the index.pt file that my root url ro... | why does elastic beanstalk not update? | 0.379949 | 0 | 0 | 2,185 |
31,965,667 | 2015-08-12T12:46:00.000 | -1 | 0 | 1 | 0 | python,ipython,jupyter | 32,162,345 | 3 | false | 0 | 0 | Open any notebook and write:
From IPython.external import mathjax
Then you can read how to install by writing: 'mathjax?' but basically you execute a function 'install_mathjax()'. Haven't tried it though. | 2 | 12 | 0 | I´m using the new Jupyter notebook (neé ipython notebook) and the docs indicate that it renders MathJax from a CDN. I have some situations when outside connections are blocked, so I need to configure a local copy of MathJax for all notebooks. How can I accomplish that? | Local copy of MathJax on a Jupyter notebook | -0.066568 | 0 | 0 | 4,694 |
31,965,667 | 2015-08-12T12:46:00.000 | 9 | 0 | 1 | 0 | python,ipython,jupyter | 34,352,376 | 3 | false | 0 | 0 | On Arch Linux, installing 'community/mathjax' solves the problem. | 2 | 12 | 0 | I´m using the new Jupyter notebook (neé ipython notebook) and the docs indicate that it renders MathJax from a CDN. I have some situations when outside connections are blocked, so I need to configure a local copy of MathJax for all notebooks. How can I accomplish that? | Local copy of MathJax on a Jupyter notebook | 1 | 0 | 0 | 4,694 |
31,967,031 | 2015-08-12T13:43:00.000 | 0 | 0 | 0 | 0 | python,django,dynamic,controller | 31,969,174 | 3 | false | 1 | 0 | One solution is to refactor your one application into multiple applications inside your project. Each would have its own urls.py & views.py. | 1 | 0 | 0 | I have a question regarding Django. I created a site and everything works as it is indented to work. The only problem I have is that first of all my urls.py and views.py files are getting quite bloated (I have one method for every page I have) and that i have for every site one template. I use {% extend basetemplate.ht... | Django: Menu Controller | 0 | 0 | 0 | 101 |
31,973,865 | 2015-08-12T19:32:00.000 | 1 | 0 | 0 | 0 | python,windows,x86,x86-64,kivy | 31,977,726 | 1 | true | 0 | 1 | A lot of windows software is still shipped as 32bit-only, because for some reason compat with obsolete 32bit-windows still matters. Alternatively, 32 and 64bit builds are available.
If you write your source code properly (without any assumptions about being able to store a possibly-64bit type in an int), you can make ... | 1 | 0 | 0 | I'd like build the kivy application which will work on 64bit Windows (and if possible 32bit also).
Is it possible that one app will work on both platforms?
Can I use 32bit system to build 64bit app?
This is probably simple questions, but I've never write code for these systems. | Kivy - build 64bit application on 32bit Windows | 1.2 | 0 | 0 | 302 |
31,974,942 | 2015-08-12T20:38:00.000 | 16 | 0 | 0 | 0 | python,pandas | 36,915,460 | 3 | true | 0 | 0 | This will first sort the series and then plot, ignoring the index of the series:
ts = pd.Series(np.random.randn(100), index=pd.date_range('1/1/2000', periods=100))
ts.sort_values().plot(use_index=False) | 1 | 8 | 1 | Let's say I have a pandas series with numerical values. What's the shortest way to plot the sorted series against an increasing integer index?
The plot should show:
x-axis: 0,1,2,3,4,...
y-axis: the sorted values of the series.
(please notice that I cannot plot it against the series' index, because the index is not nec... | pandas - plot sorted column to increasing integer index | 1.2 | 0 | 0 | 21,421 |
31,975,754 | 2015-08-12T21:30:00.000 | 0 | 0 | 0 | 0 | python,algorithm,api,lda,gensim | 31,977,464 | 2 | false | 0 | 0 | LDA provides for each topic and each word a probability that the topic generates that word. You can try assigning words to topics by just taking the max over all topics of the probability to generate the word. In other words if topic A generates "monkey" with probability 0.01 and topic B generates the word monkey with ... | 1 | 1 | 1 | I'm using the LDA algorithm from the gensim package to find topics in a given text.
I've been asked that the resulting topics will include different words for each topic, E.G If topic A has the word 'monkey' in it then no other topic should include the word 'monkey' in its list.
My thoughts so far: run it multiple time... | gensim LDA: How can i generate topics with different words for each topic? | 0 | 0 | 0 | 925 |
31,976,367 | 2015-08-12T22:19:00.000 | 8 | 0 | 1 | 0 | ipython,ipython-notebook,jupyter | 38,339,195 | 7 | false | 0 | 0 | To complete the list, in Windows (at least Win 7) it is:
System-level: C:\ProgramData\jupyter\kernels
User-level: C:\Users\[username]\AppData\Roaming\jupyter\kernels
There is a folder per env(ironment) under the kernels folder. kernel.json within each subfolder is editable to change display name(s), or other parameter... | 4 | 57 | 0 | I've recently stopped using macports so the kernel.json files I had for various IPython kernels are out of date. I have renamed ~/.ipython and removed ~/.jupyter but kernels launched are failing to start with file not found errors.
More tellingly, when I run jupyter-kernelspec list it still lists all the old kernels I ... | How do I delete/refresh available kernels for IPython/Jupyter notebook v4.0? | 1 | 0 | 0 | 54,941 |
31,976,367 | 2015-08-12T22:19:00.000 | 23 | 0 | 1 | 0 | ipython,ipython-notebook,jupyter | 34,345,798 | 7 | false | 0 | 0 | This is an issue in Linux also if anyone else runs into it. Check the contents of:
~/.local/share/jupyter/kernels/ | 4 | 57 | 0 | I've recently stopped using macports so the kernel.json files I had for various IPython kernels are out of date. I have renamed ~/.ipython and removed ~/.jupyter but kernels launched are failing to start with file not found errors.
More tellingly, when I run jupyter-kernelspec list it still lists all the old kernels I ... | How do I delete/refresh available kernels for IPython/Jupyter notebook v4.0? | 1 | 0 | 0 | 54,941 |
31,976,367 | 2015-08-12T22:19:00.000 | 20 | 0 | 1 | 0 | ipython,ipython-notebook,jupyter | 38,706,165 | 7 | false | 0 | 0 | Running:
jupyter --paths
will list all of the possible locations for everything it uses to run: kernels, extensions, pidfiles, etc. | 4 | 57 | 0 | I've recently stopped using macports so the kernel.json files I had for various IPython kernels are out of date. I have renamed ~/.ipython and removed ~/.jupyter but kernels launched are failing to start with file not found errors.
More tellingly, when I run jupyter-kernelspec list it still lists all the old kernels I ... | How do I delete/refresh available kernels for IPython/Jupyter notebook v4.0? | 1 | 0 | 0 | 54,941 |
31,976,367 | 2015-08-12T22:19:00.000 | 10 | 0 | 1 | 0 | ipython,ipython-notebook,jupyter | 47,762,421 | 7 | false | 0 | 0 | You may run
jupyter kernelspec list in terminal or
!jupyter kernelspec list in a notebook cell
to see a list of available kernels and the locations. | 4 | 57 | 0 | I've recently stopped using macports so the kernel.json files I had for various IPython kernels are out of date. I have renamed ~/.ipython and removed ~/.jupyter but kernels launched are failing to start with file not found errors.
More tellingly, when I run jupyter-kernelspec list it still lists all the old kernels I ... | How do I delete/refresh available kernels for IPython/Jupyter notebook v4.0? | 1 | 0 | 0 | 54,941 |
31,977,138 | 2015-08-12T23:33:00.000 | 1 | 0 | 0 | 0 | python,mysql,django,database,insert | 31,977,326 | 3 | false | 1 | 0 | This is out of django's scope really. Django just translates your python into on INSERT INTO statement. For most performance on the django layer skipping it entirely (by doing sql raw) might be best, even though python processing is pretty fast compared to IO of a sql-database.
You should rather focus on the database. ... | 3 | 2 | 0 | So I've been trying to solve this for a while now and can't seem to find a way to speed up performance of inserts with Django despite the many suggestions and tips found on StackOverflow and many Google searches.
So basically I need to insert a LOT of data records (~2 million) through Django into my MySQL DB, each reco... | Increasing INSERT Performance in Django For Many Records of HUGE Data | 0.066568 | 1 | 0 | 2,130 |
31,977,138 | 2015-08-12T23:33:00.000 | 0 | 0 | 0 | 0 | python,mysql,django,database,insert | 31,977,679 | 3 | false | 1 | 0 | You can also try to delete any index on the tables (and any other constraint), the recreate the indexes and constraints after the insert.
Updating indexes and checking constraints can slow down every insert. | 3 | 2 | 0 | So I've been trying to solve this for a while now and can't seem to find a way to speed up performance of inserts with Django despite the many suggestions and tips found on StackOverflow and many Google searches.
So basically I need to insert a LOT of data records (~2 million) through Django into my MySQL DB, each reco... | Increasing INSERT Performance in Django For Many Records of HUGE Data | 0 | 1 | 0 | 2,130 |
31,977,138 | 2015-08-12T23:33:00.000 | 0 | 0 | 0 | 0 | python,mysql,django,database,insert | 32,000,816 | 3 | true | 1 | 0 | So I found that editing the mysql /etc/mysql/my.cnf file and configuring some of the InnoDB settings significantly increased performance.
I set:
innodb_buffer_pool_size = 9000M 75% of your system RAM
innodb_log_file_size = 2000M 20%-30% of the above value
restarted the mysql server and this cut down 50 inserts fro... | 3 | 2 | 0 | So I've been trying to solve this for a while now and can't seem to find a way to speed up performance of inserts with Django despite the many suggestions and tips found on StackOverflow and many Google searches.
So basically I need to insert a LOT of data records (~2 million) through Django into my MySQL DB, each reco... | Increasing INSERT Performance in Django For Many Records of HUGE Data | 1.2 | 1 | 0 | 2,130 |
31,989,903 | 2015-08-13T13:39:00.000 | 6 | 0 | 0 | 0 | python-3.x,numpy,scipy | 31,990,326 | 2 | true | 0 | 0 | scipy.ndimage.filters.convolve() with a weight: np.full((3, 3, 3), 1.0/27). | 1 | 4 | 1 | I have a 512x512x512 numpy array. Is there any efficient way to perform a mean filter where every array value is substituted by all 3x3x3 local values?
We are seeking somethin similar to scipy.ndimage.filters.median_filter but insted of median with mean. | Local mean filter in numpy | 1.2 | 0 | 0 | 9,128 |
31,995,823 | 2015-08-13T18:29:00.000 | 0 | 0 | 1 | 0 | python-2.7,python-idle | 32,037,700 | 1 | false | 0 | 0 | Yes. There are several ways to start Idle with an edit window.
The General option radio buttons, as you noted.
In console, with python 3.x:
2a. python -m idlelib <filename>
2b. python -m idlelib -e (use -h for all options)
In Windows, right click, select Edit with Idle | 1 | 0 | 0 | I like the basic text formatting of the IDLE editor, but I want to use JupyterQtConsole as my console. Can I specify that I don't want a console started when I invoke IDLE? (or is that what the radio buttons in the General settings of IDLE are meant to do)? | Is there a way to open just the Python IDLE editor (without starting a python console session)? | 0 | 0 | 0 | 40 |
31,996,847 | 2015-08-13T19:28:00.000 | 0 | 0 | 0 | 0 | python,qt,pyqt,pyside | 31,998,434 | 1 | true | 0 | 1 | Sure. The python code will look just like C++ would look, sans syntax adaptations.
No. You can use a QStandardItemModel, or a custom model. In addition, there's no point to creating QLabel delegates for model data, since all standard views handle images and pixmaps available from Qt::DecorationRole. If all you want is ... | 1 | 0 | 0 | I am a newbie with PySide. I have a QGridlayout with QLabel's and I want to add/remove/update QLabel.
Is it possible to create QList of QLabel with PySide similar to Qt in C++? After I populate the QGridlayout with QLabel and I want to dynamically increase/decrease the number of items in QGridlayout.
Is QListWidget/Q... | List of QLabel in PySide/Qt | 1.2 | 0 | 0 | 432 |
32,002,270 | 2015-08-14T04:26:00.000 | 0 | 0 | 0 | 0 | python,django,websocket,tastypie | 32,002,762 | 1 | false | 1 | 0 | You main question, if you should use HTTPS / WSS to increase security can be answered easily: Yes, you should.
The other part of the question, which is a bit hidden, if the API key will be compromised when sent in clear text, depends on how you use the API key. Secure APIs will use a cryptographic hash over the key and... | 1 | 0 | 0 | I'm creating an appstore for robot applications. The setup is as follows:
Robot running Linux and Python
API for appstore running Django Tastypie
Web site with appstore communicating with the API through jQuery
When a user installs an app on the web site, an API call to Django is made. Then I need Django to emit a pu... | Secure Python client & server websockets | 0 | 0 | 0 | 237 |
32,003,889 | 2015-08-14T06:47:00.000 | 0 | 0 | 0 | 0 | python,python-requests | 32,004,454 | 3 | false | 0 | 0 | Ask only the header in case of a 404 or 302 is non sense. Either you get the error and the cost is the same as directly asking the body, or you get no error and need a second request for the body.
So unless the body is really large I would directly ask for the body with a single request. And if it is large, but tranfer... | 3 | 1 | 0 | So I first use requests.head() to download the header. I do some validation(check the status code, check content-type) if that is good I download the body. However I use requests.get() to that, but using .get() not only downloads the body but also the header which I just downloaded. So I don't need to download the head... | Python requests: Anyway to download just the body of a get response? | 0 | 0 | 1 | 1,162 |
32,003,889 | 2015-08-14T06:47:00.000 | 1 | 0 | 0 | 0 | python,python-requests | 32,003,982 | 3 | false | 0 | 0 | No, there's no way. HTTP has the HEAD request, which only gets the header, but there's no request to get only the body.
Don't worry too much about efficiency until you need to; the header usually isn't too big anyway. Either use requests.get() in the first place if the body is small, or else do requests.head() followed... | 3 | 1 | 0 | So I first use requests.head() to download the header. I do some validation(check the status code, check content-type) if that is good I download the body. However I use requests.get() to that, but using .get() not only downloads the body but also the header which I just downloaded. So I don't need to download the head... | Python requests: Anyway to download just the body of a get response? | 0.066568 | 0 | 1 | 1,162 |
32,003,889 | 2015-08-14T06:47:00.000 | 0 | 0 | 0 | 0 | python,python-requests | 32,004,066 | 3 | false | 0 | 0 | You can't! This is not the way HTTP works. If you want to use less traffic you are in the right track all you need is to perform the head requests then check if you wanna get the body. If so use get.
Downloading the HTTP headers twice will not will not cost you (a lot) in performance or traffic and it's necessary. | 3 | 1 | 0 | So I first use requests.head() to download the header. I do some validation(check the status code, check content-type) if that is good I download the body. However I use requests.get() to that, but using .get() not only downloads the body but also the header which I just downloaded. So I don't need to download the head... | Python requests: Anyway to download just the body of a get response? | 0 | 0 | 1 | 1,162 |
32,004,850 | 2015-08-14T07:45:00.000 | 8 | 0 | 1 | 0 | python-2.7 | 32,015,006 | 1 | false | 0 | 0 | Python 2.x and 3.x has binascii built-in. You should have #import binascii at the start of your code if you want to use it. | 1 | 2 | 0 | Hi i am a newbie in python. I have installed python 2.7.10 in windows(64 bit). I tried installing certain packages like binascii and zlib for my program but it is throwing the following error:
Could not find a version that satisfies the requirement binascii (from versions: )
No matching distributions found for binascii... | Unable to download binascii | 1 | 0 | 0 | 11,813 |
32,010,208 | 2015-08-14T12:32:00.000 | 1 | 0 | 0 | 0 | android,pygame,kivy,qpython | 32,010,262 | 1 | false | 0 | 1 | The shell is telling you it cannot find the module named "pygame"
The module "pygame" is either not installed or you have typed the name incorrectly.
Try reinstalling the pygame module | 1 | 0 | 0 | "pygame ImportError: No module named pygame"
I get this on my Android Moto G phone when running a simple QPython script.
I should point out that this script used to work - so I suspect that QPython, Android, pygame, or something has taken an auto upgrade which has gone bad.
I tried to install pygame in the pip console,... | What does this mean?: "pygame ImportError: No module named pygame" | 0.197375 | 0 | 0 | 986 |
32,011,375 | 2015-08-14T13:32:00.000 | 5 | 0 | 0 | 1 | python,django,ssh,server | 32,011,468 | 4 | true | 1 | 0 | Since runserver isn't intended to be ran in production/only for development there is no way to to this built in.
You will need to use a tool like tmux/screen or nohup to keep the process alive, even if the spawning terminal closes. | 1 | 5 | 0 | I haven't yet been able to get Apache working with my Django app, so until I do get it working, I'm using runserver on my Linux server in order to demo the app. The problem is that whenever I close the SSH connection to the server, runserver stops running. How can I keep runserver running when I say put my laptop to sl... | Keep Django runserver alive when SSH is closed | 1.2 | 0 | 0 | 7,057 |
32,013,929 | 2015-08-14T15:46:00.000 | 0 | 0 | 0 | 0 | python,django,visual-studio-2012,pycharm | 32,078,355 | 1 | true | 1 | 0 | I just noticed that my Pycharm configuration is using the loopback ip address 127.0.0.1 while the visual studio configuration is using the all ip 0.0.0.0. Switching my Pycharm configuration to use 0.0.0.0 solved my problem... | 1 | 0 | 0 | I'm trying to connect to my development server (local django runserver) while running from pycharm. I have a custom build of an android app that points to my ip address and the phone is on the same network.
When I use visual studio and python tools to run my django application my phone connects to my PC just fine.
When... | Pycharm Debugging Django runserver- Can't Connect from phone | 1.2 | 0 | 0 | 491 |
32,014,455 | 2015-08-14T16:16:00.000 | 0 | 0 | 0 | 0 | python,django,twitter-bootstrap,web-applications | 32,014,505 | 3 | false | 1 | 0 | Bootstrap are mainly CSS and Javascript files that you can use from your web application html. You can use whatever backend you want with it. | 1 | 1 | 0 | I would like to know what is the exact process to follow when building a web application using bootstrap python and django. Is bootstrap simply a template of HTML and CSS files which should be manipulated. | How can I integrate Bootstrap with Python programming language and the Django framework? | 0 | 0 | 0 | 7,722 |
32,014,889 | 2015-08-14T16:40:00.000 | 5 | 0 | 1 | 0 | python,python-2.7,python-3.x,mime-types,mime | 32,015,920 | 1 | true | 0 | 0 | The extension needs to have a period in front of it. add_type('text/new', '.new') works. | 1 | 3 | 0 | How can I add a new mimetype using the add_type() function in the mimetypes package? Do I need to do something with the python file system? If I try something like: add_type('text/new', 'new') nothing seems to happen. | Python: add a new mimetype | 1.2 | 0 | 0 | 1,640 |
32,015,987 | 2015-08-14T17:52:00.000 | 0 | 0 | 1 | 0 | python,pycharm,ipython-notebook | 32,101,098 | 1 | true | 0 | 0 | I spoke to JetBrains support. This is a known issue with Python 2.7.9 via Anaconda (maybe just with Anaconda in general, they did not specify). They said it will be fixed with the next release, which should be coming out in the next few days. | 1 | 0 | 0 | This is really silly, but it's driving me nuts!
Normally when I run ipython notebook through pycharm, the first time I click on the 'play' button to run a cell, PyCharm asks me if I want to start the kernel. When I say yes, it gives me a nice kernel window that shows me output from commands and errors.
I really like ... | PyCharm: lost ipython kernel window | 1.2 | 0 | 0 | 371 |
32,020,419 | 2015-08-15T00:47:00.000 | 0 | 0 | 1 | 0 | python,macos,bash,pip | 32,027,242 | 2 | false | 0 | 0 | It seems that there are two different kinds of virtualenvs, one of which is compatible with python2 and one of which is compatible with python3. I'm not sure whether there is a way to get one that is compatible with both, but I went ahead and created a new virtualenv using python 3 (python3 -m venv myPython3Env), and h... | 1 | 1 | 0 | In order to not alter the default python installation, I have a virtualenv set up that automatically runs on startup. I've also set up my profile so that unless a virtualenv is running, pip will not run. I've been using python2.x up to now, and have now installed python3 via homebrew. When I attempt to install a new pa... | How to get two versions of Python to coexist within a virtualenv? | 0 | 0 | 0 | 102 |
32,020,502 | 2015-08-15T01:02:00.000 | 1 | 0 | 0 | 0 | python,sql-server,sqlalchemy | 32,419,439 | 1 | false | 0 | 0 | The reason why MSSQL Server was hanging, was not because of the difference between calling execute on the engine or the session, but because a delete was being called on the table, without a commit, and then a subsequent read. | 1 | 1 | 0 | What is the difference between executing raw SQL on the SQLAlchemy engine and the session? Specifically against a MSSQL database.
engine.execute('DELETE FROM MyTable WHERE MyId IN(1, 2, 3)')
versus
session.execute('DELETE FROM MyTable WHERE MyId IN(1, 2, 3)')
I've noticed that executing the SQL on the session, caus... | Executing raw SQL on the SQLAlchemy engine versus a session | 0.197375 | 1 | 0 | 1,516 |
32,020,591 | 2015-08-15T01:19:00.000 | 0 | 0 | 0 | 0 | google-app-engine-python | 32,084,944 | 1 | true | 1 | 0 | moving image and video static file handlers above the main.app fixed the issue | 1 | 0 | 0 | I am new to Google App engine and I am using jinja templates for rendering html.
My HTML page audio and video files and they are not getting rendered. Is there a way to get the images and video file working using jinja? Thanks for you help in advance. | Jinja video and image files | 1.2 | 0 | 0 | 48 |
32,021,975 | 2015-08-15T05:48:00.000 | 1 | 0 | 1 | 0 | python,caffe | 35,031,858 | 1 | false | 0 | 0 | In my opinion, you can write multiple python scripts one for each task.
In each script you can choose whether use CPU or GPU (and GPU device).
Then you can run these multiple scripts at the same time.
But run multiple tasks at one GPU card with slow down the speed severely in my experience. Good luck! | 1 | 3 | 0 | Is it possible to run Caffe in both CPU and GPU mode? I have several Caffe models, but my GPU resources are limited, so that I can't put all models into GPU memory. I want to use e.g. 3 models with GPU mode and 2 models with CPU mode, but set_mode_cpu() and set_mode_gpu() commands just switch the mode for the whole lib... | Python Caffe cpu & gpu mode simultaneously | 0.197375 | 0 | 0 | 1,034 |
32,022,024 | 2015-08-15T05:55:00.000 | 4 | 0 | 0 | 0 | python,django | 32,022,740 | 2 | true | 1 | 0 | If you plan to scale your project, I would suggest moving it to a separate app. Generally speaking, generating PDFs based on an url hit directly is not the best thing to do performance-wise. Generating a PDF file is pretty heavy on you server, so if multiple people do it at the same time, the performance of your system... | 2 | 0 | 0 | I've recently started working with Django. I'm working on an existing Django/Python based site. In particular I'm implementing some functionality to create and display a PDF document when a particular URL is hit. I have an entry in the app's urls file that routes to a function in the views file and the PDF generation ... | Django code organisation | 1.2 | 0 | 0 | 102 |
32,022,024 | 2015-08-15T05:55:00.000 | 2 | 0 | 0 | 0 | python,django | 32,022,118 | 2 | false | 1 | 0 | Yes you can in principle do it in an app (the concept of reusable apps is the basis for their existence)
However not many people do it/not many applications require it. It depends on how/if the functionality will be shared. In other words there must be a real benefit.
The code normally goes in both the view/s and in th... | 2 | 0 | 0 | I've recently started working with Django. I'm working on an existing Django/Python based site. In particular I'm implementing some functionality to create and display a PDF document when a particular URL is hit. I have an entry in the app's urls file that routes to a function in the views file and the PDF generation ... | Django code organisation | 0.197375 | 0 | 0 | 102 |
32,022,971 | 2015-08-15T08:29:00.000 | 3 | 0 | 0 | 1 | python,networking,tcp | 32,023,059 | 1 | true | 0 | 0 | It makes it easier because in essence each byte is numbered this way, letting you generate new sequence ids without having to worry about what higher sequence ids have already been used.
Lets say that transmission of the first 8,224 bytes succeeded, but the next 2 packets need to be resent. Moreover, those last 2 packe... | 1 | 1 | 0 | In a reputable book about Python network programming (not mentioning the title to not make the question thought as an advertisement for the book), explaining TCP, the author wrote:
Instead of using sequential integers (1, 2, 3...) to sequence packets, TCP uses a counter that
counts the number of bytes transmitted. A... | How does TCP packet numbering make it easier for retransmission? | 1.2 | 0 | 0 | 295 |
32,023,586 | 2015-08-15T09:56:00.000 | 7 | 0 | 0 | 1 | linux,sockets,python-3.x,signals | 32,023,977 | 2 | false | 0 | 0 | eof is not a signal but is implemented by the tty driver as a read of length 0 when you type ctrl-d.
If your remote is not running in a tty then you cannot generate an eof as you cannot send a packet that reads as of length 0. However if you run a program like script /dev/null as the first command in your remote shell,... | 1 | 6 | 0 | How to send eof signal, over a socket, to a command running in remote shell?
I've programmed in Python, using sockets, a remote shell application, where I send commands to be executed on another PC.
Everything works fine (for most commands), except a command like cat > file is causing me problems.
Normally, I would te... | How to send `eof` signal, over a socket, to a command running in remote shell? | 1 | 0 | 1 | 4,705 |
32,025,480 | 2015-08-15T14:02:00.000 | 2 | 0 | 0 | 0 | django,ipython | 57,300,254 | 4 | false | 1 | 0 | Check in your models if you don't got a duplicate class model, sometimes when we make a rebase or merge in our existing branches, our code can be duplicated, i had the same problem, isn't a big deal. | 4 | 19 | 0 | Since upgrading Django, I've been getting this error in iPython when I do imports:
RuntimeWarning: Model 'docket.search' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
I'm guessing this is some automatic feature of iPython, but is there an ... | How to fix: "RuntimeWarning: Model was already registered." | 0.099668 | 0 | 0 | 8,104 |
32,025,480 | 2015-08-15T14:02:00.000 | 1 | 0 | 0 | 0 | django,ipython | 64,724,742 | 4 | false | 1 | 0 | It is saying that you have already registered the model before
Hence by deleting the second model or writing the code in the specified model is the solution for this . | 4 | 19 | 0 | Since upgrading Django, I've been getting this error in iPython when I do imports:
RuntimeWarning: Model 'docket.search' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
I'm guessing this is some automatic feature of iPython, but is there an ... | How to fix: "RuntimeWarning: Model was already registered." | 0.049958 | 0 | 0 | 8,104 |
32,025,480 | 2015-08-15T14:02:00.000 | 26 | 0 | 0 | 0 | django,ipython | 57,749,526 | 4 | false | 1 | 0 | Exactly the same problem had happened to me. The problem was that I had defined a model twice! Removing one of them solved the problem. | 4 | 19 | 0 | Since upgrading Django, I've been getting this error in iPython when I do imports:
RuntimeWarning: Model 'docket.search' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
I'm guessing this is some automatic feature of iPython, but is there an ... | How to fix: "RuntimeWarning: Model was already registered." | 1 | 0 | 0 | 8,104 |
32,025,480 | 2015-08-15T14:02:00.000 | 1 | 0 | 0 | 0 | django,ipython | 32,769,570 | 4 | false | 1 | 0 | I have gotten this error because of automatic imports I had in my __init__.py. I had some old code that imported by signals there, and moving that import code to AppConfig instead fixed it. | 4 | 19 | 0 | Since upgrading Django, I've been getting this error in iPython when I do imports:
RuntimeWarning: Model 'docket.search' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
I'm guessing this is some automatic feature of iPython, but is there an ... | How to fix: "RuntimeWarning: Model was already registered." | 0.049958 | 0 | 0 | 8,104 |
32,026,201 | 2015-08-15T15:26:00.000 | 1 | 0 | 0 | 0 | python,beautifulsoup,bs4 | 32,027,116 | 3 | false | 1 | 0 | The way to run a Python program is to type the code into a text file, or use a Python IDE. The error message you are getting suggests that you are typing Python code at the shell prompt; but the shell understanda shell script commands, not Python. (Once you have code in a file, typing python filename.py in the shell wi... | 1 | 4 | 0 | From Beautiful import Beautiful immediately responds with error "from: can't read /var/mail/BeautifulSoup". Also tried with BS4 same result.
Used synaptic package to uninstall and re-install BS4 and BeautifulSoup. Same result. Tried complete removal and had same result. Used Terminal and it showed that BS4 and Beautif... | BS4 and BeautifulSoup error from: can't read /var/mail/BeautifulSoup | 0.066568 | 0 | 0 | 4,920 |
32,027,621 | 2015-08-15T17:57:00.000 | 3 | 1 | 1 | 0 | python,documentation | 32,031,704 | 1 | true | 0 | 0 | When I do similar things, if it is a small class I will put everything in the same class, but if it is bigger, I typically make a class that only contains the fields, and then a subclass of that with functions. Then you can have a docstring for your fields class and a separate docstring for your simulation functions.
... | 1 | 1 | 0 | I am working on a python module that is a convenience wrapper for a c library. A python Simulation class is simply a ctypes structure with a few additional helper functions. Most parameters in Simulation can just be set using the _fields_ variable. I'm wondering how to document these properly. Should I just add it to t... | Documenting ctypes fields | 1.2 | 0 | 0 | 124 |
32,027,844 | 2015-08-15T18:19:00.000 | 0 | 0 | 1 | 0 | python | 32,028,125 | 4 | false | 0 | 0 | I think the best thing to do in your case is just to choose a new file extension for your format.
It obviously doesn't prevent editing, but it clearly states for user that it has some specific format and probably shouldn't be edited manually. And GUI won't open it by default probably (it will ask what to edit it with).... | 2 | 3 | 0 | So I made a python phonebook program which allows the user to add contacts, change contact info, delete contacts, etc. and write this data to a text file which I can read from every time the program is opened again and get existing contact data. However, in my program, I write to the text file in a very specific manner... | How to restrict access of a file from python | 0 | 0 | 0 | 5,801 |
32,027,844 | 2015-08-15T18:19:00.000 | 1 | 0 | 1 | 0 | python | 32,028,141 | 4 | false | 0 | 0 | It is difficult to prevent user access to your data storage completely. However, you can either make it more difficult for the user to access your data or actually make it easier not to break it. In the second case, your intention would be to make it clear to the user what the rules are hope that not destroying the dat... | 2 | 3 | 0 | So I made a python phonebook program which allows the user to add contacts, change contact info, delete contacts, etc. and write this data to a text file which I can read from every time the program is opened again and get existing contact data. However, in my program, I write to the text file in a very specific manner... | How to restrict access of a file from python | 0.049958 | 0 | 0 | 5,801 |
32,028,928 | 2015-08-15T20:13:00.000 | 0 | 0 | 1 | 0 | python,kivy | 32,028,953 | 3 | false | 0 | 1 | Why couldn't you just grab the TextInput.text and convert it using float or int? ie text = TextInput.text for an int.. conversion = int(text) | 1 | 0 | 0 | When using TextInput in Kivy, everything that is entered is kept as a string, even when the input is restricted to characters that represent floats or ints using input_filter. How can TextInput.text be converted into an actual float or int type so that I can do calculations with it? | Kivy: How to convert user input into int or float | 0 | 0 | 0 | 3,422 |
32,029,292 | 2015-08-15T20:58:00.000 | 1 | 0 | 1 | 0 | python,python-2.7,timing | 32,029,346 | 3 | false | 0 | 0 | You should look into using a scheduler like cron. However, if the script is going to run indefinitely, I think time.sleep(36000) is acceptable (or time.sleep(10*60*60)). | 1 | 3 | 0 | I've got a script that I need to run between 7am and 9pm. The script already runs indefinitely but if I am able to maybe pause it outside the above hours then that'd minimize the amount of data it would produce.
I currently use time.sleep(x) in some sections but time.sleep(36000) seems a bit silly?
Using Python 2.7
Tha... | How to run Python script only during certain hours of the day? | 0.066568 | 0 | 0 | 8,028 |
32,029,739 | 2015-08-15T21:51:00.000 | 0 | 0 | 0 | 0 | python,django,django-orm | 32,041,096 | 1 | false | 1 | 0 | You should be able to simply change the app name in the JSON and be fine. | 1 | 0 | 0 | I have this dump.json with data from a Django-project that I'm trying to load (manage.py loaddata) into another project where I've set up the same model/fields etc. The problem is the "app" is not named the same in the two projects. So I get this 'invalid model identifier' -error.
What to do? | Django loaddata and 'invalid model identifier' error | 0 | 0 | 0 | 869 |
32,029,892 | 2015-08-15T22:11:00.000 | 1 | 0 | 1 | 0 | python,pip,canopy | 32,030,058 | 1 | false | 0 | 0 | Installed QSTK using pip while in C:\Users\user\AppData\Local\Enthought\Canopy\User\Lib\site-packages> in the command prompt! | 1 | 0 | 0 | I really like the Canopy environment but unfortunately the package I want to use, QSTK, is not pre-installed and it is not available in its package manager.
Can I use pip to install QSTK for this environment? Or am too naive and about to crash my computer unknowingly?
I found all of the site-packages located in:
C:\Us... | Manually install a package (QSTK) into Canopy Virtual Environment? | 0.197375 | 0 | 0 | 181 |
32,030,932 | 2015-08-16T01:12:00.000 | 0 | 1 | 0 | 0 | php,python,django,web-services | 32,031,097 | 2 | false | 1 | 0 | You could use raw sockets in your Python and php programs to make them communicate through TCP locally.
Make your Python program a TCP server with address 'localhost' and port number, for example, 5555, and then, in your php script, also using sockets, create a client code that sends the to be processed text as a TCP ... | 1 | 0 | 0 | I have a python program. It takes some text from a text file (A) as an input, do some text annotation and stores the annotated text as an output in another file (B). Now, my plan was to make this like a web service.
I could do this using php and calling the python program from php. Specifically, my php code does this-
... | How can I convert a python program into a web service? | 0 | 0 | 0 | 1,455 |
32,040,958 | 2015-08-16T23:31:00.000 | 0 | 0 | 1 | 0 | python,python-2.7,anaconda,nest-simulator | 32,040,989 | 4 | false | 0 | 0 | Turns out I needed to move the directory where I installed nest (Users/name/opt/nest) into a nest folder in the following directory in anaconda. Specifically, I moved the contents of the folder (from the nest installation):
/Users/name/opt/nest/lib/python2.7/site-packages/nest
Into this one:
/anaconda/lib/python2.7/... | 1 | 2 | 0 | After installing the Nest Neural Simulator, I keep getting the following error when trying to run any of the example python files that came in the installation. I've tried re-installing Nest, Python, and using Anaconda, but no go.
Python error:
ImportError: No module named nest
Suggestions? | Nest simulator: python says “no module named nest” | 0 | 0 | 0 | 2,790 |
32,044,338 | 2015-08-17T06:52:00.000 | 1 | 0 | 0 | 0 | python,amazon-web-services,amazon-dynamodb | 32,045,125 | 1 | false | 1 | 0 | Amazon DynamoDB is a NoSQL database, so you won't find standard SQL capabilities like group by and average().
There is, however, the ability to filter results, so you will only receive results that match your criteria. It is then the responsibility of the calling app to perform grouping and aggregations.
It's really a ... | 1 | 0 | 0 | I am new to Dynamodb and have a requirement of grouping the documents on the basis of a certain condition before performing other operations.
From what i could read on the internet, i figured out that there is no direct way to group dynamodb documents.
Can anyone confirm if thats true of help out with a solution if tha... | Does Dynamodb support Groupby/ Aggregations directly? | 0.197375 | 1 | 0 | 582 |
32,057,882 | 2015-08-17T19:07:00.000 | 1 | 1 | 0 | 1 | python,raspberry-pi,gpio,iot,node-red | 54,633,976 | 4 | false | 0 | 0 | I hope you have installed red-node along with Python.
If not, install it using following either in Power shell or CMD:
npm install -g node-red-contrib-python3-function
After starting node-red, you can find pythonshell node in Node Panel of node-red.
Drag and Drop it and double click it to get "node properties" panel,
E... | 3 | 8 | 0 | I'm using Node-Red, hosted on a Raspberry Pi for an IoT project.
How do I trigger a Python script that is on the raspi from Node-Red? I want to run a script that updates the text on an Adafruit LCD shield which is sitting on the Pi
Should I be looking to expose the Python script as a web service somehow?
I'm using a Ra... | How to trigger Python script on Raspberry Pi from Node-Red | 0.049958 | 0 | 0 | 28,176 |
32,057,882 | 2015-08-17T19:07:00.000 | 0 | 1 | 0 | 1 | python,raspberry-pi,gpio,iot,node-red | 71,484,228 | 4 | false | 0 | 0 | I had a similar challenge with a Raspberry pi 4.
I solved it by using an execute node. On the command slot, enter the path of the python script as follows.
sudo python3 /home/pi/my_script.py
Change the script path to yours. Use the inject node to run the script and the debug node to view your output.
Ensure you grant s... | 3 | 8 | 0 | I'm using Node-Red, hosted on a Raspberry Pi for an IoT project.
How do I trigger a Python script that is on the raspi from Node-Red? I want to run a script that updates the text on an Adafruit LCD shield which is sitting on the Pi
Should I be looking to expose the Python script as a web service somehow?
I'm using a Ra... | How to trigger Python script on Raspberry Pi from Node-Red | 0 | 0 | 0 | 28,176 |
32,057,882 | 2015-08-17T19:07:00.000 | 9 | 1 | 0 | 1 | python,raspberry-pi,gpio,iot,node-red | 32,058,198 | 4 | true | 0 | 0 | Node-RED supplies an exec node as part of it's core set, which can be used to call external commands, this could be call your python script.
More details of how to use it can be found in the info sidebar when a copy is dragged onto the canvas.
Or you could wrap the script as a web service or just a simple TCP socket, b... | 3 | 8 | 0 | I'm using Node-Red, hosted on a Raspberry Pi for an IoT project.
How do I trigger a Python script that is on the raspi from Node-Red? I want to run a script that updates the text on an Adafruit LCD shield which is sitting on the Pi
Should I be looking to expose the Python script as a web service somehow?
I'm using a Ra... | How to trigger Python script on Raspberry Pi from Node-Red | 1.2 | 0 | 0 | 28,176 |
32,059,241 | 2015-08-17T20:34:00.000 | 1 | 0 | 0 | 1 | python,tornado | 32,065,441 | 1 | false | 0 | 0 | No. Tornado's routing only considers the hostname and path. You'll have to route this path to a single RequestHandler and then inspect the Content-Type inside that handler. | 1 | 1 | 0 | For the very same REST route, e.g. /message, can I configure routing to execute different handlers based on the value of the Content-Type header? | Can Tornado route differently based on Content-Type header? | 0.197375 | 0 | 0 | 103 |
32,059,711 | 2015-08-17T21:06:00.000 | 0 | 0 | 0 | 0 | python,scipy,hierarchical-clustering | 70,254,029 | 2 | false | 0 | 0 | The parameter 'method' is used to measure the similarities between clusters through the hierarchical clustering process. The parameter 'metric' is used to measure the distance between two objects in the dataset.
The 'metric' is closely related to the nature of the data (e.g., you could want to use 'euclidean' distance ... | 1 | 3 | 1 | There is one distance function I can pass to pdist use to create the distance matrix that is given to linkage. There is a second distance function that I can pass to linkage as the metric.
Why are there two possible distance functions?
If they are different, how are they used? For instance, does linkage use the dista... | In scipy, what's the point of the two different distance functions used in hierarchical clustering? | 0 | 0 | 0 | 206 |
32,060,273 | 2015-08-17T21:50:00.000 | 12 | 0 | 1 | 0 | python | 32,060,347 | 2 | true | 0 | 0 | del is always a statement. Using parenthesis doesn't mean you're making a function call, but you're grouping expressions. (1) is just the same as 1. | 1 | 9 | 0 | As far as I can tell, both del a and del(a) seems to work with the same effect. If that's the case, why would Python allow del to exist both as a statement and a function? | Python: Is there any difference between "del a" and "del(a)"? | 1.2 | 0 | 0 | 219 |
32,061,658 | 2015-08-18T00:14:00.000 | 3 | 0 | 1 | 0 | python,matplotlib,graph | 32,062,644 | 1 | false | 0 | 0 | Vi is a text editor, and can't view images as images. The Windows Paint program should be able to view them, however, or on a Mac, Preview should work. | 1 | 0 | 1 | I have successfully saved my graphs using the plt.savefig() function in the matplotlib library.
When I try to open my graph using vi, the file is there but there are a lot of strange characters. I guess I'm viewing the code and other info rather than the visualization of the graph. How do I see the graph in its picto... | How to view a saved matplotlib plot | 0.53705 | 0 | 0 | 204 |
32,062,008 | 2015-08-18T01:03:00.000 | 0 | 1 | 0 | 1 | python,python-2.7,executable,popen | 32,062,059 | 1 | false | 0 | 0 | If you're simply trying to execute a python script externally, then just use popen() on your script, as you said. | 1 | 0 | 0 | I know there's a lot of questions asking about the opposite, but is there a particularly good way to launch a Python script from an executable? The executable itself was originally written in Python and compiled using py2exe so I was thinking of using popen() and passing python myscript.py but not sure if that's the mo... | Efficient way of launching python script from exe | 0 | 0 | 0 | 46 |
32,064,022 | 2015-08-18T05:14:00.000 | 0 | 0 | 0 | 0 | python,django | 32,064,980 | 2 | true | 1 | 0 | Personally as IDE I use Pycharm, it's just great, has really an extensive support for Django.
Besides I use Fabric for automated deployments.
Not sure if you ask exactly about that. In case you do not know Django contains itself a lot of "tooling commands" available via manage.py | 1 | 0 | 0 | I am new to Django and python. Please if you can help me in tools which are used for Django development work, it will be great help.
Thank you in Advance | list of tools used to do the Django development | 1.2 | 0 | 0 | 774 |
32,064,356 | 2015-08-18T05:41:00.000 | 5 | 0 | 1 | 0 | python,decimal,division,modulus | 32,065,934 | 2 | false | 0 | 0 | The tried and true method here is to multiply your divisor and dividend by a power of 10. Effectively, 54.10 becomes 541 and 0.10 becomes 1. Then you can use standard modulo or ceiling and floor to achieve what you need. | 1 | 1 | 0 | I'm trying to test if a float i.e(54.10) is divisible by 0.10. 54.10 % .10 returns .10 and not 0, why is that and how can I get it to do what I want it to do? | how to test if a number is divisible by a decimal less than 1? (54.10 % .10) | 0.462117 | 0 | 0 | 557 |
32,070,697 | 2015-08-18T11:06:00.000 | 1 | 1 | 0 | 0 | php,python,amazon-web-services,logging,alarm | 32,070,794 | 2 | false | 1 | 0 | You can schedule cron job to attain that. | 1 | 0 | 0 | I need an system that could check if many python scripts have run comletely.
The scripts would scrape data and output it to a corresponding xml file.
If the script fails there might be no xml file or error messages in the logs files. PHP files run the python scripts.
Is there a simple solution using an AWS service that... | Is there an AWS solution of an alarm system for failed python scripts? | 0.099668 | 0 | 0 | 45 |
32,073,427 | 2015-08-18T13:10:00.000 | 0 | 0 | 0 | 0 | python,amazon-web-services,amazon-dynamodb | 48,822,032 | 1 | false | 0 | 0 | I came across the same need when I query DynamoDB from an AWS Lambda in Python and expected the dataset to be over 128MB of memory limit. If I can't iterate through, I'll have to pay extra bucks to AWS. Unfortunately, it seems there is no way to do so except converting the query response to an iterator (which wouldn't ... | 1 | 1 | 0 | I am writing a script to compare the records in a database in my DynamoDB with record in another database in EC2.
I will appreciate any help with iterating through the table in Python. | How to iterate through a table in AWS DynamoDB? | 0 | 1 | 0 | 1,953 |
32,075,475 | 2015-08-18T14:38:00.000 | 0 | 0 | 0 | 1 | python,nginx,tornado | 32,088,517 | 1 | true | 0 | 0 | Tornado can be run on its own, but there are three major advantages to using nginx as a proxy in front of it:
Nginx is much more efficient at serving static files.
A proxy makes it easier to do rolling restarts of backend processes to perform upgrades without downtime.
Nginx can be configured to more efficiently rejec... | 1 | 0 | 0 | Tornado is powerful webserver and web Framework written in Python, it can run by its own (stand-alone) or could also be run through an other webserver specially nginx
Is there any performance or advantage of runing Tornado through Nginx ? | is it better to run tornado on nginx rather than running it by its own? | 1.2 | 0 | 0 | 120 |
32,075,643 | 2015-08-18T14:45:00.000 | 2 | 0 | 1 | 0 | python,numpy | 32,075,732 | 1 | false | 0 | 0 | You can use the fmt argument. For example, fmt='%10i' (or fmt='%10d') will write the integers right-aligned in a field of width 10. | 1 | 1 | 0 | I want to write a list of integers to a file in Python using numpy.savetxt. I want the integers to be right-aligned (padded with spaces on the left). How can I specify that? | numpy.savetxt list of integers with right alignment? | 0.379949 | 0 | 0 | 834 |
32,076,040 | 2015-08-18T15:03:00.000 | 0 | 0 | 0 | 0 | python,arrays,numpy,scikit-learn,neural-network | 32,094,372 | 1 | false | 0 | 0 | Looking at the source, scikit will reshape input arrays if the X (input samples) you pass in when initializing is a different size from creating/splitting the dataset in the MLP backend. This is to reduce overfitting by training and validating on the same samples. | 1 | 0 | 1 | When I pass my training data to the scikit neural network it is a NumPy array of all my 24*24 image matrices. I check and this is the shape of the data: (3237, 24, 24) - 3237 24*24 images.
However, once I feed it into the neural network, I get this warning:
WARNING:sknn: - Reshaping input array from (3237, 24, 24) to ... | Why does scikit neural network reshape my input array automatically? | 0 | 0 | 0 | 218 |
32,077,627 | 2015-08-18T16:17:00.000 | 1 | 0 | 0 | 0 | python,excel,openpyxl | 32,119,557 | 1 | true | 0 | 0 | To be honest I'd be tempted to suggest you use openpyxl all the way if there is something that xlsxwriter doesn't do, though I think that it's formatting options are pretty extensive. The most recent version of openpyxl is as fast as xlsxwriter if lxml is installed.
However, it's worth noting that Pandas has tended to ... | 1 | 1 | 1 | I created an Excel spreadsheet using Pandas and xlsxwriter, which has all the data in the right rows and columns. However, the formatting in xlsxwriter is pretty basic, so I want to solve this problem by writing my Pandas spreadsheet on top of a template spreadsheet with Pyxl.
First, however, I need to get Pyxl to only... | Use Pyxl to read Excel spreadsheet data up to a certain row | 1.2 | 1 | 0 | 256 |
32,078,314 | 2015-08-18T16:54:00.000 | 5 | 1 | 0 | 0 | python,unit-testing,testing,pytest,python-unittest | 32,140,354 | 1 | false | 0 | 0 | Using the pytest-xdist plugin it will restart the nodes automatically when they crash, so installing the plugin and running the tests with -n1 should make py.test survive the crashing tests. | 1 | 3 | 0 | I have a few unit tests written using pytest that have successfully caused segfaults to occur. However if a segfault occurs (on my Mac) during these execution, pytest seems to quit altogether and provide no information on what caused the python interpreter to crash.
Now I could infer from the logs the specific test tha... | pytest: If a crash/segfault/etc. occurs during testing, is there a way to make pytest log the crash as a test failure and continue testing? | 0.761594 | 0 | 0 | 1,941 |
32,080,897 | 2015-08-18T19:18:00.000 | 0 | 1 | 0 | 0 | java,python,raspberry-pi,raspberry-pi2 | 32,080,928 | 1 | false | 0 | 0 | You can't. The composite video phono socket is an output device. | 1 | 0 | 0 | I have a drone that has a goPro and Video transmitter attached to it. the transmitter can transmit via wireless or through 3.5mm. How can i pick up this data through 3.5mm/composite video on a pi? the drone is a DJI phantom 2 and an iOSD transmitter. i want to use the transmitter video rather than the GoPro directly s... | How to read data from 3.5mm jack on Raspberry Pi 2 with python or java? | 0 | 0 | 0 | 282 |
32,082,285 | 2015-08-18T20:47:00.000 | 0 | 0 | 1 | 0 | python,regex | 32,082,835 | 4 | false | 0 | 0 | Try the following regexp: Temp:([^,]+,)
Now, anything after Temp: is included until the first ,. | 1 | 6 | 0 | Consider I have the following text:
Temp:C5E501374D0343090957F7E5929E765C931F7D3EC7A96189FDA88549D54D9E4E5DB3FC1C2, adfsafd1242412,
And I want to catch all the data after Temp: and until first occurrence of , which means: C5E501374D0343090957F7E5929E765C931F7D3EC7A96189FDA88549D54D9E4E5DB3FC1C2
I tried using regex Temp... | Using Regex to catch text until first occurrence of certain character | 0 | 0 | 0 | 14,790 |
32,083,871 | 2015-08-18T22:51:00.000 | 1 | 0 | 1 | 0 | python,object | 32,084,023 | 4 | false | 0 | 0 | What is generally meant is that most things, for example functions and methods are objects. Modules too. Classes (not just their instances) themselves are objects. and int/float/strings are objects. So, yes, things generally tend to be objects in Python. Cyphase is correct, I just wanted to give some examples of things... | 2 | 0 | 0 | I constantly see people state that "Everything in Python is an object.", but I haven't seen "thing" actually defined. This saying would lead me to believe that all tokens of any kind are also considered to be objects, including operators, punctuators, whitespace, etc. Is that actually the case? Is there a more conci... | What does "thing" mean when someone says "Everything in Python is an object."? | 0.049958 | 0 | 0 | 356 |
32,083,871 | 2015-08-18T22:51:00.000 | 2 | 0 | 1 | 0 | python,object | 32,083,906 | 4 | false | 0 | 0 | Anything that can be assigned to a variable is an object.
That includes functions, classes, and modules, and of course int's, str's, float's, list's, and everything else. It does not include whitespace, punctuation, or operators.
Just to mention it, there is the operator module in the standard library which includes fu... | 2 | 0 | 0 | I constantly see people state that "Everything in Python is an object.", but I haven't seen "thing" actually defined. This saying would lead me to believe that all tokens of any kind are also considered to be objects, including operators, punctuators, whitespace, etc. Is that actually the case? Is there a more conci... | What does "thing" mean when someone says "Everything in Python is an object."? | 0.099668 | 0 | 0 | 356 |
32,084,838 | 2015-08-19T00:54:00.000 | 0 | 0 | 1 | 0 | python,recursion | 32,085,067 | 1 | true | 0 | 0 | As a rule of thumb, you should not use recursive calls in long-running programs. Of course there are exceptions...
Recursive functions are typically used where the application indicates managing something which calls for that functionality: Eg. traversing a tree structure, or looking up something in a database until a ... | 1 | 2 | 0 | I wrote a recursive python function. After 30min - 1 hour it cancel the process because it ran out of memory. If I look in the task manager I also see that too much ram memory is used. If I restart the function everything is fine again. How can I avoid this problem and let the program "run forever"? | Avoiding "run out of memory" error in a recursive python function | 1.2 | 0 | 0 | 2,083 |
32,085,479 | 2015-08-19T02:16:00.000 | 1 | 0 | 0 | 1 | python,linux,bash,shell | 32,085,685 | 2 | false | 0 | 0 | Please ensure you have added:
!/bin/bash
as the first line and also make sure that the file script.sh has executable permission.
chmod u+x script.sh
then try specifying the complete path:
subprocess.call("/complete/path/script.sh", shell=True) | 1 | 0 | 0 | So, I am trying to run a Shell script from Python and I double checked that the location of the script.sh is all correct (because when I run it from sublime, the script.sh opens). What I have to call script.sh is:
subprocess.call("script.sh", shell=True)
When I run that, the function returns 0. However, the script is s... | Running Shell script from within Python issue | 0.099668 | 0 | 0 | 76 |
32,085,633 | 2015-08-19T02:35:00.000 | 0 | 0 | 1 | 0 | pycharm,python-import,remote-server | 32,085,952 | 1 | true | 0 | 0 | Ah I figured it out. I have to manually sync the files first otherwise they won't be uploaded. I could import from Util.Util because I made an edit in that file which caused an automatic upload. | 1 | 1 | 0 | I have a project folder with sub folders named F, with files MDN.py and NN_Layers.py, FFN with FFN.py and Util with Data.py and Util.py
My code works on a local interpreter.
In MDN.py I get an error when trying to import a function from Util.Data and from F.NN_Layers.
In FFN.py I can import from a function in Util.Ut... | pycharm using a remote interpreter ImportError: No Module named error | 1.2 | 0 | 0 | 819 |
32,085,888 | 2015-08-19T03:06:00.000 | 1 | 0 | 1 | 0 | python,django,django-views | 32,085,949 | 3 | false | 1 | 0 | You can have additional files that have generic code in their own files and just import them when you need them for your views, or whatever. If they are only going to be used in one app, then just put them in that apps folder. If they are more generic then you can put them in a file or folder that isn't part of any par... | 1 | 8 | 0 | Where someone should place any external python script for her Django project? What is the more appropriate location (if any)? Shall she create a folder in the main Django project and put it there and add this to the python path or is there a better way to deal with this issue? The reason for external scripts is not to ... | Where to place external python scripts in a Django project? | 0.066568 | 0 | 0 | 10,379 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.