Q_CreationDate
stringlengths
23
23
Title
stringlengths
11
149
Question
stringlengths
25
6.53k
Answer
stringlengths
15
5.1k
Score
float64
-1
1.2
Is_accepted
bool
2 classes
N_answers
int64
1
17
Q_Id
int64
0
6.76k
2014-12-04 22:01:47.427
How to determine the type of event flagged by <> in Tkinter?
I am binding to ListBoxSelect and i want to implement a function which recognizes an alphabetical key-press and uses this to jump to the corresponding place in an alphabetically sorted list. Is there a way to tell what type of event is flagged by ListBoxSelect? I see something in the documentation about getting event "...
No, there isn't a way to tell what type of event is flagged by <<ListboxSelect>>. Using <<ListboxSelect>> is useless for binding to a letter key, however. It only will fire for mouse clicks and using the arrow keys to navigate the listbox. You can bind to <KeyPress>. That binding will tell you what key was pressed, an...
1.2
true
1
3,494
2014-12-05 03:32:26.493
How to install python package with a different name using PIP
When installing a new python package with PIP, can I change the package name because there is another package with the same name? Or, how can I change the existing package's name?
This is not possible with the pip command line tool. All of the packages on PyPI have unique names. Packages often require and depend on each other, and assume the name will not change.
-0.090455
false
5
3,495
2014-12-05 03:32:26.493
How to install python package with a different name using PIP
When installing a new python package with PIP, can I change the package name because there is another package with the same name? Or, how can I change the existing package's name?
If you are struggling to install the correct package when using pip install 'module', you could always download its corresponding wheel file (.whl extension) and then install this directly using pip. This has worked for me in various situations in the past.
0.090455
false
5
3,495
2014-12-05 03:32:26.493
How to install python package with a different name using PIP
When installing a new python package with PIP, can I change the package name because there is another package with the same name? Or, how can I change the existing package's name?
I Don't think it is possible to change the name of package by using pip. Because pip can install packages which are exist and gives error if there is no package name which you write for change the name of package.
0
false
5
3,495
2014-12-05 03:32:26.493
How to install python package with a different name using PIP
When installing a new python package with PIP, can I change the package name because there is another package with the same name? Or, how can I change the existing package's name?
It's not possible to change "import path" (installed name) by specifying arguments to pip. All other options require some form of "changes to the package": A. Use pip install -e git+http://some_url#egg=some-name: that way even if both packages have the same import path, they will be saved under different directories (u...
0.529586
false
5
3,495
2014-12-05 03:32:26.493
How to install python package with a different name using PIP
When installing a new python package with PIP, can I change the package name because there is another package with the same name? Or, how can I change the existing package's name?
Create a new virtualenv and then install the package on new virtualenv, with this you can have the different version of packages as well.
0.179442
false
5
3,495
2014-12-05 04:35:08.907
In using OpenErp 7 or Odoo 8, how do I modify it such that a manager assigned to a project is the one who will approve all timesheet entries for it?
I have downloaded and installed and also tested via a virtual machine online Odoo 8 and OpenErp 7. I have spent many hours tinkering with the apps and features of both. I am unable to find any way from hours I spend searching or tinkering for a method to change the approve timesheet functionality in the manner I will e...
You can manage this by grouping each employee according to their privilege. For example you have two groups Managerial and employee group so each of them might have different or some how common privilege on certain python objects from OpenERP so please identify those python objects and explore more in Setting >> Users...
1.2
true
1
3,496
2014-12-06 23:03:39.810
Starting a python script at boot and loading GUI after that
Can anyone tel me how to start a python script on boot, and then also load the GUI ? I am debian based Raspbian OS. The reason I want to run the python script on boot is because I need to read key board input from a RFID reader. I am currently using raw_input() to read data from the RFID reader. The 11 character hex va...
Try to use bootup option in crontab: @reboot python /path/to/pythonfile.py
0
false
1
3,497
2014-12-08 13:15:11.383
Size of canvas in kivy
In my app I need to know how big the canvas is in pixels. Instead calling canvas.size returns [100,100] no matter how many pixels the canvas is wide. Can you please tell me a way to get how many pixels the canvas is wide and high?
There is no position nor size in a Canvas. Canvas act just as a container for graphics instructions, like Fbo that draw within a Texture, so it have a size. In Kivy, Canvas.size doesn't exists, but i guess you called your widget a canvas. By default, a Widget size is 100, 100. If you put it into a layout, the size will...
1.2
true
1
3,498
2014-12-08 16:06:27.003
Automating IBM SPSS Data Collection survey export?
I'm so sorry for the vague question here, but I'm hoping an SPSS expert will be able to help me out here. We have some surveys that are done via SPSS, from which we extract data for an internal report. Right now the process is very cumbersome and requires going to the SPSS Data Collection Interviewer Server Administrat...
There are a number of different ways you can accomplish easing this task and even automate it completely. However, if you are not an IBM SPSS Data Collection expert and don't have access to somebody who is or have the time to become one, I'd suggest getting in touch with some of the consultants who offer services on th...
0.135221
false
3
3,499
2014-12-08 16:06:27.003
Automating IBM SPSS Data Collection survey export?
I'm so sorry for the vague question here, but I'm hoping an SPSS expert will be able to help me out here. We have some surveys that are done via SPSS, from which we extract data for an internal report. Right now the process is very cumbersome and requires going to the SPSS Data Collection Interviewer Server Administrat...
This isn't as clean as working directly with whatever database is holding the data, but you could do something with an exported data set: There may or may not be a way for you to write and run an export script from inside your Admin panel or whatever. If not, you could write a simple Python script using Selenium WebDri...
1.2
true
3
3,499
2014-12-08 16:06:27.003
Automating IBM SPSS Data Collection survey export?
I'm so sorry for the vague question here, but I'm hoping an SPSS expert will be able to help me out here. We have some surveys that are done via SPSS, from which we extract data for an internal report. Right now the process is very cumbersome and requires going to the SPSS Data Collection Interviewer Server Administrat...
As mentioned by other contributors, there are a few ways to achieve this. The simplest I can suggest is using the DMS (data management script) and windows scheduler. Ideally you should follow below steps. Prerequisite: 1. You should have access to the server running IBM Data collection 2. Basic knowledge of windows t...
0.265586
false
3
3,499
2014-12-10 13:12:04.330
Detecting presence of particular bluetooth device with MAC address
my ultimate goal is to allow my raspberry pi detect when my iphone or pebble watch is nearby. I am presently focusing on the pebble as I believe iphone randomizes the MAC address. I have the static MAC address of the pebble watch. My question is how to detect the presence of the MAC address through bluetooth? I have ...
Apple iDevices do use private resolvable addresses with Bluetooth Low Energy (BLE). They cycle to a different address every ~15 minutes. Only paired devices that have a so called Identity Resolving Key can "decipher" these seemingly random addresses and associate them back to the paired device. So to do something like ...
0.3154
false
1
3,500
2014-12-10 14:05:23.033
Django 1054 - Unknown Column in field list
I have a Django project and I did the following: Added a table with some columns Insert some records into the db Added a new column that I didn't realize I needed Made an update to populate that column When I did a migrate everything worked just fine. The new db column was created on the table and the values were po...
This happened to me because I faked one migration (m1), created another (m2), and then tried to migrate m2 before I had faked my initial migration (m1). So in my case I had to migrate --fake <app name> m1 and then migrate <app name> m2.
0
false
4
3,501
2014-12-10 14:05:23.033
Django 1054 - Unknown Column in field list
I have a Django project and I did the following: Added a table with some columns Insert some records into the db Added a new column that I didn't realize I needed Made an update to populate that column When I did a migrate everything worked just fine. The new db column was created on the table and the values were po...
Unless the new column has a default value defined, the insert statement will expect to add data to that column. Can you move the data load to be after the second migration. (I would have commented, but do not yet have sufficient reputation.)
0
false
4
3,501
2014-12-10 14:05:23.033
Django 1054 - Unknown Column in field list
I have a Django project and I did the following: Added a table with some columns Insert some records into the db Added a new column that I didn't realize I needed Made an update to populate that column When I did a migrate everything worked just fine. The new db column was created on the table and the values were po...
I faced the same issue all what i do to get out this issue just drop all tables in my DB and then run: python manage.py makemigrations and : python manage.py migrate
0
false
4
3,501
2014-12-10 14:05:23.033
Django 1054 - Unknown Column in field list
I have a Django project and I did the following: Added a table with some columns Insert some records into the db Added a new column that I didn't realize I needed Made an update to populate that column When I did a migrate everything worked just fine. The new db column was created on the table and the values were po...
I believe this was because the migration scripts were getting called out of order, due to a problem I had setting them up. Everything is ok now.
1.2
true
4
3,501
2014-12-11 06:46:30.953
How to track django user details using zoho CRM
How to track django user details using zoho CRM? I am new zoho CRM, I got the few information and details how ZOHO CRm will be. Now I want to know one thing, I had implement the django project and also have a account in zoho CRM. Now I would like to Tacke all my user details from app database in zoho crm. how to ...
All you need is export django auth but if extender user model is there then you can also take extended user model too... Please update your question what Database you are using ?
0
false
1
3,502
2014-12-16 17:08:40.497
Self-modifying Python code to keep track of high scores
I've considered storing the high scores for my game as variables in the code itself rather than as a text file as I've done so far because it means less additional files are required to run it and that attributing 999999 points becomes harder. However, this would then require me to run self-modifying code to overwrite ...
My first inclination is to say "don't do that". Self-modifying Python (really any language) makes it extremely difficult to maintain a versioned library. You make a bug fix and need to redistribute - how do you merge data you stored via self-modification. Very hard to authenticate packaging using a hash - once the lo...
1.2
true
1
3,503
2014-12-17 02:05:59.013
Python console not launching properly from command line
I seem to have problem launching python from command line. I tried various things with no success. Problem: When trying to run python from the command line, there is no response i.e. I do not get message about 'command not found' and console does not launch. Only option to open python console is to run C:\Python34\pyth...
Issue resolved. Since no feasible solution was found in 2 days, I decided to wipe all keys containing 'python' from registry as well as some files that were not parts of other programs. This resolved the issue after re-installing python. If anyone finds the true cause of this misbehavior and other - less brutal - solut...
0
false
1
3,504
2014-12-17 03:40:57.930
Is there any way to use Google Protobuf on pypy?
Protobuf with pure python performance 3x slowly on pypy than CPython do. So I try to use c++ implementation for pypy. These are two error (PyFloatObject undefined and const char* to char*) when I compile protobuf(2.6.1 release) c++ implementation for pypy. I compile successfully after I modify python/google/protobuf/py...
So this is a happy non-answer using my experience. The pure-python bindings for google protobuf are a terrible port of C/C++ stuff. However, I had quite a bit of success wrapping C google protobuf generated bindings using cffi. Someone should go ahead and create a more generic binding, but that would just a short consu...
0.386912
false
1
3,505
2014-12-18 05:35:02.550
python parse string into individual chararcters
In Python 2.7 how do I parse 'abc' into 'a b c' for a very long string (like 1000 chars)? Or how would I convert 'abccda' to '1 2 3 3 4 1'? (where each unique letter maps to a unique digit, 1-4) I imagine I could pop the chars off, one by one, but I'm new to Python and wonder if there is a simple function that does it.
Do you mean the list method? s='abccda' list(s) # ['a', 'b', 'c', 'c', 'd', 'a']
0.101688
false
1
3,506
2014-12-18 18:30:10.593
URL parsing issue in python
I am new to Python programming. While making an application, I ran into this problem. I am parsing URL using urllib library of python. I want to convert any relative url into its corresponding absolute url. I get relative and absolute URLs in random fashiion and they may not be from the same domain. Now how do I store...
Now how do I store the last known absolute url to extract the netloc from it and append it to relative url? Should I save the last known absolute URL in a text file? What do you think is wrong with this? Seems to make sense to me... (depending on context, obviously)
0
false
1
3,507
2014-12-18 20:55:06.453
Is it a good idea to make use different Python scripts for programs?
I am wondering if it would be a good idea to use different .py scripts for different parts of a Python program. Like one .py file for a calculator and another for class files and etc. If it is a good idea, is it possible? If possible, where can I find how to do so? I am asking this because I find it confusing to have ...
If your program starts assuming big dimensions, yes, you could split your classes or simply your functions according to what they do. Usually functions that do similar tasks or that work on the same data are put together. To import a file containing a set of functions that you defined, if the file is in the same folder...
0.201295
false
1
3,508
2014-12-19 03:32:33.063
Terminal/django/komodo edit
I sincerely apologize for the noobish dribble thats about to come out here: Okay so I am following along with a youtube tutorial using terminal/django/komodo edit to make a simple website. This is my first time really using terminal, I am having issues. I have read up on the terminal and searched this site for my que...
Let's start from the beginning: You are in your project folder eg /home/me/myproject You create a new virtualenv, eg virtualenv /home/me/virtualenvs/myprojectenv You activate the new virtualenv: source /home/me/virtualenvs/myprojectenv/bin/activate ...this means that python and pip commands now point to the versions i...
1.2
true
1
3,509
2014-12-20 21:05:25.813
python dynamodb get 1000 entries
I am using amazon dynamodb and accessing it via the python boto query interface. I have a very simple requirement I want to get 1000 entries. But I don't know the primary keys beforehand. I just want to get 1000 entries. How can I do this? ...I know how to use the query_2 but that requires knowing primary keys beforeh...
Use Table.scan(max_page_size=1000)
1.2
true
1
3,510
2014-12-21 02:02:49.513
Python py2exe with tkinter (pyw file)
I have made a small program in Python that involves tkinter, and I made it a pyw file because it has a shortcut on the desktop and I do not want the command prompt to get in the way. I used py2exe following the sentdex tutorial on youtube, and I got an output file, but the output file shows an error and exits before I ...
As far as I understand there is not a version of py2exe for python3.x You'd be best of going for cx_freeze (Sentdex also has a tutorial on that on that)
0
false
1
3,511
2014-12-22 18:02:58.557
OpenCV: how to get image format if reading from buffer?
I read an image (of unknown format, most frequent are PNGs or JPGs) from a buffer. I can decode it with cv2.imdecode, I can even check if it is valid (imdecode returns non-None). But how can I reveal the image type (PNG, JPG, something else) of the buffer I've just read?
There is a standard Python functionimghdr.what. It rulez! ^__^
1.2
true
1
3,512
2014-12-23 22:10:10.453
How to give a python client a port number from a python server
I'm trying to build a simple python server that a client can connect to without the client having to know the exact portnumber. Is that even possible? The thought is to choose a random portnumber and using it for clients to connect. I know you could use bind(host, 0) to get a random port number and socket.getsockname(...
In order to do that the server must listen on a certain port(s). This means the client(s) will need to interact on these ports with it. So... no it is impossible to do that on some random unknown port.
0.135221
false
3
3,513
2014-12-23 22:10:10.453
How to give a python client a port number from a python server
I'm trying to build a simple python server that a client can connect to without the client having to know the exact portnumber. Is that even possible? The thought is to choose a random portnumber and using it for clients to connect. I know you could use bind(host, 0) to get a random port number and socket.getsockname(...
You need to advertise the port number somehow. Although DNS doesn't do that (well, you could probably cook up some resource record on the server object, but that's not really done) there are many network services that do. LDAP like active directory (you need write rights), DNS-SD dns service discovery, universal plug a...
0
false
3
3,513
2014-12-23 22:10:10.453
How to give a python client a port number from a python server
I'm trying to build a simple python server that a client can connect to without the client having to know the exact portnumber. Is that even possible? The thought is to choose a random portnumber and using it for clients to connect. I know you could use bind(host, 0) to get a random port number and socket.getsockname(...
Take a look at Zeroconf, it seems to be the path to where you are trying to get to.
0
false
3
3,513
2014-12-23 22:57:37.710
Intel MKL Error with Gaussian Fitting in Python?
I'm doing a Monte Carlo simulation in Python in which I obtain a set of intensities at certain 2D coordinates and then fit a 2D Gaussian to them. I'm using the scipy.optimize.leastsq function and it all seems to work well except for the following error: Intel MKL ERROR: Parameter 6 was incorrect on entry to DGELSD. Th...
You could try Intel's python distribution. It includes a pre-built scipy optimized with MKL.
-0.386912
false
1
3,514
2014-12-24 19:51:15.893
Better way to store a set of files with arrays?
I've accumulated a set of 500 or so files, each of which has an array and header that stores metadata. Something like: 2,.25,.9,26 #<-- header, which is actually cryptic metadata 1.7331,0 1.7163,0 1.7042,0 1.6951,0 1.6881,0 1.6825,0 1.678,0 1.6743,0 1.6713,0 I'd like to read these arrays into memory selectively. W...
Reading 500 files in python should not take much time, as the overall file size is around few MB. Your data-structure is plain and simple in your file chunks, it ll not even take much time to parse I guess. Is the actual slowness is bcoz of opening and closing file, then there may be OS related issue (it may have very...
1.2
true
1
3,515
2014-12-25 07:32:27.183
Can uWSGI return a response before the POST data is uploaded?
I have an api with publishers + subscribers and I want to stop a publisher from uploading a lot of data if there are no subscribers. In an effort to avoid another RTT I want to parse the HTTP header, see if there are any subscribers and if not return an HTTP error before the publisher finishes sending all of the data. ...
The limit here is nginx. It cannot avoid (unless when in websockets mode) buffering the input. You may have more luck with apache or the uWSGI http router (albeit i suppose they are not a viable choice)
0
false
1
3,516
2014-12-29 03:17:03.300
Is there any fast ways to scrape a website with infinite scroll?
I am trying to use python to scrape a website implemented with infinite scroll. Actually, the web is pinterest. I know how to use selenium webdriver to scrape a web with infinite scroll. However, the webdriver basically imitates the process of visiting the web and is slow, much slower than using BeautifulSoup and urlli...
The infinite scroll is probably using an Ajax query to retrieve more data as you scroll. Use your browser's dev tools to inspect the request structure and try to hit the same endpoint directly. In this way you can get the data you need, often in json or xml format. In chrome open the dev tools (Ctrl + shift + I in wi...
1.2
true
1
3,517
2014-12-29 14:06:26.487
How do I activate a virtual environment in Powershell 2?
I want to activate this virtual environment: (G:/virt_env/virt1) I'm just following a virtualenv tutorial, I have created a virtual environment(look above), the next step Is activating It, but that tutorial was written for Unix, So how do I activate this virtual environment using Powershell 2? This is assuming basic kn...
According to Lukas Graf: Replace source with . (a single dot) and the relative path after it with a full, absolute path
1.2
true
1
3,518
2014-12-31 00:22:51.247
how to do the sum of pixels with Python and OpenCV
I have an image and want to find the sum of a part of it and then compared to a threshold. I have a rectangle drawn on the image and this is the area I need to apply the sum. I know the cv2.integral function, but this gives me a matrix as a result. Do you have any suggestion?
np.sum(img[y1:y2, x1:x2, c1:c2]) Where c1 and c2 are the channels.
0.986614
false
2
3,519
2014-12-31 00:22:51.247
how to do the sum of pixels with Python and OpenCV
I have an image and want to find the sum of a part of it and then compared to a threshold. I have a rectangle drawn on the image and this is the area I need to apply the sum. I know the cv2.integral function, but this gives me a matrix as a result. Do you have any suggestion?
sumElems function in OpenCV will help you to find out the sum of the pixels of the whole of the image in python. If you want to find only the sum of a particular portion of an image, you will have to select the ROI of the image on the sum is to be calculated. As a side note, if you had found out the integral image, the...
0.545705
false
2
3,519
2014-12-31 05:50:25.153
Python: comparing list to a string
I want to know how to compare a string to a list. For example I have string 'abcdab' and a list ['ab','bcd','da']. Is there any way to compare all possible list combinations to the string, and avoid overlaping elements. so that output will be a list of tuples like [('ab','da'),('bcd'),('bcd','ab'),('ab','ab'),('ab'),...
all possible list combinations to string, and avoiding overlaping elements Is a combination one or more complete items in its exact, current order in the list that match a pattern or subpattern of the string? I believe one of the requirements is to not rearrange the items in the list (ab doesn't get substituted for...
0.135221
false
1
3,520
2014-12-31 10:20:18.147
Python network communication with encryption and password protection
I want to create a python program that can communicate with another python program running on another machine. They should communicate via network. For me, it's super simple using BasicHTTPServer. I just have to direct my message to http:// server2 : port /my/message and server2 can do whatever action needed based on t...
if you have no problem rolling out a key file to all nodes ... simply throw your messages into AES, and move the output like you moved the unencrypted messages ... on the other side ... decrypt, and handle the plaintext like the messages you handled before ...
1.2
true
1
3,521
2014-12-31 17:57:47.790
How to cancel Django cache in fastcgi
I am testing a web application on both shared host and Apache localhost, using Django and fastcgi. When I edited my code and refreshing the page, many times the new code does not take effect. I think this is a cache issue, but I don't know how from the application. For example: adding new url pattern to mysite/urls.py...
Thats the nature of using it in that format/setup. On development, running as 'manage.py runserver' it auto reloads on file changes. production/proxy setups like you have, you need to reload/restart the service to have changes take effect.
1.2
true
1
3,522
2015-01-02 13:31:22.713
Secure MySQL login data in a Python client program
I have a Python client program (which will be available to a limited number of users) that fetches data from a remote MySQL-DB using the pymysql-Module. The problem is that the login data for the DB is visible for everyone who takes a look at the code, so everyone could manipulate or delete data in the DB. Even if I wo...
This happens to be one of the reasons desktop client-server architecture gave way to web architecture. Once a desktop user has access to a dbms, they don't have to use just the SQL in your application. They can do whatever their privileges allow. In those bad old days, client-server apps only could change rows in the D...
0
false
1
3,523
2015-01-04 01:27:47.477
python cocos2d change tile's image
-I'm using python and cocos2D I have the file loading a tmx-map but now I want to change a specific tile to display an image from another file, I have saved the specific tile that I want to change in a variable but changing it I don't know how. Thanks in advance
All I had to do was cell.tile.image = image
0.386912
false
1
3,524
2015-01-04 02:11:24.563
Best Way to Store Large Amount of Outside API Data... using Ruby or Python
Im trying to design a system that can periodic "download" a large amount of data from an outside api.. This user could have around 600,000 records of data that I need once, then to check back every hour or so to reconcile both datasets. Im thinking about doing this in python or ruby in background tasks eventually but I...
I think this all boils down to what the most important needs are for the project. These are some of the questions I would try to answer before selecting the technology: Will I need to access records individually after inserting into the database? Will I ever need to aggregate the data when reading it (for reporting, f...
0
false
1
3,525
2015-01-06 13:28:28.637
epub3 : how to add the mimetype at first in archive
I'm working on a script to create epub from html files, but when I check my epub I have the following error : Mimetype entry missing or not the first in archive The Mimetype is present, but it's not the first file in the epub. Any idea how to put it in first place in any case using Python ?
The solution I've found: delete the previous mimetype file when creating the new archive create an new mimetype file before adding anything else : zipFile.writestr("mimetype", "application/epub+zip") Why does it work : the mimetype is the same for all epub : "application/epub+zip", no need to use the original file.
1.2
true
1
3,526
2015-01-07 02:30:00.520
How to formatted output a graph of an equation using python?
I am a beginner so I don't think I need to use anything complicated. Basically I have to print y=x^+3 for the rangex=0 to x=4 using formatted output and I don't know how. From what I have learned so far, I'm supposed to use formatted output, looping and variable width output to do this. Does anyone know how to do it? T...
Check out the module matplotlib, it was made to give plotting visuals in python. I hope this helps a little.
0.201295
false
1
3,527
2015-01-07 05:52:54.783
intellij: update classes in classpath for python plug-in
community! My problem: I have an item, namely gi.repository.Gtk, marked as "Unresolved reference: Gtk". The Gtk module did not exist at the moment of setting up Python SDK in Idea, however I've installed it little bit later. I can't get how do I force re-sync of classpath for python?
Normally the binary modules for a Python interpreter are rescanned on IntelliJ IDEA restart. Please try restarting the IDE.
1.2
true
1
3,528
2015-01-08 06:57:20.363
How To check for environment vars during django startup
Id like to have my secret keys loaded via environment vars that shall be check on startup of my Django app. Im using an AppConfig for that purpose, because that code will be executed on startup. For now i wrote a little helper to get the vars and a list of vars to check. Which is working fine. The problem: I also wrot...
well, it turned out that the AppConfig is not the right spot for a task like that .. i realized my loading of secrets with a modification of the projects manage.py and im planning to release an app with all of the code in the near furture :)
1.2
true
1
3,529
2015-01-09 22:05:23.353
pip install: Please check the permissions and owner of that directory
While installing pip and python I have ran into a that says: The directory '/Users/Parthenon/Library/Logs/pi' or its parent directory is not owned by the current user and the debug log has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want the -H flag. be...
pip install --user <package name> (no sudo needed) worked for me for a very similar problem.
1
false
2
3,530
2015-01-09 22:05:23.353
pip install: Please check the permissions and owner of that directory
While installing pip and python I have ran into a that says: The directory '/Users/Parthenon/Library/Logs/pi' or its parent directory is not owned by the current user and the debug log has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want the -H flag. be...
If you altered your $PATH variable that could also cause the problem. If you think that might be the issue, check your ~/.bash_profile or ~/.bashrc
0
false
2
3,530
2015-01-11 09:36:44.637
how to setup virtualenv to use a different python version in each virtual env
using autoenv and virtualenvwrapper in python and trying to configure in it the specific python version. the autoenv file (called .env) contains (simply) echo 'my_env' is there a way to configure it's python version?
When creating virtual environment, you can specify which python to use. For example, virtualenv -p/usr/bin/python2.7 env Same for mkvirtualenv
0.386912
false
1
3,531
2015-01-12 23:49:35.833
text - binary conversion
I'm trying to make a python program that converts text to one long binary string. The usual line of test and sentences are easy enough to convert into binary but I'm having trouble with the whitespace. How do I put in a binary byte to represent the enter key? Do I just put in the '/' and an 'n' strings? I would ide...
The tab is represented in the ASCII chart as 0x08 0x09, or "00001000" "00001001" in a binary string. The Enter key is different because it could represent CR (carriage return), LF (Linefeed), or both. The CR is represented as 0x0d, or "00001101" as binary string. The LF is represented as 0x0A, or "00001010" as bina...
1.2
true
1
3,532
2015-01-13 18:42:05.273
MySQL - Strange symbols while using urllib in Python
I am using urllib in python 2.7 to retrieve webpages from the internet. After parsing the data and storing it on the database, i get the following symbols – and †and — and so on. I wanted to know how these symbols are generated and how to get rid of it? Is it an encoding issue?
Yes it is an encoding issue, make sure sure when you parse your data it doesn't encrypt it or turn it into byte encoded format. Those characters means your computer can't read the data that is being stored, so it isn't being stored in a data type that we can read.
0
false
1
3,533
2015-01-14 20:59:06.920
Debugging with PyCharm terminal arguments
I have been using PyCharm for a bit so I am not an expert. How I normally ran my programs was with the terminal like so: program.py -t input1 -t1 input2 I was wondering how can I debug this? For other programs I wrote, I did not have any arguments so debugging was simply setting break points and pressing debug.
It was almost correct but just needed little correction with full script path. Menu: Run->Edit configurations->"+" (add new config)->Python. Script name: path + /program.py Script params: -t input1 -t1 input2
0.135221
false
2
3,534
2015-01-14 20:59:06.920
Debugging with PyCharm terminal arguments
I have been using PyCharm for a bit so I am not an expert. How I normally ran my programs was with the terminal like so: program.py -t input1 -t1 input2 I was wondering how can I debug this? For other programs I wrote, I did not have any arguments so debugging was simply setting break points and pressing debug.
Menu: Run -> Edit configurations -> "+" (add new config) -> Python. Script name: program.py If you need to debug a script from installed packages, such as tox, you can specify the full path too. For example: Script name: /home/your_user/.envs/env_name/bin/tox Above /home/your_user/.envs/env_name is a path to virtual en...
1.2
true
2
3,534
2015-01-15 01:51:12.603
Java/python using processBuilder
Good evening all, am running a python script inside java using processBuilder. the python script returns a list and i dont know how to get it java and use it since all i can do for the moment with process builder is print errors or outputs. is it possible to get the list in java as well. Many thanks
From your scenario, you are looking for inter process communication. You can achieve this using shared file. Your python script will write the output in text file, and your java program will read the same file.
0
false
1
3,535
2015-01-15 20:32:49.887
In the PayPal REST API, how can I get payer information from a newly executed BillingAgreement?
Let's say I have a billing agreement, which I just executed on the callback from the PayPal site: resource = BillingAgreement.execute(token) The resource returned does not have any payer information (name, email, etc). I can use the ID to load the full BillingAgreement: billing_agreement = BillingAgreement.find(res...
Got a reply from PayPal support. Apparently you can take the same token you pass to BillingAgreement.execute() and pass it to GetExpressCheckoutDetails in their classic API. I tried it and it works. It means you have to use both APIs (which we weren't planning to do) and store both API auth info, which is annoying. ...
0.673066
false
1
3,536
2015-01-16 06:25:49.233
How to use pyenv with another user?
How to use pyenv with another user? For example, If I have installed pyenv in user test's environment, I could use pyenv when i login as test. However, how could i use pyenv when I login as another user, such as root?
Even if you did this, I'd strongly discourage it. Root can access pretty much everyone's home directory, but the nuances of adding programs to the PATH that the root user doesn't technically own can be detrimental at best - might lead to a few root services not working properly, and actively insecure at worst. There's...
0.986614
false
1
3,537
2015-01-18 11:56:29.433
randomly select 3 numbers whose sum is 356 and each of these 3 is more than 30
please how can I randomly select 3 numbers whose sum is 356 and each of these 3 is more than 30? So output should be for example [100, 34, 222] (but not [1,5,350]) I would like to use random module to do this. thank you!
This question is rather subjective to the definition of random, and the distribution you wish to replicate. The simplest solution: Choose a one random number, rand1 : [30,296] Choose a second random number, rand2 : [30, (326-Rand1)] Then the third cannot be random due to the constraint so calc via 356-(rand1+rand2)
0.545705
false
1
3,538
2015-01-19 02:11:50.397
How to use lambdas in python heapq?
In python heapq if you are putting in objects, how can u use a lambda to specify its key? Like heapq.heappush(Q, v, key=lambda x: f(x)). Thanks
You can't. Or rather, you can't specify it as a lambda. You can however make a heap of tuples, heapq.heappush(Q, (key(v), v)) and heapq.heappop(Q)[1].
0.995055
false
1
3,539
2015-01-19 12:00:38.780
Using precomputed Gram matrix in sklearn linear models (Lasso, Lars, etc)
I'm trying to train a linear model on a very large dataset. The feature space is small but there are too many samples to hold in memory. I'm calculating the Gram matrix on-the-fly and trying to pass it as an argument to sklearn Lasso (or other algorithms) but, when I call fit, it needs the actual X and y matrices. A...
(My answer is based on the usage of svm.SVC, Lasso may be different.) I think that you are supposed pass the Gram matrix instead of X to the fit method. Also, the Gram matrix has shape (n_samples, n_samples) so it should also be too large for memory in your case, right?
0
false
1
3,540
2015-01-19 12:26:37.383
Django Navigation from Template-Login to a self written index.html
Im using the Django template login and want to navigate from the login to my own written index.html file. so if a user push the "login" button the result page is my index file. My second question is how to use logos in django python and what structure i need in my project. best regards
create custom log-in and registration in your project, and write the custom back-end if you have more user ,if request is came from user to log-in then redirect to index,html,
0
false
2
3,541
2015-01-19 12:26:37.383
Django Navigation from Template-Login to a self written index.html
Im using the Django template login and want to navigate from the login to my own written index.html file. so if a user push the "login" button the result page is my index file. My second question is how to use logos in django python and what structure i need in my project. best regards
1: create your own view that the login button take the person to when clicked and load your index.html template. you do not have to use the built in login. 2: logo? you can use any logo/format you want. Django doesn't come with a template that creates the look of the site (beside the admin one); so you need to create ...
0
false
2
3,541
2015-01-21 00:14:50.383
Trying to understand buffering in Python socket module
I'm trying to learn how socket module works and I have a dumb question: Where is socket.send()'s sent data stored before being cleared by socket.recv()?. I believe there must be a buffer somewhere in the middle awaiting for socket.recv() calls to pull this data out. I just made a test with a server which sent a lot of...
Learn about OSI layers, and different connections such as TCP and UDP. socket.send implements a TCP transmission of data. If you look into the OSI layers, you will find out that the 4th layer (i.e. transport layer) will buffer the data to be transmitted. The default size of the buffer depends on the implementation.
0
false
2
3,542
2015-01-21 00:14:50.383
Trying to understand buffering in Python socket module
I'm trying to learn how socket module works and I have a dumb question: Where is socket.send()'s sent data stored before being cleared by socket.recv()?. I believe there must be a buffer somewhere in the middle awaiting for socket.recv() calls to pull this data out. I just made a test with a server which sent a lot of...
The OS (kernel) buffers the data. On Linux the buffer size parameters may be accessed through the /proc interface. See man 7 socket for more details (towards the end.)
1.2
true
2
3,542
2015-01-21 09:14:03.167
AMPPS Yosemite Python configuration
I am have just recently acquired a new Mac (Yosemite OSX 10.10) I am reconfiguring everything and I need to work with external configs and Python on some new projects. Which bring me to two additional question: how to include an extra configuration with an external config file ? can I just include it to the httpd.con...
As far as I can tell, AMPPS does not work on Yosemite at all (@ v2.8)
1.2
true
1
3,543
2015-01-21 14:19:55.303
Odoo - Write null to numeric column
In Odoo/OpenERP 7, I have a nullable numeric column called balance 'balance': fields.float(string='Balance',digits=(20,2)) I am trying to use Python code to update None into the field self.write(cr, uid, [1], { 'balance':None }) but, rather frustratingly, Python treats None the same as 0 so I end up with 0 in the D...
You can't: the Odoo ORM does not support null numeric values. If you really need to distinguish an "empty" value from a zero value, you need a workaround: either use a string field (simpler, but needs additional checks to allow only number and it's harder to perform calculations) or use a second boolean field to mark e...
1.2
true
1
3,544
2015-01-21 20:34:45.450
How do I make my django application perform a job at a fixed time everyday?
Some tuples in my database need to be erased after a given time. I need my django app to check if the rows have expired. While I can definitely write the function, how do I make Django run at everyday at a fixed time? I have heard about Task Queues like Celery. Are they too much powerful for this? Is their anything sim...
Use a threading.Thread to schedule a continuous event loop. In your thread, use time.sleep to create a gap before the next occurrence of the event.
-0.201295
false
2
3,545
2015-01-21 20:34:45.450
How do I make my django application perform a job at a fixed time everyday?
Some tuples in my database need to be erased after a given time. I need my django app to check if the rows have expired. While I can definitely write the function, how do I make Django run at everyday at a fixed time? I have heard about Task Queues like Celery. Are they too much powerful for this? Is their anything sim...
Use a simple cron job to trigger a custom Django management command.
0.386912
false
2
3,545
2015-01-23 02:12:21.783
Hadoop streaming with Bash - how slow?
I have heard from several articles that Hadoop streaming with bash is significantly slower than a compiled code or python. Is this only true for sort commands and the like? My script needs to -copy file to node -on node execute a commercial program with file as argument -pass output back to folder My intuition is tell...
The main idea why Hadoop Streaming is considered to be slow is that for both mapper and reducer you have to pass arguments via stdin, which means you have to serialize them as a text, and to get the output of both mapper and reducer you have to deserialize them from the text back to Java structures, which usually consu...
0.673066
false
1
3,546
2015-01-23 09:36:19.187
Django: calling a function before session expires
So i'm using the request.session.set_expiry(NUMBER_OF_SECONDS) in order to check if the user of my webpage has been inactive for a number of seconds and clossing the session when it happens. The problem is that i want to call a function for doing some things jsut before the session expires and i don't know how can I do...
You can't. This question betrays a fundamental misunderstanding of how both sessions and web applications work. Web code is stateless; there is nothing "running" for any user in between the requests that user makes. If a user doesn't make any requests for longer than the session timeout, the only time the server code k...
1.2
true
1
3,547
2015-01-23 10:43:50.883
from python 32 bits to python 64 bits
I have some doubts about how to do that, I hope anybody can point me in the correct direction. My current situation is that I am working with the python package Python(x,y) 32 bits in a Windows machine with 64 bits. And, as many of you know, I am having some problems with the Memory error. So that I am thinking about c...
You'll need to reinstall everything for the 64-bit Python, but note that Anaconda and conda may already come with everything that you need.
1.2
true
1
3,548
2015-01-24 10:20:31.563
How can I distribute 100 API calls randomly in a 60 minutes time interval?
I am using an API that returns me articles in my language in determined categories. This API limits me in 100 calls for each interval of 60 minutes. I don't want to make 100 calls straight away and make my script wait until 60 minutes has passed. I could then shoot an API call every 36 seconds, but I also don't want th...
What you could do is choose a min/max interval of how long you want to wait. Keep a note of how many requests have been made in the last 60 minutes and if you're still below the quota, download a document and wait for rand(min, max). This is not very fancy and doesn't distribute the wait times across the whole 60 minut...
1.2
true
1
3,549
2015-01-24 16:00:40.140
how do I get my program to close once finished in python
I have made a number guessing game and once you have guessed the number it will say well done but idle stays open, how do I get it to close?
On windows, you can quit the interpreter with CTRL-z and on linux/mac you can quit with CTRL-D. If you type exit, it will tell you exactly what to do. If you are not running interactively (i.e. by running python your_script.py) the code will just end when it's reached the bottom of the file. If you actually do need to...
0.265586
false
1
3,550
2015-01-24 16:40:30.280
How to install PyGame on Python 3.4?
So I have this little problem. When I try to install PyGame for Python 3.4 I download a .whl (wheel?) file and don't know how to use it. Some guys told me something about pip but don't know how to use/install it.
14 y/o? Good for you! You can put the file into your python/scripts folder and run pip install *file* (where *file* is your filename).
0.135221
false
1
3,551
2015-01-25 11:52:18.403
Bottle, how to get_cookie during AJAX request (same domain)
I use bottle set/get cookie mecanism to track my user_id (with 'secret' param when calling set/get_cookie() During normal http(s) request everything is fine but when making a xhr request (same domain)user_id = request.get_cookie('user_id', secret='mysecret') returns None. When checking on client browser, cookie and key...
I tried to set_cookies('test', 123, secret='mysecret') under AJAX request, it worked, but still couldn't find previous cookies. Then I remarked that my previous cookies, called cook1 and cook2, written under 'normal' http request, if they had same domain, had different 'path' (under Chrome ressource explorer). They w...
0.201295
false
1
3,552
2015-01-25 17:50:33.567
Where does ipython store the current session history?
I use vim with a couple of plugins as a python ide. Along with an open vim session, I run an ipython session in a split console. I've found their combination is a great productivity tool for programming data analysis scripts. What I'm missing is a way to show all current session history in a side panel, so that I coul...
You can output your history with the commands %history -f filename history with lines and sessions %history -g -f filename
0
false
1
3,553
2015-01-26 21:30:29.287
Virtualenv installed package not found
I installed a django-secure into a virtualenv using pip. The install was normal. The module shows up in the virtualenv pip list and in virtualenvs/dev/lib/python2.7/site-packages. I get the following error when running my code. ImportError: No module named djangosecure The folder is in there and there is an init. N...
Make sure your wsgi file points to the right virtualenv!
1.2
true
1
3,554
2015-01-27 00:53:58.830
GitPython - clone_from not working
I am facing an issue while cloning a git repo. I am using function clone_from from GitPython library from git import Repo Repo.clone_from("git://github.com/facebook/buck.git", "D:\sample") I am getting error WindowsError: The system cannot find the file specified Can someone please tell me if this is how to clone a...
You might not have git.ext in your PATH, but that can easily be tested by executing it yourself. If you see an error, you can either add it to the PATH, or set the GIT_PYTHON_GIT_EXECUTABLEto the executable git-python should execute for git commandline services.
0
false
1
3,555
2015-01-27 02:26:45.403
How to execute a remote script using ssh
I know I can find multiple answers to this question but I have a problem with the result. I have a Windows PC with a script on it and a Linux PC that has to start the script using ssh. The problem I am seeing is that for some reason it's using the Linux environment to run the script and not the Windows env. Is this exp...
The solution to my problem is to use PATH=/cygdrive/c/WINDOWS/system32:/bin cmd /c in front of the script call, sth like: ssh user@host "PATH=/cygdrive/c/WINDOWS/system32:/bin cmd /c script" .This will run the script using in Windows env. In my case the problem was that the script was run under cygwin env and I wanted ...
1.2
true
1
3,556
2015-01-27 15:12:16.923
Python threading how get output of multiprocess in sequence
I am using Python threading to process multiple files and I want output of each of the files 0 through 100 being processed to be written in a file in orderly fashion Currently I am saving output of all the thread as they get executed and hence the order is not maintained. How can I achieve this?
How about you create a list of 101 elements, 0 through 100. Then store the output from processing file x into list element x. When all processing is complete, write the data in the list elements from 0 to 100 to the file.
1.2
true
1
3,557
2015-01-27 15:50:06.127
I have 2 ethernet interfaces on the same PC, how to know which interface is connected in python?
I have an embedded system connected with an ethernet port to one of my 2 ethernet interfaces, but I have the problem that my python code for the socket connection does not know where to connect to the embedded. I mean, sometimes I get the connection and sometimes I just don't (and I have to change the cable to the othe...
Unplug one and if it stops working - you found the right one. If it does not stop working it is the other one.
0.995055
false
1
3,558
2015-01-28 02:18:13.590
How to extract mail in "categories" label in gmail?
I am trying to extract mails from gmail using python. I noticed that I can get mails from "[Gmail]/All Mail", "[Gmail]/Drafts","[Gmail]/Spam" and so on. However, is there any method to retrieve mails that are labeled with "Primary", "Social", "Promotions" etc.? These tags are under the "categories" label, and I don't k...
Unfortunately the categories are not exposed to IMAP. You can work around that by using filters in Gmail to apply normal user labels. (Filter on, e.g., category:social.)
0
false
2
3,559
2015-01-28 02:18:13.590
How to extract mail in "categories" label in gmail?
I am trying to extract mails from gmail using python. I noticed that I can get mails from "[Gmail]/All Mail", "[Gmail]/Drafts","[Gmail]/Spam" and so on. However, is there any method to retrieve mails that are labeled with "Primary", "Social", "Promotions" etc.? These tags are under the "categories" label, and I don't k...
Yes, categories are not available in IMAP. However, rather than filters, I found that gmail api is more favorable for me to get mail by category.
0
false
2
3,559
2015-01-28 07:56:44.233
Rotated Paraboloid Surface Fitting
I have a set of experimentally determined (x, y, z) points which correspond to a parabola. Unfortunately, the data is not aligned along any particular axis, and hence corresponds to a rotated parabola. I have the following general surface: Ax^2 + By^2 + Cz^2 + Dxy + Gyz + Hzx + Ix + Jy + Kz + L = 0 I need to produce a...
Do you have enough data points to fit all 10 parameters - you will need at least 10? I also suspect that 10 parameters are to many to describe a general paraboloid, meaning that some of the parameters are dependent. My fealing is that a translated and rotated paraboloid needs 7 parameters (although I'm not really sure)
0
false
2
3,560
2015-01-28 07:56:44.233
Rotated Paraboloid Surface Fitting
I have a set of experimentally determined (x, y, z) points which correspond to a parabola. Unfortunately, the data is not aligned along any particular axis, and hence corresponds to a rotated parabola. I have the following general surface: Ax^2 + By^2 + Cz^2 + Dxy + Gyz + Hzx + Ix + Jy + Kz + L = 0 I need to produce a...
Dont use any toolboxes, GUIs or special functions for this problem. Your problem is very common and the equation you provided may be solved in a very straight-forward manner. The solution to the linear least squares problem can be outlined as: The basis of the vector space is x^2, y^2, z^2, xy, yz, zx, x, y, z, 1. The...
0.386912
false
2
3,560
2015-01-29 13:05:18.690
Run replace command on svn:externals (python)
I am currently writing a python script which needs to run a sed command to replace stuff from the svn:externals data. I tried to run sed on "svn propedit svn:externals ." but the outcome is not the one expected. Does anyone know how to do this ?
First of all, don't use sed. Use Python's string methods or the re module. Second, I recommend to run svn propget ... first, to fetch the old value. Then, you manipulate it (within Python, no need to run sed). Finally, you run svn propset. Alternatively, you could run a second Python script as editor for svn propedit. ...
1.2
true
1
3,561
2015-01-29 22:58:58.810
How to handle C extensions for python apps with pip?
For python applications that install with pip, how can you handle their C extension requirements automatically? For example, the mysqlclient module requires development libs of MySQL installed on the system. When you initially install an application requiring that module it'll fail if the MySQL development libraries a...
So the question is how do I solve this? You have not solve this problem anyhow. There is no any method to describe external dependencies outside of python ecosystem in setup.py. Just provide it in a README.
-0.905148
false
1
3,562
2015-01-30 02:48:03.853
Pygame image collision
I have a pygame program where there's a face in the center. What I want the program to do is have a bunch of objects on the screen, all irregular. Some would be circles, others would be cut-out pictures of objects like surf boards, chairs, bananas, etc. The user would be able to drag the objects around, and they'd coll...
What you are looking for is functionality usually provided by a so-called physics engine. For very basic shapes, it is simple enough to code the basic functionality yourself. (The simplest case for 2D shapes is the collision detection between circles). Collision detection gets pretty hard pretty quickly, especially ...
1.2
true
1
3,563
2015-01-31 16:29:59.003
Flask isn't recognising connections from other clients
I have an apache server setup on a Pi, and i'm trying to learn Flask. I set it up so that The 'view' from the index '/' returns "hello world". then i ran my main program. nothing happens from the browser on the PC i'm SSH'ing from,I just get an error saying , but when i used the Pi directly and went to http:localhost:5...
you need to configure your firewall on your server/workstation to allow connections on port 5000. setting the ip to 0.0.0.0 allows connections to your machine but only if you have the port open. also, you will need to connect via the ip of your machine and not localhost since localhost will only work from the machine...
0
false
1
3,564
2015-02-02 14:48:09.337
How do I debug efficiently with Spyder in Python?
I like Python and I like Spyder but I find debugging with Spyder terrible! Every time I put a break point, I need to press two buttons: first the debug and then the continue button (it pauses at first line automatically) which is annoying. Moreover, rather than having the standard iPython console with auto completion ...
You can use debug shortcut keys like: Step Over F10 Step Into F11 in tools>preferences>keyboard shortcuts
0
false
4
3,565
2015-02-02 14:48:09.337
How do I debug efficiently with Spyder in Python?
I like Python and I like Spyder but I find debugging with Spyder terrible! Every time I put a break point, I need to press two buttons: first the debug and then the continue button (it pauses at first line automatically) which is annoying. Moreover, rather than having the standard iPython console with auto completion ...
Here is how I debug in Spyder in order to avoid freezing the IDE. I do this if I alter the script while in debugging mode. I close out the current IPython (debugging) console [x] Open a new one [Menu bar-> Consoles-> Open an IPython Console] Enter debug mode again [blue play pause button]. Still a bit annoying, but...
0.058243
false
4
3,565
2015-02-02 14:48:09.337
How do I debug efficiently with Spyder in Python?
I like Python and I like Spyder but I find debugging with Spyder terrible! Every time I put a break point, I need to press two buttons: first the debug and then the continue button (it pauses at first line automatically) which is annoying. Moreover, rather than having the standard iPython console with auto completion ...
One minor extra regarding point 3: It also seemed to me the debug console frequently froze, doing prints, evaluating, etc, but pressing the stop (Exit debug) button usually got it back to the bottom of the call stack and then I could go back up ('u') to the frame I was debugging in. Worth a try. This might be for a la...
0
false
4
3,565
2015-02-02 14:48:09.337
How do I debug efficiently with Spyder in Python?
I like Python and I like Spyder but I find debugging with Spyder terrible! Every time I put a break point, I need to press two buttons: first the debug and then the continue button (it pauses at first line automatically) which is annoying. Moreover, rather than having the standard iPython console with auto completion ...
(Spyder maintainer here) After our 4.2.0 version, released in November 2020, the debugging experience in Spyder is quite good. What we provide now is what people coming from Matlab would expect from a debugger, i.e. something that works like IPython and lets you inspect and plot variables at the current breakpoint or f...
1.2
true
4
3,565
2015-02-03 20:38:58.087
Python what is the best way to handle multiple threads
Since my scaper is running so slow (one page at a time) so I'm trying to use thread to make it work faster. I have a function scrape(website) that take in a website to scrape, so easily I can create each thread and call start() on each of them. Now I want to implement a num_threads variable that is the number of thread...
It depends. If your code is spending most of its time waiting for network operations (likely, in a web scraping application), threading is appropriate. The best way to implement a thread pool is to use concurrent.futures in 3.4. Failing that, you can create a threading.Queue object and write each thread as an infinit...
0
false
1
3,566
2015-02-04 06:27:57.790
python background thread cannot trigger function registered at atexit.register()
I have a client and server model. The server periodically sends its healthy condition to client. The client has a background thread to take care of it(main thread is doing something else). Once the client notices the server is in a bad status, it will do some clean up work and then kill itself(kill the client process)....
A background task should never try to kill a foreground task - it might be doing something important. The background task should pass a status of "Restart Needed" and the foreground task should exit when convenient or after prompting the user. This would be an extension of your current status checking. In your backgr...
0
false
1
3,567
2015-02-04 09:42:10.513
how to run Apache with mod_wsgi and django in one process only?
I'm running apache with django and mod_wsgi enabled in 2 different processes. I read that the second process is a on-change listener for reloading code on change, but for some reason the ready() function of my AppConfig class is being executed twice. This function should only run once. I understood that running django ...
You shouldn't prevent spawning multiple processes, because it's good thing, especially on production environment. You should consider using some external tool, separated from django or add check if folder listening is already running (for example monitor persistence of PID file and it's content).
0
false
2
3,568
2015-02-04 09:42:10.513
how to run Apache with mod_wsgi and django in one process only?
I'm running apache with django and mod_wsgi enabled in 2 different processes. I read that the second process is a on-change listener for reloading code on change, but for some reason the ready() function of my AppConfig class is being executed twice. This function should only run once. I understood that running django ...
No, the second process is not an onchange listener - I don't know where you read that. That happens with the dev server, not with mod_wsgi. You should not try to prevent Apache from serving multiple processes. If you do, the speed of your site will be massively reduced: it will only be able to serve a single request at...
0.386912
false
2
3,568
2015-02-04 17:36:50.273
Running Python 3 from Light Table
I am trying Light Table and learning how to use it. Overall, I like it, but I noticed that the only means of making the watches and inline evaluation work in Python programs uses Python 2.7.8, making it incompatible with some of my code. Is there a way to make it use Python 3 instead? I looked on Google and GitHub and ...
I got the same problem. It worked for me after saving the file with a .py extension and then typing Cmd+Enter.
0
false
3
3,569
2015-02-04 17:36:50.273
Running Python 3 from Light Table
I am trying Light Table and learning how to use it. Overall, I like it, but I noticed that the only means of making the watches and inline evaluation work in Python programs uses Python 2.7.8, making it incompatible with some of my code. Is there a way to make it use Python 3 instead? I looked on Google and GitHub and ...
Hit Ctrl + Space to bring up the control pane. Then start typing Set Syntax and select Set Syntax to Python. Start typing your Python then press Ctrl + Shift + Enter to build and run the program.
0
false
3
3,569