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
2015-07-03 00:40:59.403
ipdb debugger, step out of cycle
Is there a command to step out of cycles (say, for or while) while debugging on ipdb without having to use breakpoints out of them? I use the until command to step out of list comprehensions, but don't know how could I do a similar thing, if possible, of entire loop blocks.
This could sound obvious: jump makes you jump. This means that you don't execute the lines you jump: you should use this to skip code that you don’t want to run. You probably need tbreak (Temporary breakpoint, which is removed automatically when it is first hit. The arguments are the same as break) as I did when I fo...
1.2
true
2
3,821
2015-07-04 23:17:07.347
Anaconda and pkg-config on osx 10.10: how to prevent pip installation problems?
I'm using anaconda python 2.7, and keep finding problems installing python libraries using pip that seem to rely on pkg-config. In particular, python-igraph (although the author of that library kindly added a patch to help conda users) and louvain (which I have yet to fix). Would installing pkg-config lead to conflict...
I faced some installation issues with Anaconda and my fix was to download manually the components of the Anaconda package. If you use sudo apt-get python3-numpy for example, it will download as well as all the dependencies. So all you have to do is download the major libraries. Although I don't believe pkg-config ca...
0.386912
false
1
3,822
2015-07-05 21:14:58.877
How to downgrade python version on CentOS?
I have a dedicated web server which runs CentOS 6.6 I am running some script that uses Python SHA module and I think that this module is deprecated in the current Python version. I am consider downgrading my Python installation so that I can use this module. Is there a better option? If not, how should I do it? These ...
You can always install a different version of Python using the -altinstall argument, and then run it either in a virtual environment, or just run the commands with python(version) command. A considerable amount of CentOS is written in Python so changing the core version will most likely break some functions.
1.2
true
1
3,823
2015-07-07 08:04:47.837
Django i18n Problems
I have a Django 1.8 project that I would like to internationalize. I have added the code to do so in the application, and when I change the LANGUAGE_CODE tag, I can successfully see the other language used, but when I leave it on en-us, no other languages show up. I have changed my computer's language to the language i...
I just needed to add'django.middleware.locale.LocaleMiddleware' to my settings.py file in the MIDDLEWARE_CLASSES section. I figured if internationalization was already on that this wouldn't be necessary.
0
false
1
3,824
2015-07-07 23:29:09.280
Django: modifying data with user input through custom template tag?
Is it possible to modify data through custom template tag in Django? More specifically, I have a model named Shift whose data I want to display in a calendar form. I figured using a custom inclusion tag is the best way to go about it, but I also want users to be able to click on a shift and buy/sell the shift (thus mod...
This type of logic does not belong in a template tag. It belongs in a view that will respond to AJAX requests and return a JSONResponse. You'll need some javascript to handle making the request based on the input as well.
1.2
true
1
3,825
2015-07-08 00:17:37.963
I want my already created virtualenv to have access to system packages
I've recently installed opencv3 on ubuntu 14.04. The tutorial I followed was for some reason using a virtualenv. Now I want to move opencv from the virtual to my global environment. The reason for this is that I can't seem to use the packages that are installed on my global environment which is getting on my nerves. So...
I'm not sure I got your question right, but probably your virtualenv has been created without specifying the option --system-site-packages, which gives your virtualenv access to the packages you installed system-wise. If you run virtualenv --system-site-packages tutorial_venv instead of just virtualenv tutorial_venv wh...
0.999329
false
1
3,826
2015-07-08 04:14:21.400
Convert to PDF's Last Page using GraphicsMagick with Python
To convert a range of say the 1st to 5th page of a multipage pdf into single images is fairly straight forward using: convert file.pdf[0-4] file.jpg But how do i convert say the 5th to the last page when i dont know the number of pages in the pdf? In ImageMagick "-1"represents the last page, so: convert file.pdf[4--1]...
Future readers of this, if you're experiencing the same dilemma in GraphicsMagick. Here's the easy solution: Simply write a big number to represent the "last page". That is: something like: convert file.pdf[4-99999] +adjoin file%02d.jpg will work to convert from the 5th pdf page to the last pdf page, into jpgs. Note: ...
0
false
1
3,827
2015-07-08 05:31:56.647
Multiple verify_password callbacks on flask-httpauth
Working on a Flask application which will have separate classes of routes to be authenticated against: user routes and host routes(think Airbnb'esque where users and hosts differ substantially). Creating a single verify_password callback and login_required combo is extremely straightforward, however that isn't sufficie...
The way I intended that to be handled is by creating two HTTPAuth objects. Each gets its own verify_password callback, and then you can decorate each route with the decorator that is appropriate.
1.2
true
1
3,828
2015-07-08 14:15:05.030
Django 1.8 and Python 2.7 using PostgreSQL DB help in fetching
I'm making an application that will fetch data from a/n (external) postgreSQL database with multiple tables. Any idea how I can use inspectdb only on a SINGLE table? (I only need that table) Also, the data in the database would by changing continuously. How do I manage that? Do I have to continuously run inspectdb? But...
I think you have misunderstood what inspectdb does. It creates a model for an existing database table. It doesn't copy or replicate that table; it simply allows Django to talk to that table, exactly as it talks to any other table. There's no copying or auto-fetching of data; the data stays where it is, and Django reads...
1.2
true
1
3,829
2015-07-08 14:34:52.837
Python ncurses - how to trigger actions while user is typing?
I am reading user input text with getstr(). Instead of waiting for the user to press enter, I would like to read the input each time it is changed and re-render other parts of the screen based on the input. Is this possible with getstr()? How? If not, what's the simplest/easiest alternative?
Not with getstr(), but it's certainly possible with curses. You just have to read each keypress one at a time, via getch() -- and, if you want an editable buffer, you have to recreate something like the functionality of getstr() yourself. (I'd post an example, but what I have is in C rather than Python.)
0
false
1
3,830
2015-07-10 03:15:26.337
How does Python's interactive mode work?
I want to know how Python interactive mode works. Usually when you run Python script on CPython it will go trough the process of lexical analysis, parsing, gets compiled into .pyc file, and finally the .pyc file is interpreted. Does this 4-step process happen while using interactive mode also, r is there a more effici...
Python has two basic modes: normal and interactive. The normal mode is the mode where the scripted and finished .py files are run in the Python interpreter. Interactive mode is a command line shell which gives immediate feedback for each statement, while running previously fed statements in active memory. As new lines ...
1.2
true
1
3,831
2015-07-12 06:36:32.220
Can PyCharm set breakpoints on ipython notebook?
I'd like to know how to set breakpoints in IPython notebook on PyCharm. If it's possible, please let me know.
You must start IPython Notebook from Pycharm's run Find the IPython path (ex which ipython on linux). Copy the resulting path, we will need it! On PyCharm go to Run > Edit Configuration > + button on top left most corner (add configuration) > Choose Python. Give your configuration a name. On the configuration tab, i...
1.2
true
1
3,832
2015-07-12 15:49:18.257
Adding server certificates to CA_BUNDLE in python
I'm using requests to communicate with remote server over https. At the moment I'm not verifying SSL certificate and I'd like to fix that. Within requests documentation, I've found that: You can pass verify the path to a CA_BUNDLE file with certificates of trusted CAs. This list of trusted CAs can also be specified ...
This is actually trivial... CA_BUNDLE can be any file that you append certificates to, so you can simply append the output of ssl.get_server_certificate() to that file and it works.
0.673066
false
1
3,833
2015-07-12 17:25:41.693
Social login in using django-allauth without leaving the page
I'm using django 1.8.3 and django-allauth 0.21.0 and I'd like the user to be able to log in using e.g. their Google account without leaving the page. The reason is that there's some valuable data from the page they're logging in from that needs to be posted after they've logged in. I've already got this working fine us...
One option is that the primary form pops up social auth in a new window then uses AJAX to poll for whether the social auth has completed. As long as you are fine with the performance characteristics of this (it hammers your server slightly), then this is probably the simplest solution.
0
false
2
3,834
2015-07-12 17:25:41.693
Social login in using django-allauth without leaving the page
I'm using django 1.8.3 and django-allauth 0.21.0 and I'd like the user to be able to log in using e.g. their Google account without leaving the page. The reason is that there's some valuable data from the page they're logging in from that needs to be posted after they've logged in. I've already got this working fine us...
I ended up resolving this by using Django's session framework. It turns out that the session ID is automatically passed through the oauth procedure by django-allauth, so anything that's stored in request.session is accessible on the other side after login is complete.
1.2
true
2
3,834
2015-07-13 07:01:48.093
Customize frappe framework html layout
ERPNext + frappe need to change layout(footer & header) front-end. I tried to change base.html(frappe/templates/base.html) but nothing happened. Probably this is due to the fact that the html files need to somehow compile. Maybe someone have info how to do it? UPDATE: No such command "clear-cache". Commands: backup ...
bench clear-cache will clear the cache. After doing this, refresh and check.
0
false
3
3,835
2015-07-13 07:01:48.093
Customize frappe framework html layout
ERPNext + frappe need to change layout(footer & header) front-end. I tried to change base.html(frappe/templates/base.html) but nothing happened. Probably this is due to the fact that the html files need to somehow compile. Maybe someone have info how to do it? UPDATE: No such command "clear-cache". Commands: backup ...
It seems you're not in your bench folder. When you create a new bench with, for example : bench init mybench it creates a new folder : mybench. All bench commands must be run from this folder. Could you try to run bench --help in this folder ? You should see the clear-cache command.
0
false
3
3,835
2015-07-13 07:01:48.093
Customize frappe framework html layout
ERPNext + frappe need to change layout(footer & header) front-end. I tried to change base.html(frappe/templates/base.html) but nothing happened. Probably this is due to the fact that the html files need to somehow compile. Maybe someone have info how to do it? UPDATE: No such command "clear-cache". Commands: backup ...
If anyone stumbles on this. The command needed is bench build. That will compile any assets related to the build.json file in the public folder. (NOTE: You usually have to create build.json yourself).
0
false
3
3,835
2015-07-13 15:44:30.263
Wait 5 seconds before download button appear
I know how to do that with javascript but I need a secure way to do it. Anybody can view page source, get the link and do not wait 5 seconds. Is there any solution? I'm working with javascript and django. Thanks!
The only secure way would be to put the logic on the server that checks the time. Make an Ajax call to the server. If the time is under 5 seconds, do not return the HTML, if it is greater than , than return the html to show. Other option is to have the link point to your server and if the time is less than five second...
1.2
true
2
3,836
2015-07-13 15:44:30.263
Wait 5 seconds before download button appear
I know how to do that with javascript but I need a secure way to do it. Anybody can view page source, get the link and do not wait 5 seconds. Is there any solution? I'm working with javascript and django. Thanks!
Use server side timeout.. whenever there is (AJAX) request from client for download link with timestamp, compare the client sent timestamp with currenttime and derive how much time is required to halt the request at server side to make up ~5 seconds. So by comparing timestamp you can almost achieve accuracy of waiting ...
0
false
2
3,836
2015-07-13 19:56:22.490
Clear postgresql and alembic and start over from scratch
Everything I found about this via searching was either wrong or incomplete in some way. So, how do I: delete everything in my postgresql database delete all my alembic revisions make it so that my database is 100% like new
This works for me: 1) Access your session, in the same way you did session.create_all, do session.drop_all. 2) Delete the migration files generated by alembic. 3) Run session.create_all and initial migration generation again.
0.386912
false
1
3,837
2015-07-14 20:51:35.893
Python pickle dump memory error
I have a very large list that I want to write to file. My list is 2 dimensional, and each element of the list is a 1 dimensional list. Different elements of the 2 dimensional list has 1 dimensional lists of varying size. When my 2D list was small, pickle dump worked great. But now it just gives me memory error. Any s...
If you really want to keep it simple and use something like pickle, the best thing is to use cPickle. This library is written in C and can handle bigger files and is faster than pickle.
0
false
1
3,838
2015-07-15 01:39:09.903
How to make dataframe in pandas as numeric?
I am learning the book Python for Data Analysis, after running the code from the book I got a pandas dataframe diversity like this: sex F M year 1880 [38] [14] 1881 [38] [14] When I want to use diversity.plot() to draw some pictures, there is TypeError: Empty 'DataFrame': no numeric data to plot So, my question ...
It seems that you have a list of int in your data frame. To convert it to you need to select the value inside and form data frame. I suggest you this code to convert for col in df: df[col] = df[col].apply(lambda x: x[0])
1.2
true
1
3,839
2015-07-15 21:18:03.280
Admob Ads with Python Subset For Android (PGS4A)
I'd like to have advertisements in an android App I've written and built using PGS4A. I've done my research and all, but there doesn't seem to be any online resources that explains how to do that just yet. I haven't much knowledge on Java either, which is clearly why I've written that in Python. Has anyone found a way ...
To access Java already implemented version you can use pyjnius. I tried to use it for something else and I didn't succeed. Well, I yielded pretty quickly because it wasn't necessary for my project. Otherwise, I am afraid, you will have to implement it yourself from scratch. I never heard about a finished solution for ...
0
false
1
3,840
2015-07-16 00:51:51.340
Python Modules Only Installing For Python 2
I'm fairly new to python and want to start doing some more advanced programming in python 3. I installed some modules using pip on the terminal (I'm using a mac) only to find out that the modules only installed for python 2. I think that it's because I only installed it to the python 2 path, which I think is because my...
When creating your virtual environment (you are using a virtual environment, right?) use pyvenv <foo> instead of virtualenv <foo>, and that will create a Python 3 virtual environment, free of Python 2. Then you are free to use pip and it will install the modules into that venv.
-0.201295
false
2
3,841
2015-07-16 00:51:51.340
Python Modules Only Installing For Python 2
I'm fairly new to python and want to start doing some more advanced programming in python 3. I installed some modules using pip on the terminal (I'm using a mac) only to find out that the modules only installed for python 2. I think that it's because I only installed it to the python 2 path, which I think is because my...
You need to use pip3. OS X will default to Python 2 otherwise.
1.2
true
2
3,841
2015-07-16 07:30:55.310
Where to run python file on Remote Debian Sever
I have written a python script that is designed to run forever. I load the script into a folder that I made on my remote server which is running debian wheezy 7.0. The code runs , but it will only run for 3 to 4 hours then it just stops, I do not have any log information on it stopping.I come back and check the running...
Basically you're stuffed. Your problem is: You have a script, which produces no error messages, no logging, and no other diagnostic information other than a single timestamp, on an output file. Something has gone wrong. In this case, you have no means of finding out what the issue was. I suggest any of the following...
0
false
1
3,842
2015-07-17 00:02:58.870
How to determine how to format an HTTP request to some server
Please bear with me as I have been reading and trying to understand HTTP and the different requests available in its protocol but there are still a few loose connections here and there. Specifically, I have been using Apache's HttpClient to send requests, but I'm unsure of a few things. When we make a request to a URI,...
If you try to PUT without any knowledge of the server this request will "fail" (or not - depends on the implementation e.g. it can redirect you to main page). Failure is indicated by the server response code along with headers. E.g. 405 Method Not Allowed or 400 bad request etc. Or redirect you to main page: 302 Found...
0
false
1
3,843
2015-07-17 17:14:00.357
How to determine which Python standard library module(s) contain a certain method?
Given a method name, how to determine which module(s) in the standard library contain this method? E.g. If I am told about a method called strip(), but told nothing about how it works or that it is part of str, how would I go and find out which module it belongs to? I obliviously mean using Python itself to find out, n...
The trouble is, strip is not defined in any module. It is not a part of the standard library at all, but a method on str, which in turn is a built in class. So there isn't really any way of iterating through modules to find it.
0.386912
false
1
3,844
2015-07-17 22:30:01.683
Pygame, user input on a GUI?
I need a user input for my pygame program, but I need it on my GUI(pygame.display.set_mode etc.), not just like: var = input("input something"). Does anybody have suggestions how to do this?
There are some answers already here. Anyway, use PGU (Pygame GUI Utilities), it's available on pygame's site. It turns pygame into GUI toolkit. There is an explanation on how to combine it and your game. Otherwise, program it yourself using key events. It's not hard but time consuming and boring.
0
false
1
3,845
2015-07-18 20:39:21.773
Installing Packages in Python - Pip/cmd vs Putting File in Lib/site-packages
Whenever I google 'importing X package/module' I always see a bunch of tutorials about using pip or the shell commands. But I've always just taken the downloaded file and put it in the site-packages folder, and when I just use 'import' in PyCharm it has worked just fine. The reason I was wondering was because I was dow...
One of the points of using a package manager (pip) is portability. With pip, you just include a requirements.txt in your project and you can work on it on any machine, be it Windows, Linux, or Mac. When moving to a new environment/OS, pip will take care of installing the packages properly for you; note that packages ca...
0.386912
false
2
3,846
2015-07-18 20:39:21.773
Installing Packages in Python - Pip/cmd vs Putting File in Lib/site-packages
Whenever I google 'importing X package/module' I always see a bunch of tutorials about using pip or the shell commands. But I've always just taken the downloaded file and put it in the site-packages folder, and when I just use 'import' in PyCharm it has worked just fine. The reason I was wondering was because I was dow...
Package manager solves things like dependencies and uninstalling. Additionally, when using pip to install packages, packages are usually being built with setup.py script. While it might not be an issue for pure Python modules, if package contains any extension modules or some other custom stuff, copying files to site-p...
0.386912
false
2
3,846
2015-07-19 22:06:56.717
Django app initialization process
There is a set of functions that I need to carry out during the start of my server. Regardless of path whether that be "/", "/blog/, "/blog/post". For developments purposes I'd love for this script to run every time I run python manage.py runserver and for production purposes I would love this script to run during depl...
Sounds like the quickest (if not most elegant) solution would be to call 'python manage.py runserver' at the end of your script.
0
false
1
3,847
2015-07-20 03:54:51.290
PIP install unable to find ffi.h even though it recognizes libffi
I have installed libffi on my Linux server as well as correctly set the PKG_CONFIG_PATH environment variable to the correct directory, as pip recognizes that it is installed; however, when trying to install pyOpenSSL, pip states that it cannot find file 'ffi.h'. I know both thatffi.h exists as well as its directory, so...
You need to install the development package for libffi. On RPM based systems (Fedora, Redhat, CentOS etc) the package is named libffi-devel. Not sure about Debian/Ubuntu systems, I'm sure someone else will pipe up with that.
0.151877
false
3
3,848
2015-07-20 03:54:51.290
PIP install unable to find ffi.h even though it recognizes libffi
I have installed libffi on my Linux server as well as correctly set the PKG_CONFIG_PATH environment variable to the correct directory, as pip recognizes that it is installed; however, when trying to install pyOpenSSL, pip states that it cannot find file 'ffi.h'. I know both thatffi.h exists as well as its directory, so...
To add to mhawke's answer, usually the Debian/Ubuntu based systems are "-dev" rather than "-devel" for RPM based systems So, for Ubuntu it will be apt-get install libffi libffi-dev RHEL, CentOS, Fedora (up to v22) yum install libffi libffi-devel Fedora 23+ dnf install libffi libffi-devel OSX/MacOS (assuming homebrew is...
0.995055
false
3
3,848
2015-07-20 03:54:51.290
PIP install unable to find ffi.h even though it recognizes libffi
I have installed libffi on my Linux server as well as correctly set the PKG_CONFIG_PATH environment variable to the correct directory, as pip recognizes that it is installed; however, when trying to install pyOpenSSL, pip states that it cannot find file 'ffi.h'. I know both thatffi.h exists as well as its directory, so...
You need to install the development package as well. libffi-dev on Debian/Ubuntu, libffi-devel on Redhat/Centos/Fedora.
1
false
3
3,848
2015-07-20 11:41:24.540
My Python IDLE is missing the Debugging menu
I thought it was coming by default with the IDLE but I don't have it. By the way, I installed Python 3.4. A few researches on the net revealed themselves unfruitful. Any idea about what's going on and how to fix this?
You must be opening the code window not the shell window.. Try opening the shell window.. It has a Debug menu(the shell window) but the code window does not have one..
1.2
true
1
3,849
2015-07-20 15:21:59.017
Movement in 2D Games (round position when blitting?)
I use Python 2.x and Pygame to code games. Pygame has a built-in rect (Rectangle) class that only supports ints instead of floats. So I have made my own rect class (MyRect) which supports floats. Now my question is as follows: A 2D platformer char moves its position (x, y -> both floats). Now when I blit the char onto ...
You should assume that when blitting a pygame.Surface, the position gets converted to an int via int()
0.386912
false
1
3,850
2015-07-20 22:10:48.577
FFT in Python with Explanations
I have a WAV file which I would like to visualize in the frequency domain. Next, I would like to write a simple script that takes in a WAV file and outputs whether the energy at a certain frequency "F" exceeds a threshold "Z" (whether a certain tone has a strong presence in the WAV file). There are a bunch of code snip...
FFT data is in units of normalized frequency where the first point is 0 Hz and one past the last point is fs Hz. You can create the frequency axis yourself with linspace(0.0, (1.0 - 1.0/n)*fs, n). You can also use fftfreq but the components will be negative. These are the same if n is even. You can also use rfftfreq I ...
0.386912
false
1
3,851
2015-07-21 10:44:19.290
Why do multiple processes slow down?
Not sure this is the best title for this question but here goes. Through python/Qt I started multiple processes of an executable. Each process is writing a large file (~20GB) to disk in chunks. I am finding that the first process to start is always the last to finish and continues on much, much longer than the other pr...
There are no guarantees as to fairness of I/O scheduling. What you're describing seems rather simple: the I/O scheduler, whether intentionally or not, gives a boost to new processes. Since your disk is tapped out, the order in which the processes finish is not under your control. You're most likely wasting a lot of dis...
0
false
1
3,852
2015-07-21 16:49:07.660
Django: How to dump the database in 1.8?
I used to use manage.py sqlall app to dump the database to sql statements. While, after upgrading to 1.8, it doesn't work any more. It says: CommandError: App 'app' has migrations. Only the sqlmigrate and sqlflush commands can be used when an app has migrations. It seems there is not a way to solve this. I need to ...
You can dump the db directly with mysqldump as allcaps suggested, or run manage.py migrate first and then it should work. It's telling you there are migrations that you have yet to apply to the DB.
1.2
true
1
3,853
2015-07-21 23:05:12.660
Extracting data from excel pivot tables using openpyxl
I'm working with XLSX files with pivot tables and writing an automated script to parse and extract the data. I have multiple pivot tables per spreadsheet with cost categories, their totals, and their values for each month etc. Any ideas on how to use openpyxl to parse each pivot table?
This is currently not possible with openpyxl.
0
false
1
3,854
2015-07-22 03:27:29.843
PyCharm - how to use a folder that is not in the base directory
I want to use a folder that is not in the base directory of my django project without adding it in to the base directory.
Open File > settings menu and then goto project: foo > Project Structure and press Add Content Root, then select destination directory. and after folder added in list, right click on the folder and set as source, in last step press OK...
1.2
true
1
3,855
2015-07-23 07:10:25.340
Creating a disk-based data structure
I couldn't find any resources on this topic. There are a few questions with good answers describing solutions to problems which call for data stored on disk (pickle, shelve, databases in general), but I want to learn how to implement my own. 1) If I were to create a disk based graph structure in Python, I'd have to im...
There's quite a number of problems you have to solve, some are quite straight forward and some are a little bit more elaborate, but since you want to do it yourself I don't think you minding about filling out details yourself (so I'll skip some parts). First simple step is to serialize and deserialize nodes (in order t...
1.2
true
1
3,856
2015-07-23 08:28:00.100
curl and curl options to python conversion
Using python 2.7, I need to convert the following curl command to execute in python. curl -b /tmp/admin.cookie --cacert /some/cert/location/serverapache.crt --header "X-Requested-With: XMLHttpRequest" --request POST "https://www.test.com" I am relatively new to Python and are not sure how to use the urllib library or...
Can you stay under command line ? If yes, try the python lib nammed "pexpect". It's pretty useful, and let you run commands like on a terminal, from a python program, and interact with the terminal !
0
false
1
3,857
2015-07-23 11:18:07.290
Add generated Python file as part of build
I am generating some Python files in my setup.py as part of the build process. These files should be part of the installation. I have successfully added my code generator as a pre-build step (by implementing my own Command and overriding the default build to include this). How do I copy my generated files from the temp...
I solved this by subclassing build_py instead of build. It turns out build_py has a build_lib attribute that will be the path to the "build" directory. By looking at the source code I think there is no better way.
1.2
true
1
3,858
2015-07-24 09:17:07.057
Compiling a unix make file for windows
I have a c-program which includes a make file that works fine on unix systems. Although I would like to compile the program for windows using this make file, how can i go around doing that? Additionally I have python scripts that call this c-program using ctypes, I don't imagine I will have to much of an issue getting ...
Answer to your first paragraph: Use MinGW for the compiler (google it, there is a -w64 version if you need that) and MSYS for a minimal environment including shell tools the Makefile could need.
0.386912
false
1
3,859
2015-07-24 12:54:45.370
How to identify objects related to KD Tree data?
I've been studying KD Trees and KNN searching in 2D & 3D space. The thing I cannot seem to find a good explanation of is how to identify which objects are being referenced by each node of the tree. Example would be an image comparison database. If you generated descriptors for all the images, would you push all the de...
A typical KD tree node contains a reference to the data point. A KD tree that only keeps the coordinates is much less useful. This way, you can easily identify them.
0
false
1
3,860
2015-07-24 13:39:32.137
Theano continue training
I am looking for some suggestions about how to do continue training in theano. For example, I have the following: classifier = my_classifier() cost = () updates = [] train_model = theano.function(...) eval_model = theano.function(...) best_accuracy = 0 while (epoch < n_epochs): train_model() current_accura...
When pickling models, it is always better to save the parameters and when loading re-create the shared variable and rebuild the graph out of this. This allow to swap the device between CPU and GPU. But you can pickle Theano functions. If you do that, pickle all associated function at the same time. Otherwise, they will...
0
false
1
3,861
2015-07-25 11:34:53.893
Can't find IPython Kernel .JSON file
I'm trying to setup a remote kernel on my Raspberry Pi right now, using IPython as my remote kernel and try to connect to this kernel using Spyder. Using Spyder to create local kernels and use them to interpret code is working perfectly fine. Starting a kernel on my Raspberry Pi also works well using ipython kernel. As...
On my Raspberry PI the .json are located in /home/<username>/.config/ipython/profile_default/security/
0
false
1
3,862
2015-07-25 20:09:30.433
Is a HTTP Get request of size 269KB allowed?
I am debugging a test case. I use Python's OptionParser (from optparse) to do some testing and one of the options is a HTTP request. The input in this specific case for the http request was 269KB in size. So my python program fails with "Argument list too long" (I verified that there was no other arguments passed, just...
Is it possible for a HTTP request to be that big ? Yes it's possible but it's not recommended and you could have compatibility issues depending on your web server configuration. If you need to pass large amounts of data you shouldn't use GET. If so how do I fix the OptionParser to handle this input? It appears that...
0.386912
false
3
3,863
2015-07-25 20:09:30.433
Is a HTTP Get request of size 269KB allowed?
I am debugging a test case. I use Python's OptionParser (from optparse) to do some testing and one of the options is a HTTP request. The input in this specific case for the http request was 269KB in size. So my python program fails with "Argument list too long" (I verified that there was no other arguments passed, just...
A GET request, unlike a POST request, contains all its information in the url itself. This means you have an URL of 269KB, which is extremely long. Although there is no theoretical limit on the size allowed, many servers don't allow urls of over a couple of KB long and should return a 414 response code in that case. A...
0.265586
false
3
3,863
2015-07-25 20:09:30.433
Is a HTTP Get request of size 269KB allowed?
I am debugging a test case. I use Python's OptionParser (from optparse) to do some testing and one of the options is a HTTP request. The input in this specific case for the http request was 269KB in size. So my python program fails with "Argument list too long" (I verified that there was no other arguments passed, just...
Typical limit is 8KB, but it can vary (like, be even less).
1.2
true
3
3,863
2015-07-26 11:30:18.177
Collecting results from celery worker with asyncio
I am having a Python application which offloads a number of processing work to a set of celery workers. The main application has to then wait for results from these workers. As and when result is available from a worker, the main application will process the results and will schedule more workers to be executed. I woul...
I implement on_finish function of celery worker to publish a message to redis then in the main app uses aioredis to subscribe the channel, once got notified, the result is ready
0.386912
false
1
3,864
2015-07-26 16:59:32.277
multiple versions of django/python in a single project
I have been building a project on Ubuntu 15.04 with Python 3.4 and django 1.7. Now I want to use scrapy djangoitem, but that only runs on python 2.7. It's easy enough to have separate virtualenvs to do the developing in, but how can i put these different apps together in a single project, not only on my local machine, ...
It's impossible for apps in the same project to be on different Python versions; the server has to run on one or the other. But it would be possible to have two projects, with your models in a shared app that is installed in both models, and the configuration pointing to the same database.
0.995055
false
1
3,865
2015-07-26 23:19:21.413
Finding if two strings are almost similar
I want to find out if you strings are almost similar. For example, string like 'Mohan Mehta' should match 'Mohan Mehte' and vice versa. Another example, string like 'Umesh Gupta' should match 'Umash Gupte'. Basically one string is correct and other one is a mis-spelling of it. All my strings are names of people. Any s...
You could split the string and check to see if it contains at least one first/last name that is correct.
0.067922
false
1
3,866
2015-07-27 04:08:06.323
Importing a python module I have created
I know how to import a module I have created if the script I am working on is in the same directory. I would like to know how to set it up so I can import this module from anywhere. For example, I would like to open up Python in the command line and type "import my_module" and have it work regardless of which directo...
You could create pth file with path to your module and put it into your Python site-packages directory.
0
false
2
3,867
2015-07-27 04:08:06.323
Importing a python module I have created
I know how to import a module I have created if the script I am working on is in the same directory. I would like to know how to set it up so I can import this module from anywhere. For example, I would like to open up Python in the command line and type "import my_module" and have it work regardless of which directo...
To make this work consistently, you can put the module into the lib folder inside the python folder, then you can import it regardless of what directory you are in
0
false
2
3,867
2015-07-27 09:21:11.480
How to create empty wordpress permalink and redirect it into django website?
I need to do such thing, but I don't even know if it is possible to accomplish and if so, how to do this. I wrote an Django application which I would like to 'attach' to my wordpress blog. However, I need a permalink (but no page in wordpress pages section) which would point to Django application on the same server. I...
There are many ways to do this. You will have to provide more info about what you are trying to accomplish to give the right advise. make a page with a redirect (this is an ugly solution in seo and user perspective) handle this on server level. load your Django data with an ajax call
0.386912
false
1
3,868
2015-07-27 18:07:21.627
How to save a graph that is generated by GNU Radio?
I have generated the spectrogram with GNU Radio and want to save the output graph but have no idea how to do it.
The "QT GUI Frequency Sink" block will display the frequency domain representation of a signal. You can save a static image of the spectrum by accessing the control panel using center-click and choosing "Save".
1.2
true
1
3,869
2015-07-27 18:58:13.027
Keep menu up after clicking in wxPython
I am using wxPython to write an app. I have a menu that pops up. I would like to know how to keep it on the screen after the user clicks an item on the menu. I only want it to go away after the click off it or if I tell it to in the programming. Does anyone know how to do this? I am using RHEL 6 and wxPython 3.01.1
I don't think the regular wx.PopupMenu will work that way. However if you look at the wxPython demo, you will see a neat widget called wx.PopupWindow that claims it can be used as a menu and it appears to work the way you want. The wx.PopupTransientWindow might also work.
0
false
1
3,870
2015-07-28 12:05:42.230
Access ORM models from different classes in Odoo/OpenERP
I am aware that you can get a reference to an existing model from within another model by using self.pool.get('my_model') My question is, how can I get a reference to a model from a Python class that does NOT extend 'Model'?
It's pretty basic and simple any python class can be called from it's name space, so call your class from namespace and instanciate the class. Even Model class or any class inherited from Model can be called and instanciated like this. Self.pool is just orm cache to access framework persistent layer. Bests
0
false
1
3,871
2015-07-28 18:29:03.303
Automatically create requirements.txt
Sometimes I download the python source code from github and don't know how to install all the dependencies. If there is no requirements.txt file I have to create it by hands. The question is: Given the python source code directory is it possible to create requirements.txt automatically from the import section?
To help solve this problem, always run requirements.txt on only local packages. By local packages I mean packages that are only in your project folder. To do this do: Pip freeze —local > requirements.txt Not pip freeze > requirements.txt. Note that it’s double underscore before local. However installing pipreqs helps t...
0
false
1
3,872
2015-07-28 19:05:06.847
Configure Web2Py to use Anaconda Python
I am new to Web2Py and Python stack. I need to use a module in my Web2Py application which uses "gensim" and "nltk" libraries. I tried installing these into my Python 2.7 on a Windows 7 environment but came across several errors due to some issues with "numpy" and "scipy" installations on Windows 7. Then I ended up res...
The Windows binary includes it's own Python interpreter and will therefore not see any packages you have in your local Python installation. If you already have Python installed, you should instead run web2py from source.
1.2
true
1
3,873
2015-07-29 21:34:07.353
random forest with specified false positive and sensitivity
Using the randomForest package in R, I was able to train a random forest that minimized overall error rate. However, what I want to do is train two random forests, one that first minimizes false positive rate (~ 0) and then overall error rate, and one that first maximizes sensitivity (~1), and then overall error. Anoth...
You can do a grid serarch over the 'regularazation' parameters to best match your target behavior. Parameters of interest: max depth number of features
0
false
1
3,874
2015-08-01 08:53:35.083
Is it possible to develop the back-end of a native mobile app using the python powered framework Django?
I want to develop a online mobile app. I am thinking about using native languages to develop the front-ends, so Java for Android and Objective-C for iOS. However, for the back-end, can I use something like Django? I have used django for a while, but the tutorials are really lacking, so can anyone point me to something ...
Sure. I've done this for my first app and others then. The backend technology is totally up to you, so feel free to take whatever you like. The connection between backend and your apps should (but don't have to be) be something JSON-based. Standard REST works fine, Websockets also but have some issues on iOS.
0
false
1
3,875
2015-08-04 01:01:17.540
How Do I Turn Off Python Error Checking in vim? (vim terminal 7.3, OS X 10.11 Yosemite)
Overview After upgrading to 10.11 Yosemite, I discovered that vim (on the terminal) highlights a bunch of errors in my python scripts that are actually not errors. e.g. This line: from django.conf.urls import patterns gets called out as an [import-error] Unable to import 'django.conf.urls'. This error is not true becau...
Vim doesn't check Python syntax out of the box, so a plugin is probably causing this issue. Not sure why an OS upgrade would make a Vim plugin suddenly start being more zealous about things, of course, but your list of installed plugins (however you manage them) is probably the best place to start narrowing down your p...
1.2
true
1
3,876
2015-08-06 07:50:47.297
Django (grappelli): how add my own css to all the pages or how to extend admin's base.html?
In Django grappelli, how can I add my own css files to all the admin pages? Or is there a way to extend admin's base.html template?
If you want to change the appearance of the admin in general you should override admin templates. This is covered in details here: Overriding admin templates. Sometimes you can just extend the original admin file and then overwrite a block like {% block extrastyle %}{% endblock %} in django/contrib/admin/templates/admi...
0.201295
false
1
3,877
2015-08-06 12:28:06.673
How can I share Jupyter notebooks with non-programmers?
I am trying to wrap my head around what I can/cannot do with Jupyter. I have a Jupyter server running on our internal server, accessible via VPN and password protected. I am the only one actually creating notebooks but I would like to make some notebooks visible to other team members in a read-only way. Ideally I coul...
Michael's suggestion of running your own nbviewer instance is a good one I used in the past with an Enterprise Github server. Another lightweight alternative is to have a cell at the end of your notebook that does a shell call to nbconvert so that it's automatically refreshed after running the whole thing: !ipython n...
0.999329
false
1
3,878
2015-08-06 16:05:02.583
Sharing a resource (file) across different python processes using HDFS
So I have some code that attempts to find a resource on HDFS...if it is not there it will calculate the contents of that file, then write it. And next time it goes to be accessed the reader can just look at the file. This is to prevent expensive recalculation of certain functions However...I have several processes ru...
(Setting aside that it sounds like HDFS might not be the right solution for your use case, I'll assume you can't switch to something else. If you can, take a look at Redis, or memcached.) It seems like this is the kind of thing where you should have a single service that's responsible for computing/caching these result...
1.2
true
1
3,879
2015-08-06 21:51:33.943
Installing Scrapy on Python VirtualEnv
Here's my problem, I have a shared hosting (GoDaddy Linux Hosting package) account and I'd like to create .py file to do some scraping for me. To do this I need the scrapy module (scrapy.org). Because of the shared account I can't install new modules so I installed VirtualEnv and created a new virtual env. that has pip...
It's not possible to do what I wanted to do on the GoDaddy plan I had.
1.2
true
1
3,880
2015-08-06 21:57:47.623
Keep Python script running after screen lock (Win. 7)
I am running a Python script that uses the requests library to get data from a service. The script takes a while to finish and I am currently running it locally on my Windows 7 laptop. If I lock my screen and leave, will the script continue to run (for ~3 hours) without Windows disconnecting from the internet or haltin...
As long as the computer doesn't get put to sleep, your process should continue to run.
1.2
true
2
3,881
2015-08-06 21:57:47.623
Keep Python script running after screen lock (Win. 7)
I am running a Python script that uses the requests library to get data from a service. The script takes a while to finish and I am currently running it locally on my Windows 7 laptop. If I lock my screen and leave, will the script continue to run (for ~3 hours) without Windows disconnecting from the internet or haltin...
Check "Power Options" in the Control panel. You don't need to worry about the screen locking or turning off as these wont affect running processes. However, if your system is set to sleep after a set amount of time you may need to change this to Never. Keep in mind there are separate settings depending on whether or no...
0.998178
false
2
3,881
2015-08-07 05:52:18.567
Python Priting Out Something While Waiting For Long Output
I created a python file that collect data. After collecting all the data, it will print out "Done.". Sometimes, it might take atleast 3 minutes to collect all the data. I would like to know how to print something like "Please wait..." for every 30 seconds, and it will stop after collecting all the data. Can anyone hel...
If the program would know how much data it is getting, you could set it up to function like a progress bar..
-0.296905
false
1
3,882
2015-08-08 11:17:21.770
How can mock object replace all system functionality being tested?
I am fairly new to unit testing. And at the moment I have trouble on trying to unit test a Google oAuth Picasa authentication. It involves major changes to the code if I would like to unit tested it (yeah, I develop unit test after the app works). I have read that Mock Object is probably the way to go. But if I use Mo...
When unit testing, you test a particular unit (function/method...) in isolation, meaning that you don't care if other components that your function uses, work (since there are other unit test cases that cover those). So to answer your question - it's out of the scope of your unit tests whether an external service like ...
1.2
true
1
3,883
2015-08-08 13:11:00.840
How to run PyQt4 app with sudo privelages in Ubuntu and keep the normal user style
Ok the title explains it all. But just to clarify. I have Ubuntu and programed a GUI app with Qt Designer 4 and PyQt4. The program works fine running python main.py in terminal. Last week I made an update and now the program needs sudo privelages to start. So I type sudo python main.py. But Oh my GODDDDDDD. What an un...
This is a hacky solution. Install qt-qtconf. sudo apt-get install qt4-qtconfig Run sudo qtconfig or gksudo qtconfig. Change GUI Style to GTK+. Edited.
0
false
1
3,884
2015-08-09 17:32:41.707
in qpython, how do I enter a "return" character
Very basic question. Im trying to use qpython. I can type things in the console but no obvious way to enter a return (or enter)
The console works just like a normally python console. You can use a function if you want to write a script in the console.
0
false
3
3,885
2015-08-09 17:32:41.707
in qpython, how do I enter a "return" character
Very basic question. Im trying to use qpython. I can type things in the console but no obvious way to enter a return (or enter)
go to settings->input method select word-based
0.201295
false
3
3,885
2015-08-09 17:32:41.707
in qpython, how do I enter a "return" character
Very basic question. Im trying to use qpython. I can type things in the console but no obvious way to enter a return (or enter)
There is no way of doing it. The console will automatically input a break line when the line of code ends so you can continue inputting in the screen without any scroll bars. For complex code, you should use the editor.
0
false
3
3,885
2015-08-09 17:43:04.457
python, data structures, algorithm: how to rank top 10 most visited pages in latest 60 minutes?
If there a data structures likes container/queue, based on time , I could use it this way: add item(may duplicate) into it one by one, pop out those added time ealier then 60 minutes; count the queue; then I got top 10 most added items, in a dymatice period, said, 60min. How to implement this time based container ?
You can do something like this: Start timer 60 minutes Get the pages that people visits Save pages If timer is not ended do step 2-3 again if timed is ended: Count wich one is the most visited Count wich one is the second most visited Etc
0
false
1
3,886
2015-08-10 08:26:52.317
How to find out which specific circular references are present in code
I have some python code where gc.collect() seems to free a lot of memory. Given Python's reference counting nature, I am inclined to think that my program contains a lot of cyclical references. Since some data structures are rather big, I would like to introduce weak references. Now I need to find the circular referenc...
Unless you are overriding the __del__ methods, you should not worry about circular dependencies, as Python is able to properly cope with them.
0
false
1
3,887
2015-08-10 15:32:40.420
Can't run Spyder or .py(w) scripts with Windows 10
Can't open Spyder2 in Windows 10.0 (# 10240): the icon just appears briefly. Python 2.7.10 and Spyder 2.3.1 were loaded with Anaconda 2.3.0 (64-bit). The python console works fine - but I can't get my *.py or *.pyw files running. There is probably some message in the Python console when attemtping to open Spyder, but I...
First, one correction: the problem was with starting Spyder, not running .py or .pyw files. Anyway, things work all right now after de-installing Spyder and Python, and reinstalling the Python(x,y) package (instead of Anaconda's). Then, when starting Spyder from the Python(x,y)start window, it behaves normally.
0.386912
false
1
3,888
2015-08-11 00:04:49.560
"make" builds wrong python version
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...
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_...
0.386912
false
1
3,889
2015-08-11 02:25:55.837
what is the IP address of my heroku application
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
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
0.545705
false
1
3,890
2015-08-11 10:48:04.477
Django-admin creates wrong django version inside virtualenv
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...
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...
0
false
2
3,891
2015-08-11 10:48:04.477
Django-admin creates wrong django version inside virtualenv
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...
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. ...
0.296905
false
2
3,891
2015-08-11 13:18:53.960
How to show star rating on ckan for datasets
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
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.2
true
1
3,892
2015-08-14 17:52:18.460
PyCharm: lost ipython kernel window
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 ...
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.2
true
1
3,893
2015-08-15 17:57:13.860
Documenting ctypes fields
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...
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.2
true
1
3,894
2015-08-17 21:06:56.370
In scipy, what's the point of the two different distance functions used in hierarchical clustering?
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...
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 ...
0
false
1
3,895
2015-08-18 05:41:26.897
how to test if a number is divisible by a decimal less than 1? (54.10 % .10)
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?
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.
0.986614
false
1
3,896
2015-08-19 15:38:38.713
IS reading from buffer quicker than reading from a file in python
I have a fpga board and I write a VHDL code that can get Images (in binary) from serial port and save them in a SDRAM on my board. then FPGA display images on a monitor via a VGA cable. my problem is filling the SDRAM take to long(about 10 minutes with 115200 baud rate). on my computer I wrote a python code to send ima...
Unless you are significantly compressing before download, and decompressing the image after download, the problem is your 115,200 baud transfer rate, not the speed of reading from a file. At the standard N/8/1 line encoding, each byte requires 10 bits to transfer, so you will be transferring 1150 bytes per second. In 1...
0
false
1
3,897
2015-08-20 03:58:56.267
How to implement the ReLU function in Numpy
I want to make a simple neural network which uses the ReLU function. Can someone give me a clue of how can I implement the function using numpy.
ReLU(x) also is equal to (x+abs(x))/2
0.04532
false
1
3,898
2015-08-21 18:19:12.767
Printout for receipt printer
I have prepared a small program for retail shop, and have to print out receipt (using tvs msp star 240 dot matrix printer/with paper roll) . with wx.Printout() class for printing , as print preview is ok but actual printing is different and awkward : 1. i m using paper roll n don't know how to call end printing/OnEndPr...
Well i figure out some sort of solution : receipt printing is impossible with wxPython , so, raw printing with escape sequences would be better option os.system("echo ' some text ' | lpr -o raw" ) first initialize printer os.system("echo ' \x1B\x40' | lpr -o raw" ) for bold letters with ESC code : os.system("echo ' \x1...
1.2
true
1
3,899
2015-08-23 23:58:11.270
IronPython: Can't open Keil uVision .uvproj file edited with System.Xml
I need to change some settings in Keil uVision project. I did not find how to disable/enable project options through command line. So I tried to do this by simple parsing .uvproj and .uvopt files with System.Xml in IronPython: import clr clr.AddReference('System.Xml') xml_file = System.Xml.XmlDocument() xml_file.Load(P...
Could be problems with cr/lf. Helpful would be a binary diff of the parsed and new created file. You could get more help if you post a few lines of a binary diff here.
0
false
1
3,900
2015-08-24 18:14:37.737
regarding Django philosphy of implementing project as reusable applications
I am implementing a project using Django. It's a site where people can view different Art courses and register. I am having trouble implementing the app as reusable applications. I already have a standalone App which takes care of all the aspect of Arts. Now I want to create another application where an admin create va...
My sugestion is to create a third model, called ArtEvent and make this model points to Art and Event, this way you can create an especific app to manage events and then link everything. For example, when creating a new ArtEvent you redirects the user for the Event app, to enable him to create a new event. Then redirect...
1.2
true
1
3,901
2015-08-25 16:41:23.073
How to make Python 3 my default Python at command prompt?
I have uninstalled Python 2.7 and installed Python 3. But, when I type Python on my command prompt I get this : "Enthought Canopy Python 2.7.9 ........." How can I run Python 3 from command line or how can I make it default on my computer? I asked Enthought Canopy help and I was told that I can "have Canopy be your def...
You can copy python.exe to python3.exe. If you are using Anaconda, then you will find it in the sub directory of your environment, for intance, c:\Anaconda\envs\myenvironment.
0
false
2
3,902
2015-08-25 16:41:23.073
How to make Python 3 my default Python at command prompt?
I have uninstalled Python 2.7 and installed Python 3. But, when I type Python on my command prompt I get this : "Enthought Canopy Python 2.7.9 ........." How can I run Python 3 from command line or how can I make it default on my computer? I asked Enthought Canopy help and I was told that I can "have Canopy be your def...
After editing each path and creating a new variable for each python version, be sure to rename the python.exe to a unique one. i.e. "python3x" . then you can call it in the command line as "python3x". I am assuming that the original python installed (2X) retains the python.exe of which when you call "python" in the com...
0
false
2
3,902
2015-08-26 15:07:51.750
Call python script from Jira while creating an issue
Let say I'm creating an issue in Jira and write the summary and the description. Is it possible to call a python script after these are written that sets the value for another field, depending on the values of the summary and the description? I know how to create an issue and change fields from a python script using th...
Take a look at JIRA webhooks calling a small python based web server?
0.201295
false
1
3,903
2015-08-27 09:13:53.417
Tornado websocket pings
I'm running a Python Tornado server with a WebSocket handler. We've noticed that if we abruptly disconnect the a client (disconnect a cable for example) the server has no indication the connection was broken. No on_close event is raised. Is there a workaround? I've read there's an option to send a ping, but didn't see...
The on_close event can only be triggered when the connection is closed. You can send a ping and wait for an on_pong event. Timouts are typically hard to detect since you won't even get a message that the socket is closed.
0
false
1
3,904