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 |
|---|---|---|---|---|---|---|---|
2019-01-23 03:02:55.387 | Parsing list of URLs with regex patterns | I have a large text file of URLs (>1 million URLs). The URLs represent product pages across several different domains.
I'm trying to parse out the SKU and product name from each URL, such as:
www.amazon.com/totes-Mens-Mike-Duck-Boot/dp/B01HQR3ODE/
totes-Mens-Mike-Duck-Boot
B01HQR3ODE
www.bestbuy.com/site/apple-airp... | While it is possible to roll this all into one massive regex, that might not be the easiest approach. Instead, I would use a two-pass strategy. Make a dict of domain names to the regex pattern that works for that domain. In the first pass, detect the domain for the line using a single regex that works for all URLs. The... | 0.201295 | false | 1 | 5,912 |
2019-01-24 09:30:09.097 | Python Azure function processing blob storage | I am trying to make a pipeline using Data Factory In MS Azure of processing data in blob storage and then running a python processing code/algorithm on the data and then sending it to another source.
My question here is, how can I do the same in Azure function apps? Or is there a better way to do it?
Thanks in advance.... | I created a Flask API and called my python code through that. And then put it in Azure as a web app and called the blob. | 0 | false | 1 | 5,913 |
2019-01-24 11:46:02.647 | Django Admin Interface - Privileges On Development Server | I have an old project running (Django 1.6.5, Python 2.7) live for several years. I have to make some changes and have set up a working development environment with all the right django and python requirements (packages, versions, etc.)
Everything is running fine, except when I am trying to make changes inside the admin... | Finally, I found the issue:
admin.autodiscover()
was commented out in the project's urls.py for some reason. (I may have done that trying to get the project to work in a more recent version of django) - So admin.site.register was never called and the app_dict never filled. index.html template of django.contrib.admin th... | 0 | false | 1 | 5,914 |
2019-01-24 19:31:18.407 | How to handle EULA pop-up window that appears only on first login? | I am new to Selenium. The web interface of our product pops up a EULA agreement which the user has to scroll down and accept before proceeding. This happens ONLY on initial login using that browser for that user.
I looked at the Selenium API but I am unable to figure out which one to use and how to use it.
Would much ... | You may disable the EULA if that is an option for you, I am sure there is a way to do it in registries as well :
C:\Program Files (x86)\Google\Chrome\Application there should be a file called master_preferences.
Open the file and setting:
require_eula to false | 0 | false | 1 | 5,915 |
2019-01-25 09:21:41.077 | Predicting values using trained MNB Classifier | I am trying to train a model for sentiment analysis and below is my trained Multinomial Naive Bayes Classifier returning an accuracy of 84%.
I have been unable to figure out how to use the trained model to predict the sentiment of a sentence. For example, I now want to use the trained model to predict the sentiment of ... | I don't know the dataset and what is semantic of individual dictionaries, but you are training your model on a dataset which has form as follows:
[[{"word":True, "word2": False}, 'neg'], [{"word":True, "word2": False}, 'pos']]
That means your input is in form of a dictionary, and output in form of 'neg' label. If you ... | 1.2 | true | 1 | 5,916 |
2019-01-25 11:29:23.027 | Deliver python external libraries with script | I want to use my script that uses pandas library on another linux machine where is no internet access or pip installed.
Is there a way how to deliver the script with all dependencies?
Thanks | or set needed dependices in script manually by appending sys.modules and pack together all the needed files. | 0 | false | 1 | 5,917 |
2019-01-26 14:14:21.693 | importing an entire folder of .py files into google colab | I have a folder of . py files(a package made by me) which i have uploaded into my google drive.
I have mounted my google drive in colab but I still can not import the folder in my notebook as i do in my pc.
I know how to upload a single .py file into google colab and import it into my code, but i have no idea about how... | I found how to do it.
after uploading all modules and packages into the directory which my notebook file is in, I changed colab's directory from "/content" to this directory and then i simply imported the modules and packages(folder of .py files) into my code | 1.2 | true | 1 | 5,918 |
2019-01-27 06:38:41.497 | How to redirect -progress option output of ffmpeg to stderr? | I'm writing my own wraping for ffmpeg on Python 3.7.2 now and want to use it's "-progress" option to read current progress since it's highly machine-readable. The problem is "-progress" option of ffmpeg accepts as its parameter file names and urls only. But I don't want to create additional files not to setup the whole... | -progress pipe:1 will write out to stdout, pipe:2 to stderr. If you aren't streaming from ffmpeg, use stdout. | 1.2 | true | 1 | 5,919 |
2019-01-28 14:38:40.990 | How can I check how often all list elements from a list B occur in a list A? | I have a python list A and a python list B with words as list elements. I need to check how often the list elements from list B are contained in list A. Is there a python method or how can I implement this efficient?
The python intersection method only tells me that a list element from list B occurs in list A, but not ... | You could convert list B to a set, so that checking if the element is in B is faster.
Then create a dictionary to count the amount of times that the element is in A if the element is also in the set of B
As mentioned in the comments collections.Counter does the "heavy lifting" for you | 0 | false | 1 | 5,920 |
2019-01-29 07:42:00.640 | Can't install packages via pip or npm | I'm trying to install some packages globally on my Mac. But I'm not able to install them via npm or pip, because I'll always get the message that the packages does not exist. For Python, I solved this by always using a virtualenv. But now I'm trying to install the @vue/cli via npm, but I'm not able to access it. The co... | If it's a PATH problem:
1) Open up Terminal.
2) Run the following command:
sudo nano /etc/paths
3) Enter your password, when prompted.
4) Check if the correct paths exist in the file or not.
5) Fix, if needed
6) Hit Control-X to quit.
7) Enter “Y” to save the modified buffer.
Everything, should work fine now. If it doe... | 1.2 | true | 1 | 5,921 |
2019-01-31 10:19:40.180 | How to get disk space total, used and free using Python 2.7 without PSUtil | Is there a way I get can the following disk statistics in Python without using PSUtil?
Total disk space
Used disk space
Free disk space
All the examples I have found seem to use PSUtil which I am unable to use for this application.
My device is a Raspberry PI with a single SD card. I would like to get the total size ... | You can do this with the os.statvfs function. | 0.201295 | false | 1 | 5,922 |
2019-02-01 14:09:13.800 | How can a same entity function as a parameter as well as an object? | In the below operation, we are using a as an object as well as an argument.
a = "Hello, World!"
print(a.lower()) -> a as an object
print(len(a)) -> a as a parameter
May I know how exactly each operations differs in the way they are accessing a? | Everything in python (everything that can go on the rhs of an assignment) is an object, so what you can pass as an argument to a function IS an object, always. Actually, those are totally orthogonal concepts: you don't "use" something "as an object" - it IS an object - but you can indeed "use it" (pass it) as an argume... | 0.386912 | false | 1 | 5,923 |
2019-02-02 02:41:43.413 | Loading and using a trained TensorFlow model in Python | I trained a model in TensorFlow using the tf.estimator API, more specifically using tf.estimator.train_and_evaluate. I have the output directory of the training. How do I load my model from this and then use it?
I have tried using the tf.train.Saver class by loading the most recent ckpt file and restoring the session. ... | (Answering my own question) I realized that the easiest way to do this was to use the tf.estimator API. By initializing an estimator that warm starts from the model directory, it's possible to just call estimator.predict and pass the correct args (predict_fn) and get the predictions immediately. It's not required to de... | 0 | false | 1 | 5,924 |
2019-02-02 08:14:24.520 | Best way to map words with multiple spellings to a list of key words? | I have a pile of ngrams of variable spelling, and I want to map each ngram to it's best match word out of a list of known desired outputs.
For example, ['mob', 'MOB', 'mobi', 'MOBIL', 'Mobile] maps to a desired output of 'mobile'.
Each input from ['desk', 'Desk+Tab', 'Tab+Desk', 'Desktop', 'dsk'] maps to a desired outp... | The classical approach would be, to build a "Feature Matrix" for each ngram. Each word maps to an Output which is a categorical value between 0 and 29 (one for each class)
Features can for example be the cosine similarity given by fuzzy wuzzy but typically you need many more. Then you train a classification model base... | 0.135221 | false | 1 | 5,925 |
2019-02-04 21:09:00.383 | Use VRAM (graphics card memory) in pygame for images | I'm programming a 2D game with Python and Pygame and now I want to use my internal graphics memory to load images to.
I have an Intel HD graphics card (2GB VRAM) and a Nvidia GeForce (4GB VRAM).
I want to use one of them to load images from the hard drive to it (to use the images from there).
I thought it might be a go... | You have to create your window with the FULLSCREEN, DOUBLEBUF and HWSURFACE flags.
Then you can create and use a hardware surface by creating it with the HWSURFACE flag.
You'll also have to use pygame.display.flip() instead of pygame.display.update().
But even pygame itself discourages using hardware surfaces, since th... | 1.2 | true | 1 | 5,926 |
2019-02-05 02:42:03.343 | Installed Anaconda to macOS that has Python2.7 and 3.7. Pandas only importing to 2.7; how can I import to 3.7? | New to coding; I just downloaded the full Anaconda package for Python 3.7 onto my Mac. However, I can't successfully import Pandas into my program on SublimeText when running my Python3.7 build. It DOES work though, when I change the build to Python 2.7. Any idea how I can get it to properly import when running 3.7 on ... | Uninstall python 2.7. Unless you use it, its better to uninstall it. | 0 | false | 1 | 5,927 |
2019-02-05 12:40:24.703 | How to check learning feasibility on a binary classification problem with Hoeffding's inequality/VC dimension with Python? | I have a simple binary classification problem, and I want to assess the learning feasibility using Hoeffding's Inequality and also if possible VC dimension.
I understand the theory but, I am still stuck on how to implement it in Python.
I understand that In-sample Error (Ein) is the training Error. Out of sample Error... | Well here is how I handled it : I generate multiple train/test samples, run the algorithm on them, calculate Ein as the train set error, Eout estimated by the test set error, calculate how many times their differnces exceeds the value of epsilon (for a range of epsilons). And then I plot the curve of these rates of exc... | 1.2 | true | 1 | 5,928 |
2019-02-06 20:20:54.933 | python keeps saying that 'imput is undefined. how do I fix this? | Please help me with this. I'd really appreciate it. I have tried alot of things but nothing is working, Please suggest any ideas you have.
This is what it keeps saying:
name = imput('hello')
NameError: name 'imput' is not defined | You misspelled input as imput. imput() is not a function that python recognizes - thus, it assumes it's the name of some variable, searches for wherever that variable was declared, and finds nothing. So it says "this is undefined" and raises an error. | 1.2 | true | 1 | 5,929 |
2019-02-07 02:36:18.047 | Understanding each component of a web application architecture | Here is a scenario for a system where I am trying to understand what is what:
I'm Joe, a novice programmer and I'm broke. I've got a Flask app and one physical machine. Since I'm broke, I cannot afford another machine for each piece of my system, thus the web server, application and database all live on my one machine.... | Any basic server architecture has three layers. On one end is the web server, which fulfills requests from clients. The other end is the database server, where the data resides.
In between these two is the application server. It consists of the business logic required to interact with the web server to receive the req... | 0 | false | 1 | 5,930 |
2019-02-07 04:21:01.713 | How keras model H5 works in theory | After training the trained model will be saved as H5 format. But I didn't know how that H5 file can be used as classifier to classifying new data. How H5 model works in theory when classifying new data? | When you save your model as h5-file, you save the model structure, all its parameters and further informations like state of your optimizer and so on. It is just an efficient way to save huge amounts of information. You could use json or xml file formats to do this as well.
You can't classifiy anything only using this... | 0.201295 | false | 1 | 5,931 |
2019-02-07 19:36:54.707 | Using pyautogui with multiple monitors | I'm trying to use the pyautogui module for python to automate mouse clicks and movements. However, it doesn't seem to be able to recognise any monitor other than my main one, which means i'm not able to input any actions on any of my other screens, and that is a huge problem for the project i am working on.
I've search... | not sure if this is clear but I subtracted an extended monitor's horizontal resolution from 0 because my 2nd monitor is on the left of my primary display. That allowed me to avoid the out of bounds warning. my answer probably isn't the clearest but I figured I would chime in to let folks know it actually can work. | 0 | false | 1 | 5,932 |
2019-02-07 21:14:35.190 | How to encrypt(?) a document to prove it was made at a certain time? | So, a bit of a strange question, but let's say that I have a document (jupyter notebook) and I want to be able to prove to someone that it was made before a certain date, or that it was created on a certain date - does anyone have any ideas as to how I'd achieve that?
It would need to be a solution that couldn't be tec... | email it to yourself or a trusted party – dandavis yesterday
Good solution.
Thanks! | 0 | false | 1 | 5,933 |
2019-02-08 03:38:25.450 | How to reset Colab after the following CUDA error 'Cuda assert fails: device-side assert triggered'? | I'm running my Jupyter Notebook using Pytorch on Google Colab. After I received the 'Cuda assert fails: device-side assert triggered' I am unable to run any other code that uses my pytorch module. Does anyone know how to reset my code so that my Pytorch functions that were working before can still run?
I've already tri... | You need to reset the Colab notebook. To run existing Pytorch modules that used to work before, you have to do the following:
Go to 'Runtime' in the tool bar
Click 'Restart and Run all'
This will reset your CUDA assert and flush out the module so that you can have another shot at avoiding the error! | 1.2 | true | 1 | 5,934 |
2019-02-08 07:38:41.967 | How change hostpython for use python3 on MacOS for compile Python+Kivy project for Xcode | I use toolchain from Kivy for compile Python + Kivy project on MacOS, but by default, toolchain use python2 recipes but I need change to python3.
I´m googling but I don't find how I can do this.
Any idea?
Thanks | For example, recipe "ios" and "pyobjc" dependency is changed from depends = ["python"] to depends = ["python3"]. (__init__.py in each packages in receipe folder in kivy-ios package)
These recipes are loaded from your request implicitly or explicitly
This description of the problem recipes is equal to require hostpython... | 0 | false | 2 | 5,935 |
2019-02-08 07:38:41.967 | How change hostpython for use python3 on MacOS for compile Python+Kivy project for Xcode | I use toolchain from Kivy for compile Python + Kivy project on MacOS, but by default, toolchain use python2 recipes but I need change to python3.
I´m googling but I don't find how I can do this.
Any idea?
Thanks | your kivy installation is likely fine already. Your kivy-ios installation is not. Completely remove your kivy-ios folder on your computer, then do git clone git://github.com/kivy/kivy-ios to reinstall kivy-ios. Then try using toolchain.py to build python3 instead of python 2
This solution work for me. Thanks very much ... | 1.2 | true | 2 | 5,935 |
2019-02-09 15:50:20.647 | How to reach streaming learning in Neural network? | As title, I know there're some model supporting streaming learning like classification model. And the model has function partial_fit()
Now I'm studying regression model like SVR and RF regressor...etc in scikit.
But most of regression models doesn't support partial_fit .
So I want to reach the same effect in neural net... | There is no some special function for it in TensorFlow. You make a single training pass over a new chunk of data. And then another training pass over another new chunk of data, etc till you reach the end of the data stream (which, hopefully, will never happen). | 0 | false | 1 | 5,936 |
2019-02-10 09:38:54.947 | How to pickle or save a WxPython FontData Object | I've been coding a text editor, and it has the function to change the default font displayed in the wx.stc.SyledTextCtrl.
I would like to be able to save the font as a user preference, and I have so far been unable to save it.
The exact object type is <class 'wx._core.Font'>.
Would anyone know how to pickle/save this... | Probably due to its nature, you cannot pickle a wx.Font.
Your remaining option is to store its constituent parts.
Personally, I store facename, point size, weight, slant, underline, text colour and background colour.
How you store them is your own decision.
I use 2 different options depending on the code.
Store th... | 1.2 | true | 1 | 5,937 |
2019-02-10 09:51:41.193 | how to decode gzip string in JS | I have one Django app and in the view of that I am using gzip_str(str) method to compress data and send back to the browser. Now I want to get the original string back in the browser. How can I decode the string in JS.
P.S. I have found few questions here related to the javascript decode of gzip string but I could not ... | Serve the string with an appropriate Content-Encoding, then the browser will decode it for you. | 0 | false | 1 | 5,938 |
2019-02-10 15:03:18.307 | How to remove unwanted python packages from the Base environment in Anaconda | I am using Anaconda. I would like to know how to remove or uninstall unwanted packages from the base environment. I am using another environment for my coding purpose.
I tried to update my environment by using yml file (Not base environment). Unexpectedly some packages installed by yml into the base environment. So no... | Please use the below code:
conda uninstall -n base <Package_name> | 0 | false | 1 | 5,939 |
2019-02-11 00:05:55.277 | Pythonic way to split project into modules? | Say, there is a module a which, among all other stuff, exposes some submodule a.b.
AFAICS, it is desired to maintain modules in such a fashion that one types import a, import a.b and then invokes something b-specific in a following way: a.b.b_specific_function() or a.a_specific_function().
The questions I'd like to as... | You can put the code into __init__.py. There is nothing wrong with this for a small subpackage. If the code grows large it is also common to have a submodule with a repeated name like a/a.py and then inside __init__.py import it using from .a import *. | 1.2 | true | 1 | 5,940 |
2019-02-11 11:28:57.127 | Fastest way in numpy to sum over upper triangular elements with the least memory | I need to perform a summation of the kind i<j on symmetric matrices. This is equivalent to sum over the upper triangular elements of a matrix, diagonal excluded.
Given A a symmetric N x N array, the simplest solution is np.triu(A,1).sum() however I was wondering if faster methods exist that require less memory.
It seem... | The fastest method with the least memory, in pure numpy is going to be to sum the entire thing and subtract the diagonal.
It may feel wasteful in terms of FLOPS, but note that the theoretical savings relative to that implementation are only a factor 2. If that means anything to you, you probably should not be using num... | 0.101688 | false | 2 | 5,941 |
2019-02-11 11:28:57.127 | Fastest way in numpy to sum over upper triangular elements with the least memory | I need to perform a summation of the kind i<j on symmetric matrices. This is equivalent to sum over the upper triangular elements of a matrix, diagonal excluded.
Given A a symmetric N x N array, the simplest solution is np.triu(A,1).sum() however I was wondering if faster methods exist that require less memory.
It seem... | You can replace np.diag(A).sum() with np.trace(A); this will not create the temporary Nx1 array | 1.2 | true | 2 | 5,941 |
2019-02-11 17:01:42.323 | How to create communication between python(not web) and angularjs | I have an angularjs and a python project. The angularjs for the frontend and the python part is for the trainings made for face recognition. I wanted to know if there is a way that my angular can communicate with python and if it can, how to use the functionalities of python project in the angular. | Create an API in python console application
call http get put etc from angular . | 0 | false | 1 | 5,942 |
2019-02-12 01:46:25.987 | How can I convert .mat files to NumPy files in Python? | So I have a .mat file
It is a little over 1 GB but I don't know how much data or lines of code is on it. I want to convert this .mat file to a NumPy file in Python so I can look at the data and see what is in it. How do I do this conversion? | I think you have two options to read it.
Reading it in python:
import scipy.io
mat = scipy.io.loadmat('fileName.mat')
Converting it to .csv in MATLAB in order to read it in python later:
FileData = load('FileName.mat');
csvwrite('FileName.csv', FileData.M); | 0.386912 | false | 1 | 5,943 |
2019-02-12 12:10:46.883 | Does pandas read the whole file even when usecols is used? | I'm using pandas to read a file inside a rest service. The file is huge with more than 100 columns. But I only want to read just first two columns. I know I can use usecols in read_csv but I was wondering how exactly it works?
Does pandas read the whole file and filter out the required columns?
Or does it only read the... | According to the documentation, it will read the whole file (no way to only read columns from disk), but will only parse and store the columns given in the use_cols variable (emphasize mine):
usecols : list-like or callable, optional
Return a subset of the columns... Using this parameter results in much faster parsing... | 1.2 | true | 1 | 5,944 |
2019-02-13 19:34:47.163 | How to use multiple threads to execute the same code and speed up it? | I'm facing some performance issues to execute a fuzzy match based on Leveinshtein distance algorithm.
I'm comparing two lists, a small one with 1k lines and a second one with 10k lines.
I have splitted the bigger list in 10 files of 1000 lines to check speed performance, but I checked that Python is using only 1 thread... | Running the same code in two or more threads won't assist performance. You could potentially split up the task so each handles 250, then have each thread handle 1 of those tasks. Then compare the results at the end. | 0 | false | 1 | 5,945 |
2019-02-14 14:37:17.357 | Create tables from Excel column headers using Python and load data? | Background of our environment:
Data Warehouse system is running with SQL Server 2012.
Data Sources are Excel files and other APIs
Issue:
The business metrics are changing frequently and source file is changing frequently and data load failing for multiple reasons.
Column mismatch
Data type mismatch
Wrong files
Old ... | 1.I'm guessing you can identify the file types based on file_names or header.You could create a SSIS package with a Source Script within a foreach loop , for the script define input and output columns manually and give Generic Names and fixed string length , ColumnNr1,ColumnNr2,ColumnNrN (Where N is max number of Colu... | 0 | false | 1 | 5,946 |
2019-02-14 23:36:33.280 | Block indent jupyter notebook | Does anyone know how to get a command shortcut to work for block indenting and un-indenting in Jupyter notebooks?
In the Jupiter notebook command group there is a command “automatically indent selection”. When I put in a command mode control-/ for that command the notebook does block commenting.
I don’t see any... | it's
Tab
If you want to unindent, then
Shift + Tab
You need to have selected more rows or it's intellisense... | 1 | false | 2 | 5,947 |
2019-02-14 23:36:33.280 | Block indent jupyter notebook | Does anyone know how to get a command shortcut to work for block indenting and un-indenting in Jupyter notebooks?
In the Jupiter notebook command group there is a command “automatically indent selection”. When I put in a command mode control-/ for that command the notebook does block commenting.
I don’t see any... | In JupyterLab,ctrl+[ and ctrl+] work for indentation/deindentation.
These solutions also are guaranteed to work, whereas Tab and Shift+Tab can trigger actions like intellisense if your cursor is in the middle of a line. | 0 | false | 2 | 5,947 |
2019-02-15 00:17:46.583 | How to create a 2 value data table for keras | I am trying to make my first neural network in keras (python) that takes in the x and y distances to the next pipe and outputs whether or not the bird should flap. How would I go about creating an input data set from the game and then turning that into something keras can use for training?
I don't have very much knowle... | Sir even i'm new to neural network but i have some knowledge
if you want to do this in exactly this manner then i'm no help but
your can try doing this by genetic algo which will surely work for this | 0 | false | 1 | 5,948 |
2019-02-16 07:10:43.833 | How to make functions appear purple | So from just learning how to make functions, I thought of if I could turn the function purple, just like a normal print() or str() function. And with that in mind, it may seem pretty obvious that I am still a beginner when it comes to coding. From what I know, it may have something to do with sys.stdin.write, but I don... | In Options => Configure IDLE => Settings => Highlights there is a highlight setting for builtin names (default purple), including a few non-functions like Ellipsis. There is another setting for the names in def (function) and class statements (default blue). You can make def (and class) names be purple also.
This wil... | 1.2 | true | 1 | 5,949 |
2019-02-17 13:30:30.583 | Count number of Triggers in a given Span of Time | I've been working for a while with some cheap PIR modules and a raspberry pi 3. My aim is to use 4 of these guys to understand if a room is empty, and turn off some lights in case.
Now, this lovely sensors aren't really precise. They false trigger from time to time, and they don't trigger right after their status has c... | How are you powering PIR sensors? They should be powered with 5V. I had similar problem with false triggers when I was powered PIR sensor with only 3.3V. | 0 | false | 1 | 5,950 |
2019-02-18 02:33:10.543 | While debugging in pycharm, how to debug only through a certain iteration of the for loop? | I have a for loop in Python in Pycharm IDE. I have 20 iterations of the for loop. However, the bug seems to be coming from the dataset looped during the 18th iteration. Is it possible to skip the first 17 values of the for loop, and solely jump to debug the 18th iteration?
Currently, I have been going through all 17 it... | You can set a break point with a condition (i == 17 [right click on the breakpoint to put it]) at the start of the loop. | -0.135221 | false | 1 | 5,951 |
2019-02-18 17:11:25.750 | How to evaluate the path to a python script to be executed within Jupyter Notebook | Note: I am not simply asking how to execute a Python script within Jupyter, but how to evaluate a python variable which would then result in the full path of the Python script I was to execute.
In my particular scenario, some previous cell on my notebook generates a path based on some condition.
Example on two possible... | One hacky way would be to change the directory via %cd path
and then run the script with %run -i file.py
E: I know that this is not exactly what you were asking but maybe it helps with your problem. | 0 | false | 1 | 5,952 |
2019-02-19 09:11:19.870 | How to use pretrained word2vec vectors in doc2vec model? | I am trying to implement doc2vec, but I am not sure how the input for the model should look like if I have pretrained word2vec vectors.
The problem is, that I am not sure how to theoretically use pretrained word2vec vectors for doc2vec. I imagine, that I could prefill the hidden layer with the vectors and the rest of t... | You might think that Doc2Vec (aka the 'Paragraph Vector' algorithm of Mikolov/Le) requires word-vectors as a 1st step. That's a common belief, and perhaps somewhat intuitive, by analogy to how humans learn a new language: understand the smaller units before the larger, then compose the meaning of the larger from the sm... | 1.2 | true | 1 | 5,953 |
2019-02-21 02:24:51.223 | How to convert every other character in a string to ascii in Python? | I know how to convert characters to ascii and stuff, and I'm making my first encryption algorithm just as a little fun project, nothing serious. I was wondering if there was a way to convert every other character in a string to ascii, I know this is similar to some other questions but I don't think it's a duplicate. Al... | Use ord() function to get ascii value of a character. You can then do a chr() of that value to get the character. | 0 | false | 1 | 5,954 |
2019-02-21 05:36:13.653 | Run python script by PHP from another server | I am making APIs.
I'm using CentOS for web server, and another windows server 2016 for API server.
I'm trying to make things work between web server and window server.
My logic is like following flow.
1) Fill the data form and click button from web server
2) Send data to windows server
3) Python script runs and makes m... | First option: (Recommended)
You can create the python side as an API endpoint and from the PHP server, you need to call the python API.
Second option:
You can create the python side just like a normal webpage and whenever you call that page from PHP server you pass the params along with HTTP request, and after receivin... | 1.2 | true | 1 | 5,955 |
2019-02-21 11:00:17.487 | Kivy Android App - Switching screens with a swipe | Every example I've found thus-far for development with Kivy in regards to switching screens is always done using a button, Although the user experience doesn't feel very "native" or "Smooth" for the kind of app I would like to develop.
I was hoping to incorperate swiping the screen to change the active screen.
I can so... | You might want to use a Carousel instead of ScreenManager, but if you want that logic while using the ScreenManager, you'll certainly have to write some python code to manage that in a subclass of it, then use it in kv as a normal ScreenManager. Using previous and next properties to get the right screen to switch to de... | 1.2 | true | 1 | 5,956 |
2019-02-21 14:37:29.177 | is it possible to code in python inside android studio? | is it possible to code in python inside android studio?
how can I do it.
I have an android app that I am try to develop. and I want to code some part in python.
Thanks for the help
how can I do it.
I have an android app that I am try to develop. and I want to code some part in python.
Thanks for the help | If you mean coding part of your Android application in python (and another part for example in Java) it's not possible for now. However, you can write Python script and include it in your project, then write in your application part that will invoke it somehow. Also, you can use Android Studio as a text editor for Pyth... | 1.2 | true | 1 | 5,957 |
2019-02-22 09:08:55.793 | How to create .cpython-37 file, within __pycache__ | I'm working on a project with a few scripts in the same directory, a pychache folder has been created within that directory, it contains compiled versions of two of my scripts. This has happened by accident I do not know how I did it. One thing I do know is I have imported functions between the two scripts that have be... | There is really no reason to worry about __pycache__ or *.pyc files - these are created and managed by the Python interpreter when it needs them and you cannot / should not worry about manually creating them. They contain a cached version of the compiled Python bytecode. Creating them manually makes no sense (and I am ... | 1.2 | true | 1 | 5,958 |
2019-02-22 10:05:07.620 | Install python packages in windows server 2016 which has no internet connection | I need to install python packages in a windows server 2016 sandbox for running a developed python model in production.This doesn't have internet connection.
My laptop is windows 2010 and the model is now running in my machine and need to push this to the server.
My question is how can i install all the required packag... | A simply way is to install the same python version on another machine having internet access, and use normally pip on that machine. This will download a bunch of files and installs them cleanly under Lib\site_packages of your Python installation.
You can they copy that folder to the server Python installation. If you w... | 0 | false | 1 | 5,959 |
2019-02-22 18:47:07.843 | How to write unit tests for text parser? | For background, I am somewhat of a self-taught Python developer with only some formal training with a few CS courses in school.
In my job right now, I am working on a Python program that will automatically parse information from a very large text file (thousands of lines) that's a output result of a simulation softwar... | Usually parsers are tested using a regression testing system. You create sample input sets and verify that the output is correct. Then you put the input and output in libraries. Each time you modify the code, you run the regression test system over the library to see if anything changes. | 0.673066 | false | 1 | 5,960 |
2019-02-22 20:17:16.640 | Specific reasons to favor pip vs. conda when installing Python packages | I use miniconda as my default python installation. What is the current (2019) wisdom regarding when to install something with conda vs. pip?
My usual behavior is to install everything with pip, and only using conda if a package is not available through pip or the pip version doesn't work correctly.
Are there advantages... | This is what I do:
Activate your conda virutal env
Use pip to install into your virtual env
If you face any compatibility issues, use conda
I recently ran into this when numpy / matplotlib freaked out and I used the conda build to resolve the issue. | 0.327599 | false | 1 | 5,961 |
2019-02-24 14:21:54.997 | how can I use python 3.6 if I have python 3.7? | I'm trying to make a discord bot, and I read that I need to have an older version of Python so my code will work. I've tried using "import discord" on IDLE but an error message keeps on coming up. How can I use Python 3.6 and keep Python 3.7 on my Windows 10 computer? | Install in different folder than your old Python 3.6 then update path
Using Virtualenv and or Pyenv
Using Docker
Hope it help! | 0 | false | 2 | 5,962 |
2019-02-24 14:21:54.997 | how can I use python 3.6 if I have python 3.7? | I'm trying to make a discord bot, and I read that I need to have an older version of Python so my code will work. I've tried using "import discord" on IDLE but an error message keeps on coming up. How can I use Python 3.6 and keep Python 3.7 on my Windows 10 computer? | Just install it in different folder (e.g. if current one is in C:\Users\noob\AppData\Local\Programs\Python\Python37, install 3.6. to C:\Users\noob\AppData\Local\Programs\Python\Python36).
Now, when you'll want to run a script, right click the file and under "edit with IDLE" will be multiple versions to choose. Works on... | 0 | false | 2 | 5,962 |
2019-02-25 15:00:24.023 | Is a Pyramid "model" also a Pyramid "resource"? | I'm currently in the process of learning how to use the Python Pyramid web framework, and have found the documentation to be quite excellent.
I have, however, hit a stumbling block when it comes to distinguishing the idea of a "model" (i.e. a class defined under SQLAlchemy's declarative system) from the idea of a "reso... | I'm having trouble understanding whether I should be making models resources (by adding the acl attribute directly in the model class) or creating a separate resource class
The answer depends on what level of coupling you want to have. For a simple app, I would recommend making models resources just for simplicity sak... | 0.201295 | false | 1 | 5,963 |
2019-02-25 22:42:31.903 | Python Gtk3 - Custom Statusbar w/ Progressbar | Currently I am working to learn how to use Gtk3 with Python 3.6. So far I have been able to use a combination of resources to piece together a project I am working on, some old 2.0 references, some 3.0 shallow reference guides, and using the python3 interpreters help function.
However I am stuck at how I could customis... | GtkStatusbar is a subclass of GtkBox. You can use any GtkBox method including pack_start and pack_end or even add, which is a method of GtkContainer.
Thus you can simply add you progressbar to statusbar. | 1.2 | true | 1 | 5,964 |
2019-02-26 04:59:25.937 | Can a consumer read records from a partition that stores data of particular key value? | Instead of creating many topics I'm creating a partition for each consumer and store data using a key. So is there a way to make a consumer in a consumer group read from partition that stores data of a specific key. If so can you suggest how it can done using kafka-python (or any other library). | Instead of using the subscription and the related consumer group logic, you can use the "assign" logic (it's provided by the Kafka consumer Java client for example).
While with subscription to a topic and being part of a consumer group, the partitions are automatically assigned to consumers and re-balanced when a new c... | 0 | false | 1 | 5,965 |
2019-02-26 08:57:02.207 | how to increase fps for raspberry pi for object detection | I'm having low fps for real-time object detection on my raspberry pi
I trained the yolo-darkflow object detection on my own data set using my laptop windows 10 .. when I tested the model for real-time detection on my laptop with webcam it worked fine with high fps
However when trying to test it on my raspberry pi, whi... | My detector on raspberry pi without any accelerator can reach 5 FPS.
I used SSD mobilenet, and quantize it after training.
Tensorflow Lite supplies a object detection demo can reach about 8 FPS on raspberry pi 4. | 0 | false | 2 | 5,966 |
2019-02-26 08:57:02.207 | how to increase fps for raspberry pi for object detection | I'm having low fps for real-time object detection on my raspberry pi
I trained the yolo-darkflow object detection on my own data set using my laptop windows 10 .. when I tested the model for real-time detection on my laptop with webcam it worked fine with high fps
However when trying to test it on my raspberry pi, whi... | The raspberry pi not have the GPU procesors and because of that is very hard for it to do image recognition at a high fps . | 0 | false | 2 | 5,966 |
2019-02-26 10:41:52.910 | Python3: FileNotFoundError: [Errno 2] No such file or directory: 'train.txt', even with complete path | I'm currently working with Python3 on Jupyter Notebook. I try to load a text file which is in the exact same directory as my python notebook but it still doesn't find it. My line of code is:
text_data = prepare_text('train.txt')
and the error is a typical
FileNotFoundError: [Errno 2] No such file or directory: 'train.t... | I found the answer. Windows put a secont .txt at the end of the file name, so I should have used train.txt.txt instead. | 0.201295 | false | 1 | 5,967 |
2019-02-26 16:48:18.673 | Write own stemmer for stemming | I have a dataset of 27 files, each containing opcodes. I want to use stemming to map all versions of similar opcodes into the same opcode. For example: push, pusha, pushb, etc would all be mapped to push.
My dictionary contains 27 keys and each key has a list of opcodes as a value. Since the values contain opcodes and ... | I would recommend looking at the levenshtein distance metric - it measures the distance between two words in terms of character insertions, deletions, and replacements (so push and pusha would be distance 1 apart if you do the ~most normal thing of weighing insertions = deletions = replacements = 1 each). Based on the ... | 0 | false | 1 | 5,968 |
2019-02-26 18:30:41.820 | Elementree Fromstring and iterparse in Python 3.x | I am able to parse from file using this method:
for event, elem in ET.iterparse(file_path, events=("start", "end")):
But, how can I do the same with fromstring function? Instead of from file, xml content is stored in a variable now. But, I still want to have the events as before. | From the documentation for the iterparse method:
...Parses an XML section into an element tree incrementally, and
reports what’s going on to the user. source is a filename or file
object containing XML data...
I've never used the etree python module, but "or file object" says to me that this method accepts an ope... | 0 | false | 1 | 5,969 |
2019-02-26 21:57:40.743 | Why should I use tf.data? | I'm learning tensorflow, and the tf.data API confuses me. It is apparently better when dealing with large datasets, but when using the dataset, it has to be converted back into a tensor. But why not just use a tensor in the first place? Why and when should we use tf.data?
Why isn't it possible to have tf.data return th... | The tf.data module has specific tools which help in building a input pipeline for your ML model. A input pipeline takes in the raw data, processes it and then feeds it to the model.
When should I use tf.data module?
The tf.data module is useful when you have a large dataset in the form of a file such as .csv or .tfr... | 1.2 | true | 1 | 5,970 |
2019-02-27 00:06:57.810 | Pipenv: Multiple Environments | Right now I'm using virtualenv and just switching over to Pipenv. Today in virtualenv I load in different environment variables and settings depending on whether I'm in development, production, or testingby setting DJANGO_SETTINGS_MODULE to myproject.settings.development, myproject.settings.production, and myproject.se... | You should create different .env files with different prefixes depending on the environment, such as production.env or testing.env. With pipenv, you can use the PIPENV_DONT_LOAD_ENV=1 environment variable to prevent pipenv shell from automatically exporting the .env file and combine this with export $(cat .env | xargs... | 1.2 | true | 1 | 5,971 |
2019-02-27 05:59:35.137 | How to architect a GUI application with UART comms which stays responsive to the user | I'm writing an application in PyQt5 which will be used for calibration and test of a product. The important details:
The product under test uses an old-school UART/serial communication link at 9600 baud.
...and the test / calibration operation involves communicating with another device which has a UART/serial communic... | Okay for the past few days I've been digging, and figured out how to do this. Since there haven't been any responses, and I do think this question could apply to others, I'll go ahead and post my solution. Briefly:
Yes, the best way to solve this is with with PyQt Threads, and using Signals and Slots to communicate be... | 0 | false | 1 | 5,972 |
2019-02-27 13:33:17.083 | how to register users of different kinds using different tables in django? | I'm new to django, I want to register users using different tables for different users like students, teaching staff, non teaching staff, 3 tables.
How can i do it instead of using default auth_users table for registration | cf Sam's answer for the proper solutions from a technical POV. From a design POV, "student", "teaching staff" etc are not entities but different roles a user can have.
One curious things with living persons and real-life things in general is that they tend to evolve over time without any respect for our well-defined ... | 0 | false | 2 | 5,973 |
2019-02-27 13:33:17.083 | how to register users of different kinds using different tables in django? | I'm new to django, I want to register users using different tables for different users like students, teaching staff, non teaching staff, 3 tables.
How can i do it instead of using default auth_users table for registration | In Django authentication, there is Group model available which have many to many relationship with User model. You can add students, teaching staff and non teaching staff to Group model for separating users by their type. | 0 | false | 2 | 5,973 |
2019-02-28 01:29:15.947 | How do I know if a file has finished copying? | I've been given a simple file-conversion task: whenever an MP4 file is in a certain directory, I do some magic to it and move it to a different directory. Nice and straightforward, and easy to automate.
However, if a user is copying some huge file into the directory, I worry that my script might catch it mid-copy, and ... | you could try first comparing the size of the file initially, or alternatively see if there are new files in the folder, capture the name of the new file and see if its size increases in x time, if you have a script, you could show the code.... | 0 | false | 1 | 5,974 |
2019-02-28 03:04:27.143 | Viewing Graph from saved .pbtxt file on Tensorboard | I just have a graph.pbtxt file. I want to view the graph in tensorboard. But I am not aware of how to do that. Do I have to write any python script or can I do it from the terminal itself? Kindly help me to know the steps involved. | Open tensorboard and use the "Upload" button on the left to upload the pbtxt file will directly open the graph in tensorboard. | 0.986614 | false | 1 | 5,975 |
2019-02-28 16:24:27.333 | Intersection of interpol1d objects | I have 2 cumulative distributions that I want to find the intersection of. To get an underlying function, I used the scipy interpol1d function. What I’m trying to figure out now, is how to calculate their intersection. Not sure how I can do it. Tried fsolve, but I can’t find how to restrict the range in which to search... | Use scipy.optimize.brentq for bracketed root-finding:
brentq(lambda x: interp1d(xx, yy)(x) - interp1d(xxx, yyy)(x), -1, 1) | 0 | false | 1 | 5,976 |
2019-02-28 18:54:51.120 | How to make depth of nii images equal? | I am having some nii images and each having same height and width but different depth. So I need to make the depth of each image equal, how can I do that? Also I didn't find any Python code, which can help me. | Once you have defined the depth you want for all volumes, let it be D, you can instantiate an image (called volume when D > 1) of dimensions W x H x D, for every volume you have.
Then you can fill every such volume, pixel by pixel, by mapping the pixel position onto the original volume and retrieving the value of the p... | 0 | false | 1 | 5,977 |
2019-02-28 21:02:20.790 | Tensorflow data pipeline: Slow with caching to disk - how to improve evaluation performance? | I've built a data pipeline. Pseudo code is as follows:
dataset ->
dataset = augment(dataset)
dataset = dataset.batch(35).prefetch(1)
dataset = set_from_generator(to_feed_dict(dataset)) # expensive op
dataset = Cache('/tmp', dataset)
dataset = dataset.unbatch()
dataset = dataset.shuffle(64).batch(256).prefetch(1)
to_f... | prefetch(1) means that there will be only one element prefetched, I think you may want to have it as big as the batch size or larger.
After first cache you may try to put it second time but without providing a path, so it would cache some in the memory.
Maybe your HDD is just slow? ;)
Another idea is you could just ma... | 0 | false | 1 | 5,978 |
2019-03-01 11:32:59.497 | Get data from an .asp file | My girlfriend has been given the task of getting all the data from a webpage. The web page belongs to an adult education centre. To get to the webpage, you must first log in. The url is a .asp file.
She has to put the data in an Excel sheet. The entries are student names, numbers, ID card number, telephone, etc. There... | This is a really broad question and not really in the style of Stack Overflow. To give you some pointers anyway. In the end .asp files, as far as I know, behave like normal websites. Normal websites are interpreted in the browser like HTML, CSS etc. This can be parsed with Python. There are two approaches to this that ... | 0.201295 | false | 2 | 5,979 |
2019-03-01 11:32:59.497 | Get data from an .asp file | My girlfriend has been given the task of getting all the data from a webpage. The web page belongs to an adult education centre. To get to the webpage, you must first log in. The url is a .asp file.
She has to put the data in an Excel sheet. The entries are student names, numbers, ID card number, telephone, etc. There... | Try using the tool called Octoparse.
Disclaimer: I've never used it myself, but only came close to using it. So, from my knowledge of its features, I think it would be useful for your need. | 0.201295 | false | 2 | 5,979 |
2019-03-01 22:45:49.617 | Pygame/Python/Terminal/Mac related | I'm a beginner, I have really hit a brick wall, and would greatly appreciate any advice someone more advanced can offer.
I have been having a number of extremely frustrating issues the past few days, which I have been round and round google trying to solve, tried all sorts of things to no avail.
Problem 1)
I can't impo... | You should actually add the export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" to your .bash_profile (if you are using bash). Do this by opening your terminal, verifying that it says "bash" at the top. If it doesn't, you may have a .zprofile instead. Type ls -al and it will list all the invisible files. If you... | 0 | false | 1 | 5,980 |
2019-03-03 16:50:01.227 | Force screen session to use specific version of python | I am using a screen on my server. When I ask which python inside the screen I see it is using the default /opt/anaconda2/bin/python version which is on my server, but outside the screen when I ask which python I get ~/anaconda2/bin/python. I want to use the same python inside the screen but I don't know how can I set i... | You could do either one of the following:
Use a virtual environment (install virtualenv). You can specify
the version of Python you want to use when creating the virtual
environment with -p /opt/anaconda2/bin/python.
Use an alias:
alias python=/opt/anaconda2/bin/python. | 0.386912 | false | 1 | 5,981 |
2019-03-04 17:51:31.130 | How can i remove an object in python? | i'm trying to create a chess simulator.
consider this scenario:
there is a black rook (instance object of Rook class) in square 2B called rook1.
there is a white rook in square 2C called rook2.
when the player moves rook1 to square 2C , the i should remove rook2 object from memory completely.
how can i do it?
P.S. i'v... | Trying to remove objects from memory is the wrong way to go. Python offers no option to do that manually, and it would be the wrong operation to perform anyway.
You need to alter whatever data structure represents your chess board so that it represents a game state where there is a black rook at c2 and no piece at b2, ... | 0.999329 | false | 1 | 5,982 |
2019-03-04 22:00:24.150 | Text classification beyond the keyword dependency and inferring the actual meaning | I am trying to develop a text classifier that will classify a piece of text as Private or Public. Take medical or health information as an example domain. A typical classifier that I can think of considers keywords as the main distinguisher, right? What about a scenario like bellow? What if both of the pieces of text c... | (1) Bayes is indeed a weak classifier - I'd try SVM. If you see improvement than further improvement can be achieved using Neural Network (and perhaps Deep Learning)
(2) Feature engineering - use TFiDF , and try other things (many people suggest Word2Vec, although I personally tried and it did not improve). Also you ca... | -0.265586 | false | 1 | 5,983 |
2019-03-05 03:08:47.917 | How do you profile a Python script from Windows command line using PyPy and vmprof? | I have a Python script that I want to profile using vmprof to figure out what parts of the code are slow. Since PyPy is generally faster, I also want to profile the script while it is using the PyPy JIT. If the script is named myscript.py, how do you structure the command on the command line to do this?
I have already ... | I would be suprised if it works, but the command is pypy -m vmprof myscript.py <your program args>. I would expect it to crash saying vmprof is not supported on windows. | 0 | false | 1 | 5,984 |
2019-03-06 00:43:24.310 | How to update python 3.6 to 3.7 using Mac terminal | OK
I was afraid to use the terminal, so I installed the python-3.7.2-macosx10.9 package downloaded from python.org
Ran the certificate and shell profile scripts, everything seems fine.
Now the "which python3" has changed the path from 3.6 to the new 3.7.2
So everything seems fine, correct?
My question (of 2) is what's ... | Each version of the Python installation is independent of each other. So its safe to delete the version you don't want, but be cautious of this because it can lead to broken dependencies :-).
You can run any version by adding the specific version i.e $python3.6 or $python3.7
The best approach is to use virtual environm... | 0 | false | 1 | 5,985 |
2019-03-07 02:42:18.347 | How do I figure out what dependencies to install when I copy my Django app from one system to another? | I'm using Django and Python 3.7. I want to write a script to help me easily migrate my application from my local machien (a Mac High Sierra) to a CentOS Linux instance. I'm using a virtual environment in both places. There are many things that need to be done here, but to keep the question specific, how do I determi... | On the source system execute pip freeze > requirements.txt, then copy the requiremnts.txt to the target system and then on the target system install all the dependencies with pip install -r requirements.txt. Of course you will need to activate the virtual environments on both systems before execute the pip commands.
I... | 1.2 | true | 1 | 5,986 |
2019-03-07 10:03:42.277 | Does angular server and flask server have both to be running at the same? | I'm new to both angular and flask framework so plz be patient with me.
I'm trying to build a web app with flask as a backend server and Angular for the frontend (I didn't start it yet), and while gathering infos and looking at tutorials and some documentation (a little bit) I'm wondering:
Does Angular server and flask... | Angular does not need a server. It's a client-side framework so it can be served by any server like Flask. Probably in most tutorials, the backend is served by nodejs, not Flask. | 1.2 | true | 1 | 5,987 |
2019-03-08 19:25:09.250 | Change color of single word in Tk label widget | I would like to change the font color of a single word in a Tkinter label widget.
I understand that something similar to what I would like to be done can be achieved with a Text widget.. for example making the word "YELLOW" show in yellow:
self.text.tag_config("tag_yel", fg=clr_yellow)
self.text.highligh_pattern("YELL... | You cannot do what you want. A label supports only a single foreground color and a single background color. The solution is to use a text or canvas widget., or to use two separate labels. | 1.2 | true | 1 | 5,988 |
2019-03-11 12:10:11.213 | Running python directly in terminal | Is it possible to execute short python expressions in one line in terminal, without passing a file?
e.g. (borrowing from how I would write an awk expression)
python 'print("hello world")' | For completeness, I found you can also feed a here-string to python.
python <<< 'print("hello world")' | 0 | false | 2 | 5,989 |
2019-03-11 12:10:11.213 | Running python directly in terminal | Is it possible to execute short python expressions in one line in terminal, without passing a file?
e.g. (borrowing from how I would write an awk expression)
python 'print("hello world")' | python3 -c "print('Hello')"
Use the -c flag as above. | 1.2 | true | 2 | 5,989 |
2019-03-11 13:21:12.590 | How to save and load my neural network model after training along with weights in python? | I have trained a single layer neural network model in python (a simple model without keras and tensorflow).
How canI save it after training along with weights in python, and how to load it later? | So you write it down yourself. You need some simple steps:
In your code for neural network, store weights in a variable. It could be simply done by using self.weights.weights are numpy ndarrays. for example if weights are between layer with 10 neurons to layer with 100 neurons, it is a 10 * 100(or 100* 10) nd array.
U... | 0.135221 | false | 1 | 5,990 |
2019-03-12 12:23:21.577 | tf.gradient acting like tfp.math.diag_jacobian | I try to calculate noise for input data using the gradient of the loss function from the input-data:
my_grad = tf.gradients(loss, input)
loss is an array of size (n x 1) where n is the number of datasets, m is the size of the dataset, input is an array of (n x m) where m is the size of a single dataset.
I need my_grad ... | I suppose I have found a solution:
my_grad = tf.gradients(tf.reduce_sum(loss), input)
ensures, that the cross dependencies i!=j are ignored - that works really nicely and fast.. | 0 | false | 1 | 5,991 |
2019-03-12 14:50:25.703 | Lost my python.exe in Pycharm with Anaconda3 | Everything was working perfectly until today, when for some reason my python.exe file disappeared from the Project Interpreter in Pycharm.
It was located in C:\users\my_name\Anaconda3\python.exe, and for some reason I can't find it anywhere!
Yet, all the packages are here (in the site-packages folder), and only the C:\... | My Python.exe was missing today in my existing environment in anaconda, so I clone my environment with anaconda to recreate Python.exe and use it again in Spyder. | 0 | false | 3 | 5,992 |
2019-03-12 14:50:25.703 | Lost my python.exe in Pycharm with Anaconda3 | Everything was working perfectly until today, when for some reason my python.exe file disappeared from the Project Interpreter in Pycharm.
It was located in C:\users\my_name\Anaconda3\python.exe, and for some reason I can't find it anywhere!
Yet, all the packages are here (in the site-packages folder), and only the C:\... | The answer repeats the comment to the question.
I had the same issue once after Anaconda update - python.exe was missing. It was Anaconda 3 installed to Program Files folder by MS Visual Studio (Python 3.6 on Windows10 x64).
To solve the problem I manually copied python.exe file from the most fresh python package avail... | 1.2 | true | 3 | 5,992 |
2019-03-12 14:50:25.703 | Lost my python.exe in Pycharm with Anaconda3 | Everything was working perfectly until today, when for some reason my python.exe file disappeared from the Project Interpreter in Pycharm.
It was located in C:\users\my_name\Anaconda3\python.exe, and for some reason I can't find it anywhere!
Yet, all the packages are here (in the site-packages folder), and only the C:\... | I just had the same issue and found out that Avast removed it because it thought it was a threat. I found it in Avast -> Protection -> Virus Chest. And from there, you have the option to restore it. | 0.386912 | false | 3 | 5,992 |
2019-03-12 18:13:12.880 | trouble with appending scores in python | the code is supposed to give 3 questions with 2 attempts. if the answer is correct the first try, 3 points. second try gives 1 point. if second try is incorrect, the game will end.
however, the scores are not adding up to create a final score after the 3 rounds. how do i make it so that it does that? | First move import random to the top of the script because you're importing it every time in the loop and the score is calculated just in the last spin of the program since you empty scoreList[] every time | 0.673066 | false | 1 | 5,993 |
2019-03-13 05:05:14.420 | Accessing Luigi visualizer on AWS | I’ve been using the Luigi visualizer for pipelining my python code.
Now I’ve started using an aws instance, and want to access the visualizer from my own machine.
Any ideas on how I could do that? | We had the very same problem today on GCP, and solved with the following steps:
setting firewall rules for incoming TCP connections on port used by the service (which by default is 8082);
installing apache2 server on the instance with a site.conf configuration that resolve incoming requests on ip-of-instance:8082.
Th... | 0.201295 | false | 1 | 5,994 |
2019-03-13 09:24:24.310 | Async, multithreaded scraping in Python with limited threads | We have to refactor scraping algorithm. To speed it up we came up to conclusion to multi-thread processes (and limit them to max 3). Generally speaking scraping consists of following aspects:
Scraping (async request, takes approx 2 sec)
Image processing (async per image, approx 500ms per image)
Changing source item i... | What you're looking for is consumer-producer pattern. Just create 3 different queues and when you process the item in one of them, queue new work in another. Then you can 3 different threads each of them processing one queue. | 1.2 | true | 1 | 5,995 |
2019-03-13 20:16:42.690 | Pymongo inserts _id in original array after insert_many .how to avoid insertion of _id? | Pymongo inserts _id in original array after insert_many .how to avoid insertion of _id ? And why original array is updated with _id? Please explain with example, if anybody knows? Thanks in advance. | Pymongo driver explicitly inserts _id of type ObjectId into the original array and hence original array gets updated before inserting into mongo. This is the expected behaviour of pymongo for insertmany query as per my previous experiences. Hope this answers your question. | 1.2 | true | 1 | 5,996 |
2019-03-13 21:29:05.987 | how can i prevent the user from closing my cmd window in a python script on windows | is there any way to prevent the user from closing the cmd window of a python script on windows or maybe just disable the (X) close button ?? I have looked for answers already but i couldn't find anything that would help me | I dont think its possible, what you can do instead is to not display the cmd window (backgroundworker) and make it into a hidden process with system rights so that it cant be shutdown until it finishes. | 0 | false | 1 | 5,997 |
2019-03-14 00:37:45.023 | regex python multiline | how can i search for patterns in texts that cover multiple lines and have fixed positions relating each other, for example a pattern consisting of 3 letters of x directly below each other and I want to find them at any position in the line, not just at the beginning for example.
Thank you in advance for the answer! | I believe the problem you are asking about is "Find patterns that appear at the same offset in a series of lines."
I do not think this describes a regular language, so you would need to draw on Python's extended regex features to have a chance at a regex-based solution. But I do not believe Python supports sufficiently... | 0 | false | 1 | 5,998 |
2019-03-14 15:52:38.597 | Faster pytorch dataset file | I have the following problem, I have many files of 3D volumes that I open to extract a bunch of numpy arrays.
I want to get those arrays randomly, i.e. in the worst case I open as many 3D volumes as numpy arrays I want to get, if all those arrays are in separate files.
The IO here isn't great, I open a big file only to... | One trivial solution can be pre-processing your dataset and saving multiple smaller crops of the original 3D volumes separately. This way you sacrifice some disk space for more efficient IO.
Note that you can make a trade-off with the crop size here: saving bigger crops than you need for input allows you to still do ra... | 0 | false | 1 | 5,999 |
2019-03-14 19:33:03.197 | How does multiplexing in Django sockets work? | I am new at this part of web developing and was trying to figure out a way of creating a web app with the basic specifications as the example bellow:
A user1 opens a page with a textbox (something where he can add text or so), and it will be modified as it decides to do it.
If the user1 has problems he can invite oth... | This is definitely possible. They will be lots of possibilities, but I would recommend the following.
Have a page with code on. The page has some websocket JS code that can connect to a Channels Consumer.
The JS does 2 simple things. When code is updated code on the screen, send a message to the Consumer, with the new... | 0.386912 | false | 1 | 6,000 |
2019-03-14 20:28:27.727 | Operating system does not meet the minimum requirements of the language server | I installed Python 3.7.2 and VSCode 1.32.1 on Mac OS X 10.10.2. In VSCode I installed the Pyhton extension and got a message saying:
"Operating system does not meet the minimum requirements of the language server. Reverting to alternative, Jedi".
When clicking the "More" option under the message I got information ind... | The extension will work without the language server, but some thing won't work quite as well (e.g. auto-complete and some refactoring options). Basically if you remove the "python.jediEnabled" setting -- or set it to false -- and the extension works fine for you then that's the important thing. :) | 1.2 | true | 1 | 6,001 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.