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 |
|---|---|---|---|---|---|---|---|
2018-03-02 17:30:56.393 | How to install mod_wsgi to specific python version in Ubuntu? | I'm trying to install the mod_wsgi module in apache in my Ubuntu server but I need it to be specifically for version 2.7.13 in Python.For whatever reason every time I run sudo apt-get install libapache2-mod-wsgi it installs the mod_wsgi module for Python 2.7.12.I'm doing all of this because I'm running into a weird py... | Eventually Figured it out.The problem was that I had 2 versions of Python 2.7 installed in my server(2.7.12 and 2.7.13) so the definitions of one were conflicting with the other.Solved it when I completely removed Python 2.7.13 from the server. | 1.2 | true | 1 | 5,377 |
2018-03-03 11:28:05.170 | How can I pre-load or cache images with Python 2.7 and Kivy | This may be a basic question, but I'm still learning Kivy and I'm not sure how to do this.
The program that I'm writing with Python 2.7 and Kivy reads a folder full of images, and then will display them one at a time as the user clicks through.
Right now, I'm calling a function that reads the next image on the click o... | Loading all your images in memory will be a problem when you have a lot of images in the folder, but you could have a hidden image with the next image as source (it's not even needed to add the Image to the widget tree, you could just keep it in an attribute of your app), so everytime the user load the next image, it's... | 1.2 | true | 1 | 5,378 |
2018-03-04 12:23:49.227 | How to use nfcpy for MiFare 1k classic | I bought the card reader ACR122U and try to read mifare 1k classic cards with nfcpy.
So my question is, how can i read or write on a mifare 1k classic card using nfcpy? | Nfcpy only supports the standardized NFC Forum Type 1, 2, 3, and 4 Tags. Mifare 1K Classic uses a proprietary communication format and requires reader hardware with NXP Crypto-1 support. | 0.673066 | false | 1 | 5,379 |
2018-03-04 19:10:05.050 | how to call some logic in my views after rendering template in django | I am using form.py and the user is typing some Email-id, let us say I want to send an email to that particular email and write all that email into google sheet using gspread, I am able to do this in my views.py, but the problem is it's taking a lot of time to write which slow down the rendering process.
Is there any ot... | You should use some queuing mechanism like worker and consumer to avoid this problem.
For example Celery.
Steps to do for sending email:
1. Add email and info to the queue referred as task
2. Consume the queue. (It runs in the different process may be parallel too)
You can also use Channels newly added in Django famil... | 0.386912 | false | 1 | 5,380 |
2018-03-05 08:42:26.553 | Building a dashboard in Dash | I have used Shiny for R and specifically the Shinydashboard package to build easily navigatable dashboards in the past year or so. I have recently started using the Python, pandas, etc ecosystem for doing data analysis. I now want to build a dashboard with a number of inputs and outputs. I can get the functionality up ... | I have similar experience. A lot said python is more readable, while I agree, however, I don't find it as on par with R or Shiny in their respective fields yet. | 0.673066 | false | 1 | 5,381 |
2018-03-05 10:43:09.270 | How do I read/convert an HDF file containing a pandas dataframe written in Python 2.7 in Python 3.6? | I wrote a dataframe in Python 2.7 but now I need to open it in Python 3.6, and vice versa (I want to compare two dataframes written in both versions).
If I open a Python2.7-generated HDF file using pandas in Python 3.6, this is the error produced:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xde in position 1:... | Not exactly a solution but more of a workaround.
I simply read the files in their corresponding Python versions and saved them as a CSV file, which can then be read any version of Python. | 1.2 | true | 1 | 5,382 |
2018-03-05 14:41:39.273 | Two django project on the same ip address (server) | Is it possible to set two different django projects on the same IP address/server (Linode in this case)? For exmaple, django1_project running on www.example.com and django2_project on django2.example.com. This is preferable, but if this is not possible then how to make two djangos, i.e. one running on www.example.com/d... | I'm not familiar with Linode restrictions, but if you have control over your Apache files then you could certainly do it with name-based virtual hosting. Set up two VirtualHost containers with the same IP address and port (and this assumes that both www.example.com and django2.example.com resolve to that IP address) an... | 0 | false | 2 | 5,383 |
2018-03-05 14:41:39.273 | Two django project on the same ip address (server) | Is it possible to set two different django projects on the same IP address/server (Linode in this case)? For exmaple, django1_project running on www.example.com and django2_project on django2.example.com. This is preferable, but if this is not possible then how to make two djangos, i.e. one running on www.example.com/d... | Yes that's possible to host several Python powered sites with Apache + mod_wsgi from one host / Apache instance. The only constraint : all apps / sites must be powered by the same Python version, though each app may have (or not) its own virtualenv (which is strongly recommended). It is also recommended to use mod_wsgi... | 0.386912 | false | 2 | 5,383 |
2018-03-05 21:29:54.990 | Understanding Python Concurrency with Asyncio | I was wondering how concurrency works in python 3.6 with asyncio. My understanding is that when the interpreter executing await statement, it will leave it there until the awaiting process is complete and then move on to execute the other coroutine task. But what I see here in the code below is not like that. The progr... | asyncio use a loop to run everything, await would yield back the control to the loop so it can arrange the next coroutine to run. | 0 | false | 2 | 5,384 |
2018-03-05 21:29:54.990 | Understanding Python Concurrency with Asyncio | I was wondering how concurrency works in python 3.6 with asyncio. My understanding is that when the interpreter executing await statement, it will leave it there until the awaiting process is complete and then move on to execute the other coroutine task. But what I see here in the code below is not like that. The progr... | Invoking a blocking call such as time.sleep in an asyncio coroutine blocks the whole event loop, defeating the purpose of using asyncio.
Change time.sleep(10) to await asyncio.sleep(10), and the code will behave like you expect. | 1.2 | true | 2 | 5,384 |
2018-03-06 11:12:40.463 | how to use ws(websocket) via ngrok | I want to share my local WebSocket on the internet but ngrok only support HTTP but my ws.py address is ws://localhost:8000/
it is good working on localhost buy is not know how to use this on the internet? | You can use ngrok http 8000 to access it. It will work. Although, ws is altogether a different protocol than http but ngrok handles it internally. | 0.386912 | false | 1 | 5,385 |
2018-03-07 18:09:25.337 | How do I rewrite python file with a python script | file2.py is just variables
I want file1.py to import those variables (import file2) increment them, truncate file2.py and rewrite it with the newly incremented variables
I know how to increment them I'm just not sure how I would rewrite a python file with another python file while that file is also being imported...... | There's no conflict with import & write. Once the import is done, you have all the needed information held locally. You can overwrite the file without disturbing the values you hold in your run-time space. | 0 | false | 1 | 5,386 |
2018-03-08 11:15:48.500 | Running a Python Script in 32 Bit on 64 linux machine to connect to oracle DB with 32 bit client | I am trying to set up a cronjob that executes a python (3.6) script every day at a given time that connects to an oracle 12g database with a 32 bit client (utilizing the cx_Oracle and sqlalchemy libs). The code itself was developed on a win64 bit machine.
However, when trying to deploy the script onto an Ubuntu 16.04 s... | I am a bit confused about your question but this should give some clarification:
A 32-bit client can connect to a 64-bit Oracle database server - and vice versa
You can install and run 32-bit applications on a 64-bit machine - this is at least valid for Windows, I don't know how it works on Linux.
Your application (th... | 1.2 | true | 1 | 5,387 |
2018-03-08 15:53:22.397 | Airflow and Google Sheets | I'm new to Airflow and Python. I'm trying to connect Airflow with Google Sheets and although I have no problem connecting with Python, I do not know how I could do it from Airflow.
I have searched for information everywhere but I only find Python information with gspread or with BigQuery, but not with Google Sheets.
I ... | As far as I know there is no gsheet hook or operator in airflow at the moment. If security is not a concern you could publish it to the web and pull it in airflow using the SimpleHttpOperator.
If security is a concern I recommend going the PythonOperator route and use df2gspread library. Airflow version >= 1.9 can help... | 1.2 | true | 1 | 5,388 |
2018-03-09 01:14:52.303 | how to diplay file field and image field on pythonaywhere | I am using Django1.8 and I need help. how to display images and files on pythonanywhere by using model filefield and imagefield.
on my development server everything is ok.but during de production I have donne everything these two field.the parodox is bootstrap is well integread.
my project is on githb: Geyd/eces_edu.gi... | You need to actually serve the files. On your local machine, Django is serving static files for you. On PythonAnywhere, it is not. There is extensive documentation on the PythonAnywhere help pages to get you started with configuring static files. | 0.386912 | false | 1 | 5,389 |
2018-03-09 07:46:56.163 | Keras "Tanh Activation" function -- edit: hidden layers | Tanh activation functions bounds the output to [-1,1]. I wonder how does it work, if the input (features & Target Class) is given in 1-hot-Encoded form ?
How keras (is managing internally) the negative output of activation function to compare them with the class labels (which are in one-hot-encoded form) -- means only... | First of all you simply should'nt use them in your output layer. Depending on your loss function you may even get an error. A loss function like mse should be able to take the ouput of tanh, but it won't make much sense.
But if were talking about hidden layers you're perfectly fine. Also keep in mind, that there are bi... | 0 | false | 1 | 5,390 |
2018-03-09 13:34:52.017 | Preprocessing machine learning data | This may be a stupid question, but I am new to ML and can't seem to find a clear answer.
I have implemented a ML algorithm on a Python web app.
Right now I am storing the data that the algorithm uses in an offline CSV file, and every time the algorithm is run, it analyzes all of the data (one new piece of data gets add... | The data isn't stored in a CSV (Do I simply store it in a database like I would with any other type of data?)
You can store in whatever format you like.
Some form of preprocessing is used so that the ML algorithm doesn't have to analyze the same data repeatedly each time it is used (or does it have to given that one ... | 0.386912 | false | 1 | 5,391 |
2018-03-09 16:24:27.627 | Intentionally Fail Health Check using Route 53 AWS | I have a query as to whether what I want to achieve is doable, and if so, perhaps someone could give me some advice on how to achieve this.
So I have set up a health check on Route 53 for my server, and I have arranged so that if the health check fails, the user will be redirected to a static website I have set up at a... | Make up a filename. Let's say healthy.txt.
Put that file on your web server, in the HTML root. It doesn't really matter what's in the file.
Verify that if you go to your site and try to download it using a web browser, it works.
Configure the Route 53 health check as HTTP and set the Path for the check to use /healt... | 1.2 | true | 1 | 5,392 |
2018-03-09 18:14:42.037 | Blender IndexError: bpy_prop_collection | I try write a game with GoranM/bdx plugin. When i create plate with texture and try export to code I get fatal error.
Traceback (most recent call last):
File "C:\Users\Myuser\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\bdx\ops\exprun.py", line 225, in execute
export(self, context, bpy.con... | Go into Object Mode before calling that function.
bpy.ops.object.mode_set(mode='OBJECT', toggle=False) | -0.386912 | false | 1 | 5,393 |
2018-03-09 20:25:43.930 | import python file from docker volume | I have a docker volume that I created by running volume create my_volume and have been running my docker image with the command docker run -v my_volume:/Volumes/docker-volume/ my_image. Within the docker-volume directory I have a python file that I would like to import, but I can't figure out how to do so. Everything... | It looks like there is an issue with your volume mapping.
The volume mapping syntax is of format "-v {local volume}:{directory inside container}
So you would have to create that particular directory in your image before mapping it. | 0 | false | 1 | 5,394 |
2018-03-09 22:34:27.900 | Canopy python 32 bit Mac os x | ive been having trouble using a 32 bit python for canopy on mac. I dont know how to import a external version of python. Ive tried sites, but they all are from 2013-14. They just say to download the v1 with 32 bit python. I want any version of python that is 32 bit to work with canopy, I hope someone knows how, thanks. | Sorry, Canopy on Mac has not provided 32-bit Python since January 2015.
If you've got a really old (32-bit) version of OSX, then you're out of luck. Otherwise (you've got a recent OSX but just want to run 32-bit Python for some reason (WHY?) then...
I'm not clear from your question whether you have a 32-bit / IPython a... | 0 | false | 1 | 5,395 |
2018-03-09 23:15:16.963 | Windows 10: IDLE can't establish a subprocess | I am new to Python and recently installed Python 3.6 on Windows 10. When I try to open IDLE, Python's IDE, I keep getting a message saying that it can not establish a subprocess. I have tried uninstalling and installing several times. I have seen several forums which say that there could be a .py file that is in the di... | I work with over 30 Python developers and without fail when this happens they were behind a proxy / vpn. Turn off your proxy / vpn and it will work. Must have had this happen hundreds of times and this solution always worked. | 0 | false | 1 | 5,396 |
2018-03-10 07:01:04.750 | How to scrape data from inside Django app | As an exercise, I came up with an idea of the following Django project: a web app with literally one button to scrape room data from Airbnb and one text area to display the retrieved data in a sorted manner.
Preferably, for scraping I would like to use Selenium, as there is no API for this page. So the button would som... | The simplest option would be a view function (i.e. a function linked to a URL that receives a GET or POST request) in your app which does the scraping and immediately returns the results by rendering a template. For example you could have a starting page with a form and when that form is submitted that will create a PO... | 1.2 | true | 2 | 5,397 |
2018-03-10 07:01:04.750 | How to scrape data from inside Django app | As an exercise, I came up with an idea of the following Django project: a web app with literally one button to scrape room data from Airbnb and one text area to display the retrieved data in a sorted manner.
Preferably, for scraping I would like to use Selenium, as there is no API for this page. So the button would som... | Django follows MVT i.e Model (part where you write things related to the database ) , View (the logic analogous to what we did in controller - ref. Java) , Template(things that you'll actually see) .
As suggested by Alex you can have some inputs collected on your home page and using that data to scrape desired pages.... | 0.386912 | false | 2 | 5,397 |
2018-03-10 23:14:53.683 | Access file in external hard drive using python on mac | I have a Python file in /Users/homedir/... and I want it to access a csv file on an external hard drive.
Does anyone know how to do this? I only need reading permission. | External drives can be found under /Volumes on macOS. If you provide the full path and have read access you should be able to read in your csv. | 0.999329 | false | 1 | 5,398 |
2018-03-12 02:48:49.350 | Categorical Data yes/no to 0/1 python - is it a right approach? | My dataset has few features with yes/no (categorical data). Few of the machine learning algorithms that I am using, in python, do not handle categorical data directly. I know how to convert yes/no, to 0/1, but my question is -
Is this a right approach to go about it?
Can these values of no/yes to 0/1, be misinterpreted... | Yes, in my opinion, encoding yes/no to 1/0 would be the right approach for you.
Python's sklearn requires features in numerical arrays.
There are various ways of encoding : Label Encoder; One Hot Encoder. etc
However, since your variable only has 2 levels of categories, it wouldnt make much difference if you go for Lab... | 0.673066 | false | 1 | 5,399 |
2018-03-12 09:14:32.750 | What is happening when you use the python sleep module? | What exactly is happening when I call time.sleep(5) in a python script? Is the program using a lot of resources from the computer?
I see people using the sleep function in their programs to schedule tasks, but this requires you leave your hard drive running the whole time right? That would be taking for you computer o... | sleep will mark the process (thread) for being inactive until the given time is up. During this time the kernel will simply not schedule this process (thread). It will not waste resources.
Hard disks typically have spin-down policies based solely on their usage. If they aren't accessed for a specific time, they will... | 0.995055 | false | 1 | 5,400 |
2018-03-12 12:59:58.980 | Send POS Receipt Email to Customer While Validating POS Order | I have required to send POS Receipt to customer while validating POS order, the challenge is ticket is defined in point_of_sale/xml/pos.xml
receipt name is <t t-name="PosTicket">
how can i send this via email to customer. | You can create a wizard at the time of validation of POS order which popup after validating order. In that popup enter mail id of customer and by submit that receipt is directly forwarded to that customer. | 0 | false | 1 | 5,401 |
2018-03-13 04:47:18.973 | Mysql Connector issue in Python | I have installed MySQL connector for python 3.6 in centos 7
If I search for installed modules with below command
it's showing as below
pip3.6 freeze
mysql-connector==2.1.6
mysql-connector-python==2.1.7
pymongo==3.6.1
pip3.6 search mysql-connector
mysql-connector-python (8.0.6) -MYSQL dr... | This is the problem I faced in Environment created by python.Outside the python environment i am able to run the script.Its running succefully.In python environment i am not able run script i am working on it.if any body know can give suggestion on this | 1.2 | true | 2 | 5,402 |
2018-03-13 04:47:18.973 | Mysql Connector issue in Python | I have installed MySQL connector for python 3.6 in centos 7
If I search for installed modules with below command
it's showing as below
pip3.6 freeze
mysql-connector==2.1.6
mysql-connector-python==2.1.7
pymongo==3.6.1
pip3.6 search mysql-connector
mysql-connector-python (8.0.6) -MYSQL dr... | You must not name your script mysql.py — in that case Python tries to import mysql from the script — and fails.
Rename your script /root/Python_environment/my_Scripts/mysql.py to something else. | 0.201295 | false | 2 | 5,402 |
2018-03-13 10:42:26.920 | PyQt QTabWidget Multiple Corner WIdgets | I want to remove the actual Close, minimize and maximize buttons of a window and create my own custom buttons, just like in chrome. I therefore want to add corner widgets to my tabwidget. Is there a way so that I can add three buttons as corner widgets of a QTabWidget?
Is it somehow possible to achieve using the QHBoxL... | Add a generic QWidget as the corner widget.
Give it a QHBoxLayout.
Add your buttons to the layout.
I use this frequently, often by subclassing QTabWidget and creating accessor functions that return the individual buttons. Adding signals like buttonClicked(int) with the index and buttonClicked(QAbstractButton) with the... | 0.999329 | false | 1 | 5,403 |
2018-03-14 09:08:53.987 | Python KMeans Clustering - Handling nan Values | I am trying to cluster a number of words using the KMeans algorithm from scikit learn.
In particular, I use pre-trained word embeddings (300 dimensional vectors) to map each word with a number vector and then I feed these vectors to KMeans and provide the number of clusters.
My issue is that there are certain words in... | If you don't have data on a word, then skip it.
You could try to compute a word vector on the fly based on the context, but that essentially is the same as just skipping it. | 0 | false | 1 | 5,404 |
2018-03-15 01:00:56.233 | replace numbers with token if numbers have whitespace on both side | the code below replaces numbers with the token NUMB:
raw_corpus.loc[:,'constructed_recipe']=raw_corpus['constructed_recipe'].str.replace('\d+','NUMB')
It works fine if the numbers have a space before and a space after, but creates a problem if the numbers are included in another string.
How do I modify the code so tha... | I also tried ' \d+ ' and that works! probably not "pythonic" though... | 0 | false | 1 | 5,405 |
2018-03-16 16:19:40.817 | Looking for a particular python ORM | I have just inherited an extreemly legacy application (built on windows 95 - Magic7 for the connoisseurs) now backed against a recentish mssql db (2012). That's not the db system it was first designed on, and it thus comes with some seriously odd design for tables.
I'm looking for a python ORM to help me talk to this t... | For the record I've ended up with a hybrid approach using sqlalchemy.
Sqlalchemy was not flexible enough to do everything I wanted out of the box in a non verbose fashion, but had the required functionality to get a fair bit of the way along if one took the pain of writing explicitely everything needed. So I wrote a pr... | 0 | false | 1 | 5,406 |
2018-03-16 17:36:26.147 | What's the best way to release two versions of the same software package on GitHub? | A collaborator of mine wrote a software package in Python 2.7, took advantage of it to run some tests and obtain some scientific results. We wrote together a paper about the methods he developed and the results he obtained.
Everything worked out well so he recently put this package publically available on his GitHub we... | I think number 1. and 2. should both work as long as you provide enough details in the README.md file in the repository.
In case of option 1, you should ask your collaborator to add you as a collaborator to the repository.
In case of number 2, you should definitely cross-link each other's repositories in your README-f... | 0.386912 | false | 1 | 5,407 |
2018-03-17 19:12:42.187 | how to assign db column value to variable and call it to tokenize in python | I want assign the data which is retrieve from database (sqlit3) particular column for a variable and call that variable for word tokenize.
please help with this
I know tokenize part but I want to know how to assign the db value to a variable in python. | This is worked but when using c.fetchall it didn't work.shows error saying TypeError: expected string or buffer
import sqlite3
import nltk
from nltk.tokenize import sent_tokenize, word_tokenize
conn = sqlite3.connect('ACE.db')
c = conn.cursor()
c.execute('SELECT can_answer FROM Can_Answer')
rows = c.fetchone()
for row ... | 0 | false | 1 | 5,408 |
2018-03-19 06:18:10.247 | Is OAuth2 TokenScope similar to Django Permissions? | I'm building a dedicated OAuth2 as a service for my application, where users will be both authenticating and authorizing themselves.
I've the following concerns
1) Is OAuth2 TokenScope similar to Django Permissions?
2) If I want to make role-level hierarchy application, how do I go about building one with OAuth2? | Actually there is a difference between Django permissions and OAuth token scope, Django permissions use for define access level to your endpoint addresses like when you want just authenticated user see some data but OAuth token scope is for time you want to have third-party login and you define when somebody login what... | 0.386912 | false | 1 | 5,409 |
2018-03-20 11:36:27.477 | Install Python packages and directories (windows) | I am new to configuring and setting up Python from scratch.
I have installed Anaconda and I plan to use Spyder for python development. I also have a older version of Python installed on the same machine elsewhere.
I needed to get my hands on a package to use in Spyder which I needed to download and install.
I downloade... | Try to:
Open Anaconda Prompt and then do: pip install whatever - to install wheels
If you want to install spyder the open Anaconda Navigator - and you should be in the home tab - then highlat spyder and press install - thats all. | 0 | false | 1 | 5,410 |
2018-03-20 14:04:25.107 | How to run python code on cloud | I have a python code which is quite heavy, my computer cant run it efficiently, therefore i want to run the python code on cloud.
Please tell me how to do it ? any step by step tutorial available
thanks | You can try Heroku. It's free and they got their own tutorials. But it's good enough only if you will use it for studying. AWS, Azure or google cloud are much better for production. | 0 | false | 1 | 5,411 |
2018-03-20 17:08:30.347 | How to add an material to the maya scene? | Hi everyone I am trying to write some script to automate my work in Maya.
Right now I am looking for the way to add materials to the hypershade.
I can't see anything on console (Script editor) so I can't se what python api I should use.
I know that maya treat materials as sets, and to assign a material to polygon I n... | you have to use createNode :
node = cmds.createNode('blinn', name='yipikai') | 1.2 | true | 1 | 5,412 |
2018-03-21 13:47:00.707 | How to install Spyder for Python 2 and Python 3 and get Python 3 in my Spyder env? | I have Python 2.7 installed (as default in Windows 7 64bit) and also have Python 3 installed in an environment (called Python3).
I would like to use Spyder as my IDE. I have installed Spyder3 in my Python3 environment, but when I open Spyder 3 (from within my Python 3 env), then it opens Spyder for python 2.7 and not p... | So, when you create a new environment with: conda create --name python36 python=3.6 anaconda
This will create an env. called python36 and the package to be installed is anaconda (which basically contains everything you'll need for python).
Be sure that your new env. actually is running the ecorrect python version by ... | 0.201295 | false | 2 | 5,413 |
2018-03-21 13:47:00.707 | How to install Spyder for Python 2 and Python 3 and get Python 3 in my Spyder env? | I have Python 2.7 installed (as default in Windows 7 64bit) and also have Python 3 installed in an environment (called Python3).
I would like to use Spyder as my IDE. I have installed Spyder3 in my Python3 environment, but when I open Spyder 3 (from within my Python 3 env), then it opens Spyder for python 2.7 and not p... | One possible way is to run activate Python3 and then run pip install Spyder. | 0.386912 | false | 2 | 5,413 |
2018-03-22 01:28:29.740 | Find pid using python by grepping two variables | I am trying to find pid of a oracle process by using below command
ps -ef | grep pmon | grep orcl | grep -v grep
When trying to use python
oracle_pid = os.system("echo ps -ef | grep pmon | grep %s | grep -v grep | awk '{print $2}'" %(oracle_sid))
print(oracle_pid)
it is printing 0 as value
Any suggestions on how to ac... | Thanks for the reply !!!
The command works but it is adding extra characters
import subprocess
subprocess.check_output("ps -ef | grep pmon | grep orcl | grep -v grep | awk '{print $2}'", stderr=subprocess.STDOUT, shell=True)
b'21648\n' | 0 | false | 1 | 5,414 |
2018-03-22 20:51:00.680 | How to running Python script in virtual machine but read and save on computer local csv file | I have a Python script deployed and running in azure virtual machine, however in the script, I have to read a local CSV file for further processing, that leads a failure, server came back with notice that: "file does not exist "
May I ask how can I running Python script in VM but read and save on my computer local fil... | You could possible map the directory to the vm as a network resource? | 0 | false | 1 | 5,415 |
2018-03-23 22:11:26.950 | how to get and display photo from ldap | I'm using ldap3.
I can connect and read all attributes without any issue, but I don't know how to display the photo of the attribute thumbnailPhoto.
If I print(conn.entries[0].thumbnailPhoto) I get a bunch of binary values like b'\xff\xd8\xff\xe0\x00\x10JFIF.....'.
I have to display it on a bottle web page. So I have t... | The easiest way is to save the raw byte value in a file and open it with a picture editor. The photo is probably a jpeg, but it can be in any format. | 0.201295 | false | 1 | 5,416 |
2018-03-25 15:41:40.857 | TensorFlow: ImportError: cannot import name 'dragon4_positional' | I get the following error when trying to use tensorflow
importError Traceback (most recent call
last) in ()
----> 1 import tensorflow as tf
~\Anaconda3\lib\site-packages\tensorflow__init__.py in ()
22
23 # pylint: disable=wildcard-import
---> 24 from tensorflow.pytho... | This looks like it is an issue with Numpy, which is a dependency of Tensorflow. Did you try upgrading your version of numpy using pip or conda?
Like such: pip install --ignore-installed --upgrade numpy | 0 | false | 1 | 5,417 |
2018-03-25 20:50:09.550 | Different IPs are for different apps | At first, I am learning Python and Django only... So I'm a noobie yet.
I need to build a microservice architecture to I could run each my service on a separate server machine. In the Django I need to create an environment, project and apps. So, can I run these apps after on different servers? If no, how can I make it w... | Either approach will work.
If it makes sense for your services to share the same code base, you can create a single project and use separate apps for each service and separate settings files for each deployment. The settings file would activate the desired app by listing it in INSTALLED_APPS, and would include settings... | 1.2 | true | 1 | 5,418 |
2018-03-25 21:26:22.797 | What is returned by scipy.io.wavefile.read()? | I have never worked with audio before.
For a monophonic wav file read() returns an 1-D array of integers. What do these integers represent? Are they the frequencies? If not how do I use them to get the frequencies? | wavfile.read() returns two things:
data: This is the data from your wav file which is the amplitude of the audio taken at even intervals of time.
sample rate: How many of those intervals make up one second of audio. | 1.2 | true | 1 | 5,419 |
2018-03-26 05:57:47.947 | Text Categorization Test NLTK python | I have using nltk packages and train a model using Naive Bayes. I have save the model to a file using pickle package. Now i wonder how can i use this model to test like a random text not in the dataset and the model will tell if the sentence belong to which categorize?
Like my idea is i have a sentence : " Ronaldo have... | Just saving the model will not help. You should also save your VectorModel (like tfidfvectorizer or countvectorizer what ever you have used for fitting the train data). You can save those the same way using pickle. Also save all those models you used for pre-processing the train data like normalization/scaling models, ... | 1.2 | true | 1 | 5,420 |
2018-03-26 12:36:28.430 | How does Python internally distinguish "from package import module" between "from module import function" | If I understand correctly, the python syntax from ... import ... can be used in two ways
from package-name import module-name
from module-name import function-name
I would like to know a bit of how Python internally treats the two different forms. Imagine, for example, that the interpreter gets "from A import B", do... | First of all, a module is a python file that contains classes and functions. when you say From A Import B python searches for A(a module) in the standard python library and then imports B(the function or class) which is the module if it finds A. If it doesn't it goes out and starts searching in the directory were packa... | -0.386912 | false | 1 | 5,421 |
2018-03-26 14:38:24.260 | What is a good crawling speed rate? | I'm crawling web pages to create a search engine and have been able to crawl close to 9300 pages in 1 hour using Scrapy. I'd like to know how much more can I improve and what value is considered as a 'good' crawling speed. | It really depends but you can always check your crawling benchmarks for your hardware by typing scrapy bench on your command line | 0 | false | 2 | 5,422 |
2018-03-26 14:38:24.260 | What is a good crawling speed rate? | I'm crawling web pages to create a search engine and have been able to crawl close to 9300 pages in 1 hour using Scrapy. I'd like to know how much more can I improve and what value is considered as a 'good' crawling speed. | I'm no expert but I would say that your speed is pretty slow. I just went to google, typed in the word "hats", pressed enter and: about 650,000,000 results (0.63 seconds). That's gonna be tough to compete with. I'd say that there's plenty of room to improve. | -0.135221 | false | 2 | 5,422 |
2018-03-27 05:06:56.187 | Verify mountpoint in the remote server | os.path.ismount() will verify whether the given path is mounted on the local linux machine. Now I want to verify whether the path is mounted on the remote machine. Could you please help me how to achieve this.
For example: my dev machine is : xx:xx:xxx
I want to verify whether the '/path' is mounted on yy:yy:yyy.
How ... | If you have access to both machines, then one way could be to leverage python's sockets. The client on the local machine would send a request to the server on the remote machine, then the server would do os.path.ismount('/path') and send back the return value to the client. | 0 | false | 1 | 5,423 |
2018-03-27 22:23:28.003 | How to parse a c/c++ header with llvmlite in python | I'd like to parse a c and/or c++ header file in python using llvmlite. Is this possible? And if so, how do I create an IR representation of the header's contents? | llvmlite is a python binding for LLVM, which is independent from C or C++ or any other language. To parse C or C++, one option is to use the python binding for libclang. | 0 | false | 1 | 5,424 |
2018-03-28 05:18:16.253 | Are framework and libraries the more important bit of coding? | Coding is entirely new to me.
Right now, I am teaching myself Python. As of now, I am only going over algorithms. I watched a few crash courses online about the language. Based on that, I don't feel like I am able to code any sort of website or software which leads me wonder if the libraries and frameworks of any prog... | First of all, you should try to be comfortable with every Python mechanisms (classes, recursion, functions... everything you usually find in any book or complete tutorial). It could be useful for any problem you want to solve.
Then, you should start your own project using the suitable libraries and frameworks. You mus... | 1.2 | true | 1 | 5,425 |
2018-03-29 07:20:01.590 | Keras rename model and layers | 1) I try to rename a model and the layers in Keras with TF backend, since I am using multiple models in one script.
Class Model seem to have the property model.name, but when changing it I get "AttributeError: can't set attribute".
What is the Problem here?
2) Additionally, I am using sequential API and I want to give ... | To rename a keras model in TF2.2.0:
model._name = "newname"
I have no idea if this is a bad idea - they don't seem to want you to do it, but it does work. To confirm, call model.summary() and you should see the new name. | 0.424784 | false | 2 | 5,426 |
2018-03-29 07:20:01.590 | Keras rename model and layers | 1) I try to rename a model and the layers in Keras with TF backend, since I am using multiple models in one script.
Class Model seem to have the property model.name, but when changing it I get "AttributeError: can't set attribute".
What is the Problem here?
2) Additionally, I am using sequential API and I want to give ... | for 1), I think you may build another model with right name and same structure with the exist one. then set weights from layers of the exist model to layers of the new model. | -0.179442 | false | 2 | 5,426 |
2018-03-29 16:33:58.400 | Heroku Python import local functions | I'm developing a chatbot using heroku and python. I have a file fetchWelcome.py in which I have written a function. I need to import the function from fetchWelcome into my main file.
I wrote "from fetchWelcome import fetchWelcome" in main file. But because we need to mention all the dependencies in the requirement fil... | If we need to import function from fileName into main.py, write "from .fileName import functionName". Thus we don't need to write any dependency in requirement file. | 0 | false | 1 | 5,427 |
2018-03-29 17:21:53.613 | How to choose RandomState in train_test_split? | I understand how random state is used to randomly split data into training and test set. As Expected, my algorithm gives different accuracy each time I change it. Now I have to submit a report in my university and I am unable to understand the final accuracy to mention there. Should I choose the maximum accuracy I get?... | For me personally, I set random_state to a specific number (usually 42) so if I see variation in my programs accuracy I know it was not caused by how the data was split.
However, this can lead to my network over fitting on that specific split. I.E. I tune my network so it works well with that split, but not necessaril... | 0.201295 | false | 1 | 5,428 |
2018-03-30 10:14:52.273 | Python application freezes, only CTRL-C helps | I have a Python app that uses websockets and gevent. It's quite a big application in my personal experience.
I've encountered a problem with it: when I run it on Windows (with 'pipenv run python myapp'), it can (suddenly but very rarily) freeze, and stop accepting messages. If I then enter CTRL+C in cmd, it starts reac... | Your answer may be as simple as adding timeouts to some of your spawns or gevent calls. Gevent is still single threaded, and so if an IO bound resource hangs, it can't context switch until it's been received. Setting a timeout might help bypass these issues and move your app forward? | 0 | false | 1 | 5,429 |
2018-03-30 14:45:10.337 | How to compare date (yyyy-mm-dd) with year-Quarter (yyyyQQ) in python | I am writing a sql query using pandas within python. In the where clause I need to compare a date column (say review date 2016-10-21) with this value '2016Q4'. In other words if the review dates fall in or after Q4 in 2016 then they will be selected. Now how do I convert the review date to something comparable to 'yyyy... | Once you are able to get the month out into a variable: mon
you can use the following code to get the quarter information:
for mon in range(1, 13):
print (mon-1)//3 + 1,
print
which would return:
for months 1 - 3 : 1
for months 4 - 6 : 2
for months 7 - 9 : 3
for months 10 - 12 : 4 | 1.2 | true | 1 | 5,430 |
2018-03-31 04:10:29.847 | Measurement for intersection of 2 irregular shaped 3d object | I am trying to implement an objective function that minimize the overlap of 2 irregular shaped 3d objects. While the most accurate measurement of the overlap is the intersection volume, it's too computationally expensive as I am dealing with complex objects with 1000+ faces and are not convex.
I am wondering if there a... | A sample-based approach is what I'd try first. Generate a bunch of points in the unioned bounding AABB, and divide the number of points in A and B by the number of points in A or B. (You can adapt this measure to your use case -- it doesn't work very well when A and B have very different volumes.) To check whether a gi... | 1.2 | true | 2 | 5,431 |
2018-03-31 04:10:29.847 | Measurement for intersection of 2 irregular shaped 3d object | I am trying to implement an objective function that minimize the overlap of 2 irregular shaped 3d objects. While the most accurate measurement of the overlap is the intersection volume, it's too computationally expensive as I am dealing with complex objects with 1000+ faces and are not convex.
I am wondering if there a... | By straight voxelization:
If the faces are of similar size (if needed triangulate the large ones), you can use a gridding approach: define a regular 3D grid with a spacing size larger than the longest edge and store one bit per voxel.
Then for every vertex of the mesh, set the bit of the cell it is included in (this ju... | 0 | false | 2 | 5,431 |
2018-03-31 08:19:33.750 | How executed code block Science mode in Pycharm | Like Spyder, you can execute code block. how can i do in Pycharm in science mode. in spyder you use
# In[]
How can i do this in pycharm | you can just import numpy to actvate science mode.
import numpy as np | 0.201295 | false | 2 | 5,432 |
2018-03-31 08:19:33.750 | How executed code block Science mode in Pycharm | Like Spyder, you can execute code block. how can i do in Pycharm in science mode. in spyder you use
# In[]
How can i do this in pycharm | pycharm use code cell. you can do with this
'#%% ' | 1.2 | true | 2 | 5,432 |
2018-03-31 10:41:21.540 | Building WSN topology integrated with SDN controller (mininet-wifi) | In mininet-wifi examples, I found a sample (6LowPAN.py) that creates a simple topology contains 3 nodes.
Now, I intend to create another topology as follows:
1- Two groups of sensor nodes such that each group connects to a 'Sink
node'
2- Connect each 'Sink node' to an 'ovSwitch'
3- Connect the two switches to a 'C... | Yes, you can do this with 6LowPAN.py. You then add switches and controller into the topology with their links. | 0.386912 | false | 1 | 5,433 |
2018-04-01 01:28:54.353 | Neural Network - Input Normalization | It is a common practice to normalize input values (to a neural network) to speed up the learning process, especially if features have very large scales.
In its theory, normalization is easy to understand. But I wonder how this is done if the training data set is very large, say for 1 million training examples..? If # f... | A large number of features makes it easier to parallelize the normalization of the dataset. This is not really an issue. Normalization on large datasets would be easily GPU accelerated, and it would be quite fast. Even for large datasets like you are describing. One of my frameworks that I have written can normalize th... | 1.2 | true | 1 | 5,434 |
2018-04-01 15:08:50.007 | Finding the eyeD3 executable | I just installed the abcde CD utility but it's complaining that it can't find eyeD3, the Python ID3 program. This appears to be a well-known and unresolved deficiency in the abcde dependencies, and I'm not a Python programmer, so I'm clueless.
I have the Python 2.7.12 came with Mint 18, and something called python3 (3.... | Gave up...waste of my time and everyone else's sorry.
What I apparently needed was the eyed3 (lowercase 'd') non-python utility. | 0 | false | 2 | 5,435 |
2018-04-01 15:08:50.007 | Finding the eyeD3 executable | I just installed the abcde CD utility but it's complaining that it can't find eyeD3, the Python ID3 program. This appears to be a well-known and unresolved deficiency in the abcde dependencies, and I'm not a Python programmer, so I'm clueless.
I have the Python 2.7.12 came with Mint 18, and something called python3 (3.... | I don't know how to force pip to install under python3.
python3 -m pip install eyeD3 will install it for Python3. | 0.201295 | false | 2 | 5,435 |
2018-04-02 22:28:00.080 | python pair multiple field entries from csv | Trying to take data from a csv like this:
col1 col2
eggs sara
bacon john
ham betty
The number of items in each column can vary and may not be the same. Col1 may have 25 and col2 may have 3. Or the reverse, more or less.
And loop through each entry so its output into a text file like this
breakfast_1
breakfast_i... | First, get a distinct of all breakfast items.
A pseudo code like below
Iterate through each line
Collect item and person in 2 different lists
Do a set on those 2 lists
Say persons, items
Counter = 1
for person in persons:
for item in items:
Print "breafastitem", Counter
Print person, item | 0 | false | 1 | 5,436 |
2018-04-03 07:25:09.530 | How to find out Windows network interface name in Python? | Windows command netsh interface show interface shows all network connections and their names. A name could be Wireless Network Connection, Local Area Network or Ethernet etc.
I would like to change an IP address with netsh interface ip set address "Wireless Network Connection" static 192.168.1.3 255.255.255.0 192.168.1... | I don't know of a Python netsh API. But it should not be hard to do with a pair of subprocess calls. First issue netsh interface show interface, parse the output you get back, then issue your set address command.
Or am I missing the point? | 0.673066 | false | 1 | 5,437 |
2018-04-03 11:57:26.050 | how do I install my modual onto my local copy of python on windows? | I'm reading headfirst python and have just completed the section where I created a module for printing nested list items, I've created the code and the setup file and placed them in a file labeled "Nester" that is sitting on my desktop. The book is now asking for me to install this module onto my local copy of Python. ... | On Windows systems, third-party modules (single files containing one or more functions or classes) and third-party packages (a folder [a.k.a. directory] that contains more than one module (and sometimes other folders/directories) are usually kept in one of two places: c:\\Program Files\\Python\\Lib\\site-packages\\ and... | 0 | false | 1 | 5,438 |
2018-04-03 19:38:45.600 | Django : how to give user/group permission to view model instances for a specified period of time | I am fairly new to Django and could not figure out by reading the docs or by looking at existing questions. I looked into Django permissions and authentication but could not find a solution.
Let's say I have a Detail View listing all instances of a Model called Item. For each Item, I want to control which User can view... | Information about UserItemExpiryDate has to be stored in a separate table (Model). I would recommend using your coding in Django.
There are few scenarios to consider:
1) A new user is created, and he/she should have access to items.
In this case, you add entries to UserItemExpiry with new User<>Item combination (as ... | 1.2 | true | 1 | 5,439 |
2018-04-04 13:46:20.373 | how to read text from excel file in python pandas? | I am working on a excel file with large text data. 2 columns have lot of text data. Like descriptions, job duties.
When i import my file in python df=pd.read_excel("form1.xlsx"). It shows the columns with text data as NaN.
How do I import all the text in the columns ?
I want to do analysis on job title , description ... | Try converting the file from .xlsx to .CSV
I had the same problem with text columns so i tried converting to CSV (Comma Delimited) and it worked. Not very helpful, but worth a try. | 0.201295 | false | 1 | 5,440 |
2018-04-04 17:20:14.923 | make a web server in localhost with flask | I want to know that if I can make a web server with Flask in my pc like xampp apache (php) for after I can access this page in others places across the internet. Or even in my local network trough the wifi connection or lan ethernet. Is it possible ? I saw some ways to do this, like using "uwsgi".. something like this.... | Yes, you can.
Just like you said, you can use uwsgi to run your site efficiently. There are other web servers like uwsgi: I usually use Gunicorn. But note that Flask can run without any of these, it will simply be less efficient (but if it is just for you then it should not be a problem).
You can find tutorials on the ... | 0.386912 | false | 1 | 5,441 |
2018-04-04 18:48:40.377 | Python - How do I make a window along with widgets without using modules like Tkinter? | I have been wanting to know how to make a GUI without using a module on Python, I have looked into GUI's in Python but everything leads to Tkinter or other Python GUI modules. The reason I do not want to use Tkinter is because I want to understand how to do it myself. I have looked at the Tkinter modules files but it i... | For the same reason that you can't write to a database without using a database module, you can't create GUIs without a GUI module. There simply is no way to draw directly on the screen in a cross-platform way without a module.
Writing GUIs is very complex. These modules exist to reduce the complexity. | 0.201295 | false | 2 | 5,442 |
2018-04-04 18:48:40.377 | Python - How do I make a window along with widgets without using modules like Tkinter? | I have been wanting to know how to make a GUI without using a module on Python, I have looked into GUI's in Python but everything leads to Tkinter or other Python GUI modules. The reason I do not want to use Tkinter is because I want to understand how to do it myself. I have looked at the Tkinter modules files but it i... | You cannot write a GUI in Python without importing either a GUI module or importing ctypes. The latter would require calling OS-specific graphics primitives, and would be far worse than doing the same thing in C. (EDIT: see Roland comment below for X11 systems.)
The python-coded tkinter mainly imports the C-coded _tk... | 1.2 | true | 2 | 5,442 |
2018-04-04 21:19:39.857 | Regular Expression in python how to find paired words | I'm doing the cipher for python. I'm confused on how to use Regular Expression to find a paired word in a text dictionary.
For example, there is dictionary.txt with many English words in it. I need to find word paired with "th" at the beginning. Like they, them, the, their .....
What kind of Regular Expression should ... | ^(th\w*)
gives you all results where the string begins with th . If there is more than one word in the string you will only get the first.
(^|\s)(th\w*)
wil give you all the words begining with th even if there is more than one word begining with th | 0 | false | 1 | 5,443 |
2018-04-04 22:36:48.643 | pycharm ctrl+v copies the item in console instead paste when highlighted | This has been a very annoying problem for me and I couldn't find any keymaps or settings that could cause this behavior.
Setup:
Pycharm Professional 2018.1 installed on redhat linux
I remote into the linux machine using mobaX and launch pycharm with window forwarding
Scenario 1:
I open a browser on windows, copy some... | I figured it out: it's caused by the copy-on-select setting of my linux system. To turn it off, go to mobax-settings-configurations-x11-clipboard-disable 'copy on select' | 1.2 | true | 1 | 5,444 |
2018-04-05 01:37:04.467 | In Keras, how to send each item in a batch through a model? | I have a model that starts with a Conv2D layer and so it must take input of shape (samples, rows, cols, channels) (and the model must ultimately output a shape of (1)). However, for my purposes one full unit of input needs to be some (fixed) number of samples, so the overall input shape sent into this model when given ... | At the moment you are returning a 3D array.
Add a Flatten() layer to convert the array to 2D, and then add a Dense(1). This should output (batch_size, 1). | 0.135221 | false | 1 | 5,445 |
2018-04-05 06:45:15.460 | How to add report_tensor_allocations_upon_oom to RunOptions in Keras | I'm trying to train a neural net on a GPU using Keras and am getting a "Resource exhausted: OOM when allocating tensor" error. The specific tensor it's trying to allocate isn't very big, so I assume some previous tensor consumed almost all the VRAM. The error message comes with a hint that suggests this:
Hint: If yo... | OOM means out of memory. May be it is using more memory at that time.
Decrease batch_size significantly. I set to 16, then it worked fine | 0.201295 | false | 1 | 5,446 |
2018-04-05 12:22:11.997 | Django multilanguage text and saving it on mysql | I have a problem with multilanguage and multi character encoded text.
Project use OpenGraph and it will save in mysql database some information from websites. But database have problem with character encoding. I tryed encoding them to byte. That is problem, becouse in admin panel text show us bute and it is not reada... | You should encode all data as UTF-8 which is unicode. | 0 | false | 1 | 5,447 |
2018-04-05 18:38:56.977 | How to Install requests[security] in virtualenv in IntelliJ | I'm using python 2.7.10 virtualenv when running python codes in IntelliJ. I need to install requests[security] package. However I'm not sure how to add that [security] option/config when installing requests package using the Package installer in File > Project Structure settings window. | Was able to install it by doing:
Activating the virtualenv in the 'Terminal' tool window:
source <virtualenv dir>/bin/activate
Executing a pip install requests[security] | 0 | false | 1 | 5,448 |
2018-04-06 07:42:50.770 | Use HermiT in Python | We have an ontology but we need to use the reasoner HermiT to infer the sentiment of a given expression. We have no idea how to use and implement a reasoner in python and we could not find a good explanation on the internet. We found that we can use sync_reasoner() for this, but what does this do exactly? And do we hav... | You do not need to implement the reasoner. The sync_reasoner() function already calls HermiT internally and does the reasoning for you.
A reasoner will reclassify individuals and classes for you which means it creates a parent-child hierarchy of classes and individuals. When you load an ontology only explicit parent-c... | 1.2 | true | 1 | 5,449 |
2018-04-06 17:50:58.693 | Saving data to MacOS python application | I am using Pyinstaller to create my Python app from a set of scripts. This script uses a library that saves downloaded data to the '~/' directory (using the os.join function).
I was wondering how to edit the code in the library so that when it runs, it saves data to inside the app (like in the package, the Contents/Res... | I was wondering how to edit the code in the library so that when it runs, it saves data to inside the app
Don't do that. This isn't a standard practice in macOS applications, and will fail in some standard system configurations. For example, it will fail if the application is used by a non-administrator user, or if th... | 1.2 | true | 1 | 5,450 |
2018-04-09 02:59:03.377 | How are PyTorch's tensors implemented? | I am building my own Tensor class in Rust, and I am trying to make it like PyTorch's implementation.
What is the most efficient way to store tensors programmatically, but, specifically, in a strongly typed language like Rust? Are there any resources that provide good insights into how this is done?
I am currently buil... | Contiguous array
The commonly used way to store such data is in a single array that is laid out as a single, contiguous block within memory. More concretely, a 3x3x3 tensor would be stored simply as a single array of 27 values, one after the other.
The only place where the dimensions are used is to calculate the mappi... | 1.2 | true | 1 | 5,451 |
2018-04-10 09:23:35.627 | Pycharm - Cannot find declaration to go to | I changed my project code from python 2.7 to 3.x.
After these changes i get a message "cannot find declaration to go to" when hover over any method and press ctrl
I'm tryinig update pycharm from 2017.3 to 18.1, remove directory .idea but my issue still exist.
Do you have any idea how can i fix it? | I had same issue and invalidating cache or reinstalling the app didn't help.
As it turned out the problem was next: for some reasons *.py files were registered as a text files, not python ones. After I changed it, code completion and other IDE features started to work again.
To change file type go Preferences -> Editor... | 0.386912 | false | 5 | 5,452 |
2018-04-10 09:23:35.627 | Pycharm - Cannot find declaration to go to | I changed my project code from python 2.7 to 3.x.
After these changes i get a message "cannot find declaration to go to" when hover over any method and press ctrl
I'm tryinig update pycharm from 2017.3 to 18.1, remove directory .idea but my issue still exist.
Do you have any idea how can i fix it? | The solution for me: remember to add an interpreter to the project, it usually says in the bottom right corner if one is set up or not. Just an alternate solution than the others.
This happened after reinstalling PyCharm and not fully setting up the ide. | 0.081452 | false | 5 | 5,452 |
2018-04-10 09:23:35.627 | Pycharm - Cannot find declaration to go to | I changed my project code from python 2.7 to 3.x.
After these changes i get a message "cannot find declaration to go to" when hover over any method and press ctrl
I'm tryinig update pycharm from 2017.3 to 18.1, remove directory .idea but my issue still exist.
Do you have any idea how can i fix it? | What worked for me was right-click on the folder that has the manage.py > Mark Directory as > Source Root. | 0.386912 | false | 5 | 5,452 |
2018-04-10 09:23:35.627 | Pycharm - Cannot find declaration to go to | I changed my project code from python 2.7 to 3.x.
After these changes i get a message "cannot find declaration to go to" when hover over any method and press ctrl
I'm tryinig update pycharm from 2017.3 to 18.1, remove directory .idea but my issue still exist.
Do you have any idea how can i fix it? | I had a case where the method was implemented in a base class and Pycharm couldn't find it.
I solved it by importing the base class into the module I was having trouble with. | 0.081452 | false | 5 | 5,452 |
2018-04-10 09:23:35.627 | Pycharm - Cannot find declaration to go to | I changed my project code from python 2.7 to 3.x.
After these changes i get a message "cannot find declaration to go to" when hover over any method and press ctrl
I'm tryinig update pycharm from 2017.3 to 18.1, remove directory .idea but my issue still exist.
Do you have any idea how can i fix it? | Right click on the folders where you believe relevant code is located ->Mark Directory as-> Sources Root
Note that the menu's wording "Sources Root" is misleading: the indexing process is not recursive. You need to mark all the relevant folders. | 1.2 | true | 5 | 5,452 |
2018-04-11 09:36:40.700 | VScode run code selection | I just made the transition from Spyder to VScode for my python endeavours. Is there a way to run individual lines of code? That's how I used to do my on-the-spot debugging, but I can't find an option for it in VScode and really don't want to keep setting and removing breakpoints.
Thanks. | I'm still trying to figure out how to make vscode do what I need (interactive python plots), but I can offer a more complete answer to the question at hand than what has been given so far:
1- Evaluate current selection in debug terminal is an option that is not enabled by default, so you may want to bind the 'editor.de... | 0 | false | 2 | 5,453 |
2018-04-11 09:36:40.700 | VScode run code selection | I just made the transition from Spyder to VScode for my python endeavours. Is there a way to run individual lines of code? That's how I used to do my on-the-spot debugging, but I can't find an option for it in VScode and really don't want to keep setting and removing breakpoints.
Thanks. | In my ver of VSCode (1.25), shift+enter will run selection. Note that you will want to have your integrated terminal running python. | 0.240117 | false | 2 | 5,453 |
2018-04-11 12:21:36.483 | How to run a django project without manage.py | Basically I downloaded django project from SCM, Usually I run the project with with these steps
git clone repository
extract
change directory to project folder
python manage.py runserver
But this project does not contains manage.py , how to run this project in my local machine???
br | Most likely, this is not supposed to be a complete project, but a plugin application. You should create your own project in the normal way with django-admin.py startproject and add the downloaded app to INSTALLED_APPS. | 0.470104 | false | 1 | 5,454 |
2018-04-11 21:08:57.980 | Python - Subtracting the Elements of Two Arrays | I am new to Python programming and stumbled across this feature of subtracting in python that I can't figure out. I have two 0/1 arrays, both of size 400. I want to subtract each element of array one from its corresponding element in array 2.
For example say you have two arrays A = [0, 1, 1, 0, 0] and B = [1, 1, 1,... | I can't replicate this but it looks like the numbers are 8 bit and wrapping some how | 0 | false | 1 | 5,455 |
2018-04-12 00:14:16.700 | How do I save a text file in python, to my File Explorer? | I've been using Python for a few months, but I'm sort of new to Files. I would like to know how to save text files into my Documents, using ".txt". | If you do not like to overwrite existing file then use a or a+ mode. This just appends to existing file. a+ is able to read the file as well | 0 | false | 1 | 5,456 |
2018-04-12 19:41:16.037 | Send data from Python backend to Highcharts while escaping quotes for date | I would highly appreciate any help on this. I'm constructing dynamic highcharts at the backend and would like to send the data along with html to the frontend.
In highcharts, there is a specific field to accept Date such as:
x:Date.UTC(2018,01,01)
or x:2018-01-01. However, when I send dates from the backend, it is alw... | Highcharts expects the values on datetime axes to be timestamps (number of miliseconds from 01.01.1970). Date.UTC is a JS function that returns a timestamp as Number. Values surrounded by apostrophes are Strings.
I'd rather suggest to return a timestamp as a String from backend (e.g. '1514764800000') and then convert i... | 0 | false | 1 | 5,457 |
2018-04-13 03:56:24.947 | Google Cloud - What products for time series data cleaning? | I have around 20TB of time series data stored in big query.
The current pipeline I have is:
raw data in big query => joins in big query to create more big query datasets => store them in buckets
Then I download a subset of the files in the bucket:
Work on interpolation/resampling of data using Python/SFrame, because so... | I would use PySpark on Dataproc, since Spark is not just realtime/streaming but also for batch processing.
You can choose the size of your cluster (and use some preemptibles to save costs) and run this cluster only for the time you actually need to process this data. Afterwards kill the cluster.
Spark also works very ... | 1.2 | true | 1 | 5,458 |
2018-04-16 06:29:31.313 | Nested list comprehension to flatten nested list | I'm quite new to Python, and was wondering how I flatten the following nested list using list comprehension, and also use conditional logic.
nested_list = [[1,2,3], [4,5,6], [7,8,9]]
The following returns a nested list, but when I try to flatten the list by removing the inner square brackets I get errors.
odds_evens =... | To create a flat list, you need to have one set of brackets in comprehension code. Try the below code:
odds_evens = ['odd' if n%2!=0 else 'even' for n in l for l in nested_list]
Output:
['odd', 'odd', 'odd', 'even', 'even', 'even', 'odd', 'odd', 'odd'] | -0.101688 | false | 1 | 5,459 |
2018-04-17 09:44:50.407 | Password protect a Python Script that is Scheduled to run daily | I have a python script that is scheduled to run at a fixed time daily
If I am not around my colleague will be able to access my computer to run the script if there is any error with the windows task scheduler
I like to allow him to run my windows task scheduler but also to protect my source code in the script... is the... | Compile the source to the .pyc bytecode, and then move the source somewhere inaccessible.
Open a terminal window in the directory containing your script
Run python -m py-compile <yourfile.py> (you should get a yourfile.pyc file)
Move <yourfile.py> somewhere secure
your script can now be run as python <yourfile.pyc>
N... | 1.2 | true | 1 | 5,460 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.