[{"Question":"Is there a possibility to see all pip installed packages in Pycharm?\nBecause I have the Problem: I write in PyCharm and it works fine, but now I want to move the project to a server... And now I don't know how can I quickly export this","AnswerCount":3,"Available Count":1,"Score":0.0665680765,"is_accepted":false,"ViewCount":70,"Q_Id":65914621,"Users Score":1,"Answer":"Use the command pip freeze >requirements.txt locally to import the environment you need into the file,\nthen use the command pip install -r requirements.txt on the server to install the required environment","Q_Score":0,"Tags":"python,pycharm","A_Id":65914668,"CreationDate":"2021-01-27T07:28:00.000","Title":"See pip installations in a PyCharm Project?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I wrote a program that automatically navigates me threw a website, but how do I copy my current URL.\nContext: I am attempting to code a watch2gether bot that automatically creates a watch2gether room","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":30,"Q_Id":65926560,"Users Score":1,"Answer":"I don't know which programming language you use, but in Python3 its simply driver.current_url","Q_Score":0,"Tags":"python-3.x,selenium,discord","A_Id":65926716,"CreationDate":"2021-01-27T20:03:00.000","Title":"How do i copy a URL from searchbar?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm a newbie to the django framework and trying to make a watchlist for stocks. I've already made the crux of the webapp, where-in, a user can search for a quote and add it to their watchlist, along with relevant data about that quote.\nWhat I want to do now is, to save the separate watchlists that different users are creating (after creating an account on my site) and upon logging in to my site, they can view their personalized watchlist and edit it.\nI'm using a model for storing the data for the watchlist quotes and looking for a way to provide the different personalized watchlists depending upon the logged in user.\nCan anyone give me a lead on how to employ the logic for this? Do I need to use two data bases - one for the data of the users and the other one for storing the respective user watchlists? If yes, how do I connect everything?\nEDIT: Ever used a stock investment app? The way every user\/customer can log in to their account and make\/edit and save their watchlists in the app - that is the functionality I want to implement. How\/Where do I store so many watchlists?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":44,"Q_Id":65927879,"Users Score":1,"Answer":"use 'request.user' from your view, to know the user who sent the request and return the corresponding watchlist","Q_Score":0,"Tags":"python,django,django-models","A_Id":65928436,"CreationDate":"2021-01-27T21:46:00.000","Title":"How to provide different sets of data to different users in django?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am doing binary classification for a time series with keras LSTM. How could I extract the final output from the model? By this I mean, how can I get a list containing zero and one values from the final model?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":242,"Q_Id":65939879,"Users Score":0,"Answer":"You should attach right after a LSTM layer a Dense layer with as much neurons as you consider (that depends upon the LSTM output itself), and on top of that one add a final Dense classification layer with a single neuron, that'd be the binary output.","Q_Score":0,"Tags":"python,tensorflow,keras,deep-learning,lstm","A_Id":65944376,"CreationDate":"2021-01-28T15:09:00.000","Title":"Keras LSTM Binary Classification Output","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am new on Medical Imaging. I am dealing with MRI images, namely T2 and DWI.\nI uploaded both images with nib.load, yet each sequence image has a different number of slices (volume, depth?). If I select one slice (z coordinate), how can get the corresponding slice on the other sequence image? ITK does it correctly, so maybe something in the NIFTI header could help?\nThank you so much for reading! I also tried interpolation, but it did not work.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":76,"Q_Id":65946097,"Users Score":1,"Answer":"Reading the NIFTI, namely affine, and extracting the translation Transformation Matrix to create a mapping from the T2 to the DWI voxels.\nHint: nibabel.","Q_Score":1,"Tags":"python,registration,coordinate-systems,itk,medical-imaging","A_Id":65971759,"CreationDate":"2021-01-28T22:25:00.000","Title":"How to correlate different MRI sequences images in NIFTI format?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to reinstall Jupyter-Lab with conda completely. I mean, when I run uninstall jupyterlab and install it again, the system already comes with configuration I had previously, such as extensions installed. Therefore, there is something that is still present after the uninstall.\nHence, how do I completely remove jupyter-lab and install it again from scratch?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2217,"Q_Id":65952807,"Users Score":1,"Answer":"When jupyterlab is installed use jupyter --paths to see where the configuration, data and runtime is stored. After removing the corresponding files and directories you will be able to perform a clean install without any traces of the old extensions.\nRemember to use it in the right environment.","Q_Score":0,"Tags":"python,installation,conda,jupyter-lab","A_Id":65961985,"CreationDate":"2021-01-29T10:32:00.000","Title":"Uninstall Jupyter-Lab with conda completely","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have built a Socket TCP \/ IP server that listens on a specific port and then, with that data, makes a rest query to another server, and that response is returned through the port where it received it.\nAll Socket server is made in Python 3.8 and works great.\nI need to know how to implement this code from my Socket server to an Azure Functions, so that it provides permanent service?\nI appreciate the goodwill of anyone who can offer an answer.\nThanks Total.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":68,"Q_Id":65954851,"Users Score":0,"Answer":"Simple answer: you cannot do that. Azure Functions are Event-based (such as an HTTP call). If you need to provide TCP socket, maybe hosting your python code in a container, e.g. Azure Container Instances, might be a good way to go.","Q_Score":0,"Tags":"python,sockets","A_Id":65956535,"CreationDate":"2021-01-29T12:52:00.000","Title":"How to implement a python code to work as Azure Function?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm hoping this is a fairly simple question with a simple answer.\nIn PostgreSQL I have a table with a Answer column that is a jsonb.\nAs of right now, the data that can be stored in the column can be empty or quite varied. Some examples include:\n\n{\"Answer\":\"My name is Fred\"}\n{\"Answer\":[{\"text\": \"choice 1\", \"isActive\": true}, {\"text\": \"choice 2\", \"isActive\": false}]}\n\nYes, we store a field called Answer in our column called Answer. Not sure why, but that is how it is.\nI want to be able to test if the JSON attribute Answer contains a string or an array. But I don't know how, and I must be wording my searches incorrectly. I'm not finding anything concrete. I already know how to check if Answer exists. Just can't tell what it contains.\nDoes anyone know how I would do this? Or if there isn't a way, what I need to do instead to query this data?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":66,"Q_Id":65956645,"Users Score":0,"Answer":"func.jsonb_typeof(.answer.op('->')('Answer')) == \"string\" seems to do the job.","Q_Score":0,"Tags":"python,postgresql,flask-sqlalchemy,jsonb","A_Id":65957361,"CreationDate":"2021-01-29T14:48:00.000","Title":"How do I check the type of a field contained in a JSONB?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to implement a simple source code that DROPs all RST packets that come into the computer using Python. What should I do?\nLinux servers can be easily set up using the iptables command, but I want to make it Python for use on Mac, Linux, and Windows systems.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":31,"Q_Id":65970822,"Users Score":0,"Answer":"Dropping RST packets is a function of the networking firewall built into your operating system.\nThere is only one way to do it on Linux: with iptables. You could use Python to instruct iptables.\nWindows has its own way to add firewall rules. MacOS also has its own way, and each of them is different from the other.\nThere is no single common way to do this. Therefore, there is no single common way to do this with Python.","Q_Score":0,"Tags":"python,packet","A_Id":65971659,"CreationDate":"2021-01-30T17:10:00.000","Title":"how to RST packet drop using python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using bulk_create to upload some data from excel to django db. Since the data is huge I had to use bulk_create instead of .create and .save. But the problem is that I need to show the user how many duplicate data has been found and has not been uploaded due to integrity error. Is there a way to get the number of errors or duplicate data while using bulk upload?","AnswerCount":1,"Available Count":1,"Score":-0.537049567,"is_accepted":false,"ViewCount":117,"Q_Id":65989590,"Users Score":-3,"Answer":"After, Reading data from csv file.\nFirst create a list before inserting data to system.\nThen convert that list to set after then again sort the data which is in set.\nHere , you gets every data exactly one time in sorted manner.","Q_Score":0,"Tags":"python,django,postgresql","A_Id":65990514,"CreationDate":"2021-02-01T08:48:00.000","Title":"is there a way to get the count of conflicts while using Django ...bulk_create(.., ignore_conflicts=True)?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have Django model with Image field, but sometimes I don't need to actually upload file and store path to it, but I need to store only path. Especially url. I mean, I have web client, that receives both foreign urls like sun1-17.userapi.com and url of my own server, so sometimes I don't need to download but need to store url. Is it possible, to store url in ImageField, or I need to make CharField and save files via python? If its impossible, how do I save file in python3, having one, sent me via multipart?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":254,"Q_Id":65994385,"Users Score":0,"Answer":"The URL field in the ImageField is ReadOnly, so you cannot write it. You should probably use in addition a URLField (better than a CharField) to save the URLs.\nYou can allow null values on both and use only the appropriate one according to your scenario.","Q_Score":0,"Tags":"python-3.x,django,imagefield","A_Id":65994666,"CreationDate":"2021-02-01T14:22:00.000","Title":"How to save URL to a Django ImageField","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"How can I an image as the background in my ursina project. I know I can change the color of the background by using window.color = color.light_gray for example. But how do I use an image?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":704,"Q_Id":66001243,"Users Score":0,"Answer":"Try\nSky(texture=\"texture_name\")","Q_Score":0,"Tags":"python,background","A_Id":66217213,"CreationDate":"2021-02-01T22:49:00.000","Title":"How can I set a .jpg as window background in python ursina?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to make an app with kivy and kivymd but I can't figure out how I can make the setup screen show up only the first time. This is how the application is going to work: User launches the application after installation and is being shown the sign up\/log in screen, And once the user is done with the setup, the setup screens will never appear again unless the user reinstalls the application.\nHow can I make this happen?\nPlease help and thanks SO much in advance!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":63,"Q_Id":66005886,"Users Score":1,"Answer":"I fixed this problem by creating and reading a \"text\" file.My \"text\" file has '0' as a boolean variable .Once the user is done with signing up \/ logging in , I change that \"text\" file to '1' ,and in the __init__ func, I check if that file equals to '0' or '1'.\nI'm not sure if this is the correct way or not,but this worked for me.","Q_Score":0,"Tags":"python,kivy,kivy-language,python-3.8,kivymd","A_Id":66173541,"CreationDate":"2021-02-02T08:16:00.000","Title":"Showing the setup screen only on first launch in kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am wondering how best to feed back the changes my DQN agent makes on its environment, back to itself.\nI have a battery model whereby an agent can observe a time-series forecast of 17 steps, and 5 features. It then makes a decision on whether to charge or discharge.\nI want to includes its current state of charge (empty, half full, full etc) in its observation space (i.e. somewhere within the (17,5) dataframes I am feeding it).\nI have several options, I can either set a whole column to the state of charge value, a whole row, or I can flatten the whole dataframe and set one value to the state of charge value.\nIs any of these unwise? It seem a little rudimentary to me to set a whole columns to a single value, but should it actually impact performance? I am wary of flattening the whole thing as I plan to use either conv or lstm layers (although the current model is just dense layers).","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":40,"Q_Id":66008062,"Users Score":1,"Answer":"You would not want to add in unnecessary features which are repetitive in the state representation as it might hamper your RL agent convergence later when you would want to scale your model to larger input sizes(if that is in your plan).\nAlso, the decision of how much of information you would want to give in the state representation is mostly experimental. The best way to start would be to just give in a single value as the battery state. But if the model does not converge, then maybe you could try out the other options you have mentioned in your question.","Q_Score":0,"Tags":"python,deep-learning,reinforcement-learning,dqn","A_Id":66030093,"CreationDate":"2021-02-02T10:41:00.000","Title":"Reinforcement learning DQN environment structure","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Sorry to my bad english.\nSo i use a automate with MERVIS software and i use a Bacnet server to have my variable in my IHM (weintek panel pc with Easybuilder Pro).\nSo all i make is good and work but i'm not happy to EasyBuilder pro and i want make my own HMI. I decide to make my application with QT in C++.\nBut i'm physicien at the begining so learn little bit by little bit( i have base of python,c++, structur text). I know nothing about how build a bacnet client and do you have idea where can i find some simple exemple to communicate with my PLC because i find nothing and i need to learn and make this to my project.\nSo i have my PLC, link in ethernet to my PC where i make my hmi. In the future i want put this application in PANEL PC tactil work in window and link to my PLC with MERVIS software.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":55,"Q_Id":66029193,"Users Score":0,"Answer":"If I'm clear on the question, you could checkout the 'BACnet Stack' project source code or even the 'VTS' source code too - for a C\/C++ (language) reference.\nOtherwise YABE is a good project in C# (language), but there's also a BACnet NuGet package available for C# too - along with the mechanics that underpin the YABE tool.","Q_Score":0,"Tags":"python,c++,client,bacnet,human-interface","A_Id":67459182,"CreationDate":"2021-02-03T14:09:00.000","Title":"Create Bacnet client variable automate","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"hello guys I'm trying to make another one to access my Django website I host it on my localhost by type\npython manage.py runserver 0.0.0.0:8000\nand i set the ALLOWED_HOSTS = ['*']\nwhen I trying to connect with my IP it's says refused to connect.\ncan someone help me","AnswerCount":1,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":78,"Q_Id":66032193,"Users Score":-1,"Answer":"you are only hosting your server in your local network therefore no-one outside of this network can access your server. To make them access it you would have to make it accessible over the internet for example via hosting it on aws or another cloud hoster.","Q_Score":0,"Tags":"python,django","A_Id":66032246,"CreationDate":"2021-02-03T17:00:00.000","Title":"how can i make someone on another network access my website with django","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Let's imagine, I have a simple tkinter program: only tkinter.Entry(), where I can write down some text. The main goal I have set to this tkinter.Entry() is to make next: when I try to input there some symbol, it is immediately deleted from tkinter.Entry(). So the question is how to make tkinter.Entry() delete every symbol, when it have been just input there?\nI hope the problem is fully described. Thanks in advance for your help.\n\nI apologize, but it seems to me that this question has lost its former relevance for me. Sorry for letting you take all of your precious time. I took all the answers and tips into account. I will delete the question soon. Thank you for your attention to me","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":45,"Q_Id":66033049,"Users Score":1,"Answer":"From what I deduced, you're trying to delete the content from the entry widget.\ntkinter.Entry.delete('0',END)\nThis should do it.","Q_Score":0,"Tags":"python-3.x,tkinter,tkinter-entry","A_Id":66033184,"CreationDate":"2021-02-03T17:56:00.000","Title":"How to immediately delete just input symbol in tkinter.Entry()","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a Tkinter app which I have converted to .app and .exe, but after giving this app to others if I have to update the app how should I do it(like in play store update)? And also if I package this app and distribute with an installer then how to send update to the app?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":44,"Q_Id":66033193,"Users Score":2,"Answer":"I don't think that it's possible to update the app like that. Android apps usually are made with Java, and iOS apps are made with Xcode, Swift, and Objective-C. I don't usually make apps with Python, unless they are for myself, because once they are made into apps, they cannot be updated (as far as I know). If I wanted to update my Python app, I would remove the first app, then use Pyinstaller to make the updated app.\nHope this helps, and have a good day. :)","Q_Score":1,"Tags":"python,python-3.x,windows,macos,tkinter","A_Id":66034171,"CreationDate":"2021-02-03T18:05:00.000","Title":"how can i create a tkinter app updater which is included with the app","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm using Task Scheduler to execute python run.py. It works, but the Python interpreter pops up. I want to run run.py in the background without any interpreter popping up.\nHow can I do this? In Linux I'd just do python run.py & to get it to run in the background silently, but I'm not sure how to achieve the same in Windows with Task Scheduler.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":655,"Q_Id":66055158,"Users Score":0,"Answer":"You can just change .py extension to .pyw\nand the python file will run in background.\nAnd if you want to terminate or check if it actually running in background,\nsimply open Task manager and go to Processes you will see python32 running\nthere.\nEDIT\nAs you mentioned, this doesn't seem like working from command line because changing the file's .extension simply tells your system to open the file with pythonw application instead of python.\nSo when you are running this via command line as python .\\run.pyw even with the .pyw this will run with python.exe instead of pythonw.exe.\nSolution:\nAs you mentioned in the comments, run the file as pythonw .\\run.pyw or .\\run.py\nor just double click the run.pyw file.","Q_Score":0,"Tags":"python,windows,scheduled-tasks","A_Id":66055185,"CreationDate":"2021-02-04T23:02:00.000","Title":"How to hide window when running a Task Scheduler task","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I had developed a standalone application on Windows for Deep Learning \/ Computer vision in Python 3.X using various standard python libraries such as pandas, numpy, TensorFlow, Keras, Yolo, PyQt ...etc. I want to deliver this application to my client but without source code.\nCan you please help me how to do this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":102,"Q_Id":66056606,"Users Score":0,"Answer":"\"I want to deliver this application to my client but without source code.\"\nCan you clarify this process?\nIf you just want to deliver this service to your client you can just use HTTP\/POST to let users upload their data to you, then you run these data on your network on the server, and finally, just return the prediction result to them.","Q_Score":0,"Tags":"python,python-3.x,windows,deep-learning","A_Id":66056643,"CreationDate":"2021-02-05T02:07:00.000","Title":"How to hide \/ encrypt source code written in Python?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I just uninstalled and reinstalled python on my Windows machine. Before I uninstalled my previous version I was able to just double-click on a python script and it would open the command prompt, run the script, and close automatically. After re-installing with the newest version (3.9), I am no longer able to execute the script like that with a double-click.\nClearly I had done something special last time to set that up for myself, but I don't remember what it was. Any idea how I can get that double-click deal going again?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1269,"Q_Id":66073004,"Users Score":0,"Answer":"There will be an option of \"Open With\" after right-click on the file go and choose CMD. I hope it helps if not then sorry. Because I use Parrot OS","Q_Score":2,"Tags":"python,python-3.x,windows","A_Id":66073027,"CreationDate":"2021-02-06T02:26:00.000","Title":"How to execute .py file with double-click","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have built a snake game using Turtle graphics module of Python, and now I wish to convert it into an apk.\nI have tried kivy. It builds the apk, but the app crashes as soon as I open it in android. When using adb logact -s python, it says that the tkinter module is not available.\nOn further researching, I got to know that turtle graphics is based upon tkinter module and tkinter is not supported by python-for-android. The solutions suggest to rewrite my code in Kivy, but I don't know how to do so.\nAny suggestions on how can I run my turtle graphics game on android?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":277,"Q_Id":66080212,"Users Score":0,"Answer":"The solutions suggest to rewrite my code in Kivy, but I don't know how to do so.\n\n\nAny suggestions on how can I run my turtle graphics game on android?\n\nIt looks like you've already found the solution: rewrite your graphics in Kivy, or another python module that works on android. Recent pygame releases might.\nIf you don't know how to do so, you need to learn. If you try to do so but have problems with any specific question, that would be a better target for a stackoverflow question.","Q_Score":0,"Tags":"android,python-3.x,kivy,python-turtle,python-for-android","A_Id":66081362,"CreationDate":"2021-02-06T18:05:00.000","Title":"Turtle Graphics APK","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have VRP problem. I have vehicles starting positions and I have distance matrix. I want solution to be terminated\/finished when certain locations are visited.\nSo I don't want it to actually visit each index of location_matrix but if visiting different index beside \"MUST VISITS\" make for better solution then I have no problem. Because you know sometimes going from directly 1 to 3 is slower than 1-2-3. (visiting 2 which is not necessary but make it for shortcut)\nI defined a dummy depot which cost 0 , I used this for end because if you use starts you have to define ends. And I put ends 000 which are basically ending position. You might ask why you didnt put your \"JOB\" locations. But this means they have to end there. So it doesn't seem optimal because example one vehicle could be really near to both of \"JOB\" locations but if it terminates \/ ends because it has END defined vehicle would stop.\nI have no idea how to make this work. Basically what I want that if certain locations are visited once just terminate - that's the solution. So if jobs are (1,3,5) and Vehicle 1 visited 1,3 and Vehicle 2 just visited 2 it should be finished.\nIf I use solver in ortools It will be like TSP problem which will try to visit each location in distance_matrix. I don't exactly want this. It could visit if results better solution(does it make sense?) but it should be focusing on \"JOB\" locations and how to go them faster","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":112,"Q_Id":66087248,"Users Score":1,"Answer":"Potential approach: Compute a new distance matrix with only the \"MUST VISIT\" locations, and run a VRP with this matrix.\n\nCompute a distance matrix with only the \"MUST VISIT\" locations.\nEach cell contains the shortest path between two \"MUST VISIT\" locations.\nStore all the pairwise shortest paths found.\nRun a regular VRP on this distance matrix.\nReconstruct the full path using the shortest paths found earlier.","Q_Score":2,"Tags":"python,python-3.x,algorithm,or-tools,vehicle-routing","A_Id":66105127,"CreationDate":"2021-02-07T11:16:00.000","Title":"Vehicle Routing Problem - How to finish\/determine when certain locations are visited?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm dealing with a highly imbalanced dataset for my project rn, for the simplicity, I will give a simple example here: a dataset has a number of 20 '0's and 80 '1's so the total is 100.\nSuppose I have already used X_train, X_test,y_train,y_test = train_test_split(X, y,stratify=y,random_state=42) to make a stratified split (X_train.shape is 80 and X_test.shape is 20), so my question is how to achieve under-sampling with K-fold validation in the train dataset at the same time.\nMy initial thought is use from imblearn.under_sampling import RandomUnderSampler to get 16 '0's and 16 '1's (total is 32) to make equal distributed dataset, and do the K-fold cross-validation on that 32 dataset and discard the rest of 48 in the X_train. Use the model to predict the X_test. So I was wondering if this is correct procedure to deal with.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":99,"Q_Id":66093809,"Users Score":0,"Answer":"You can use RandomUnderSampler method to achieve it. Put random states and ratio value in the arguments and try to see if this works.","Q_Score":0,"Tags":"python,machine-learning","A_Id":66102683,"CreationDate":"2021-02-07T22:32:00.000","Title":"How to do under-sampling with K-fold validation in machine learning","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I've built an IB TWS application in python. All seems to work fine, but I'm struggling with one last element.\nTWS requires a daily logout or restart. I've opted for the daily restart at a set time so I could easily anticipate a restart of my application at certain times (at least, so I thought.)\nMy program has one class, called InteractiveBrokersAPI which subclasses the ECClient and EWrapper. Upon the start of my program, I create this instance and it successfully connects to and works with TWS. Now, say that TWS restarts daily at 23:00. I have implemented logic in my program that creates a new instance of my InteractiveBrokersAPI, and calls run() on it af 23:15. This too seems to work. I know this because upon creation, InteractiveBrokersAPI calls reqAccountUpdates() and I can see these updates coming in after my restart. When I try to actually commit a trade the next day, I get an error that it's not connected.\nDoes anyone else have experience in how to handle this? I am wondering how others have fixed this issue. Any guidance would be highly appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":198,"Q_Id":66117983,"Users Score":0,"Answer":"Well, this doesnt exactly answer your question, but have you looked at ib_insync","Q_Score":0,"Tags":"python,interactive-brokers,tws","A_Id":66525038,"CreationDate":"2021-02-09T11:19:00.000","Title":"Interactive Brokers TWS: How to handle daily restart in python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"My code (test.py) looks like this (simplified):\nfrom app.utils import conversion \n(code) \nWhen I try to make an executable using PyInstaller, the .exe works when I import generic modules. However, I get the following error message when I use ''from app.utils import conversion'' at the beginning of my code:\nModuleNotFoundError: No module named 'app' \nand the .exe won't run.\nMy project is structured this way (simplified):\nproject\/app\/test.py \nproject\/app\/utils\/conversion.py \nThe instruction I put in the console is:\npyinstaller --onefile test.py \nAny idea why and how to overcome this? Thanks!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":39,"Q_Id":66144821,"Users Score":0,"Answer":"Here is how I fixed my problem:\nin the .spec file, added the missing app module in hiddenimports:\nhiddenimports=[\"app\"]\nThen to compile the executable, I run the .spec file instead or the .py file.\npyinstaller --onefile test.spec","Q_Score":0,"Tags":"python,module,compiler-errors,pyinstaller,exe","A_Id":67639113,"CreationDate":"2021-02-10T20:52:00.000","Title":"ModuleNotFoundError: No module named 'x' because can't find the module folder, PyInstaller","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Let me describe it as briefly and clearly as possible:\nI have 10 different copies of a node JS based program running on 10 different desktops. I want to create a Node JS based (or any other technology) web app deployed on a server which will check if these 10 programs are online or not.\nAny suggestions as to how I can implement this?\nNote: The node JS based desktop apps are running on electron.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":38,"Q_Id":66156309,"Users Score":0,"Answer":"You can use 2 most probable ways.\n\nif you want to know immediately whether out of 10 programs, if any of them goes offline then you should use Socket.io\n\n\nYour server nodejs program will act as server and your 10 desktop program will work as client. Your 10 client socket connection will connect with server socket connection and server socket can check whether socket client is still connected or not based on Ping\/Pong concept of socket.\n\nin brief, Ping\/pong technique in which server sends Ping event on socket connection and client will receive server's ping event and send Pong event back to server.\nif client is not sending Pong event back in predefined time interval on getting Ping event then that client is offline or disconnected.\n\nYou can periodically (say every 1\/5\/10 minutes etc ) call simple HTTP request and check if response status is 200 or not. If any of the 10 desktop program is offline then you will know it by response status whether it is 200 or not.","Q_Score":0,"Tags":"javascript,python,node.js,electron,backend","A_Id":68328337,"CreationDate":"2021-02-11T14:08:00.000","Title":"Node JS detect connectivity to all Node JS programs","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Let me describe it as briefly and clearly as possible:\nI have 10 different copies of a node JS based program running on 10 different desktops. I want to create a Node JS based (or any other technology) web app deployed on a server which will check if these 10 programs are online or not.\nAny suggestions as to how I can implement this?\nNote: The node JS based desktop apps are running on electron.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":38,"Q_Id":66156309,"Users Score":0,"Answer":"While you can use socket.io for this there may also be a simpler way and that is to just use a post request \/ cron to check every X minutes if the server is reachable from 'Checking' server (that would just be the server that is doing the check)\nSo why not use socket.io? Well, without knowing how you node servers are setup, its hard to say if socket.io would be a good fit, this is simply because socket.io uses WSS to connect, so unless you are running it from the browser it will need additional configurations \/ modules setup on the server to actually use WSS (if you do go this route, you will need socket.io-client module on each system, this is important because this will allow you to connect to the socket.io server, also make sure the version of socket.io matches the socket.io-client build)\nAll in all, if I was building this out, I would probably just do a simple ping of each server and log it to a DB or what not but your requirements will really dictate the direction you go","Q_Score":0,"Tags":"javascript,python,node.js,electron,backend","A_Id":68328746,"CreationDate":"2021-02-11T14:08:00.000","Title":"Node JS detect connectivity to all Node JS programs","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I do not have administrative privileges' on my Windows 10 workstation. The IT department installed Python 2.7 as my request but I proceed a PIP upgrade without the \"--user\" setting, and now the already installed PIP got corrupted and I do not know how to recover it.\nThe corrupted PIP always return syntax error on lib\\site-packages\\pip_internal\\cli\\main.py\", line 60\nsys.stderr.write(f\"ERROR: {exc}\")\nI can not run again the --upgrade or get-pip\nI can write in the Python folder so I can change the main.py file.\nIs there a way to manually recover the installation (without sudo)? I need to reinstall the Python?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":226,"Q_Id":66180184,"Users Score":0,"Answer":"It would be better to reinstall Python, yes.\nIt would be better to install a version of Python that was actually still supported, such as 3.6 or newer.","Q_Score":0,"Tags":"python,installation,pip,failed-installation","A_Id":66180204,"CreationDate":"2021-02-12T23:08:00.000","Title":"How to to manually recover the a PIP corrupted installation?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have been working on a project which involves me to get the icon from the icon theme used on Linux so that I can use it with the Gtk Pixbuf like how Gnome-system-monitor displays the icon for all the process, the same thing I want to achieve. Any ideas about how to do this?\nI am using python with Gtk on PopOS 20.10.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":200,"Q_Id":66184610,"Users Score":1,"Answer":"Gio.AppInfo in the Gtk library stack is a good point to start.\nIf you are looking for the approach that is used by the gnome-system-monitor then the prettytable.c file will the one you need to check.\nThere is one more approach, scanning the \/usr\/share\/application\/ directory and creating a file monitor for this directory. All icons of the application are that are in the menu can be found here.","Q_Score":0,"Tags":"python,linux,user-interface,process,gtk","A_Id":69208718,"CreationDate":"2021-02-13T11:32:00.000","Title":"Get icon of a process (like in gnome-system-monitor) to be used with Gtk and python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Thanks for your time.\nBasically, what I'm trying to do is to set a object from a database list (.csv) and if i get an ValueError I would like to set that field value and keep adding data\n\nValueError: Field 'age' expected a number but got 'M'\n\nI'm quite sure that's a doc for this, but I've been reading for some time and hasn't found.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":45,"Q_Id":66191418,"Users Score":1,"Answer":"How about filtering the data once you receive it? For example lets say age field expects an Integer, and before you save it you could check if the data is an Integer. But I also think the most efficient way is using try except.","Q_Score":0,"Tags":"python,python-3.x,django,django-models,django-rest-framework","A_Id":66193705,"CreationDate":"2021-02-14T00:46:00.000","Title":"Django how to change a vallue of a field that received error","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Thanks for your time.\nBasically, what I'm trying to do is to set a object from a database list (.csv) and if i get an ValueError I would like to set that field value and keep adding data\n\nValueError: Field 'age' expected a number but got 'M'\n\nI'm quite sure that's a doc for this, but I've been reading for some time and hasn't found.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":45,"Q_Id":66191418,"Users Score":0,"Answer":"Using a simple 'try', 'except' block should work where you have a default value to use in 'except' before saving.","Q_Score":0,"Tags":"python,python-3.x,django,django-models,django-rest-framework","A_Id":66191475,"CreationDate":"2021-02-14T00:46:00.000","Title":"Django how to change a vallue of a field that received error","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"How to import postgresql database (.sql) file from AmazonS3 to AWS RDS?\nI am very new to AWS, and Postgresql.\nI have created a database using PgAdmin4 and added my data to the database.\nI have created a backup file of my database i.e. .SQL file.\nI have created a database instance on AWS RDS.\nI have uploaded my database file and several documents s3 bucket.\nI tried to integrate AWS S3 and RDS database using AWS Glue, but nothing is working for me. I am not able to figure out how to integrate S3 and RDS for importing and exporting datafrom S3 to RDS and vice versa.\nCan you please tell me how can I set up RDS and S3?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":510,"Q_Id":66192696,"Users Score":0,"Answer":"What you can do is install a pure python library to interact with rds and run the commands via that library just like you would do with any normal python program. It is possible for you to add libraries like this to run in your glue job. In your case pg8000 would work like a charm","Q_Score":0,"Tags":"python-3.x,postgresql,amazon-s3,amazon-rds,aws-glue","A_Id":66200464,"CreationDate":"2021-02-14T05:24:00.000","Title":"How to import postgresql database (.sql) file from AmazonS3 to AWS RDS?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am solving a stochastic differential equation and I have a function that contains an algorithm to solve it. So I have to call that function at each time step (it is similar to Runge Kutta's method but with a random variable), then I have to solve the equation many times (since the solution is random) to be able to make averages with all the solutions . That is why I want to know how to call this function in each iteration in the most efficient way possible.","AnswerCount":4,"Available Count":2,"Score":0.049958375,"is_accepted":false,"ViewCount":647,"Q_Id":66196167,"Users Score":1,"Answer":"The best way to implement a function on an iterable is to use the map function.\nSince map is written in C and is highly optimized, its internal implied loop can be more efficient than a regular Python for loop.","Q_Score":2,"Tags":"python,performance,function,loops,call","A_Id":66196437,"CreationDate":"2021-02-14T14:03:00.000","Title":"How can I efficiently call a function in a loop with python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am solving a stochastic differential equation and I have a function that contains an algorithm to solve it. So I have to call that function at each time step (it is similar to Runge Kutta's method but with a random variable), then I have to solve the equation many times (since the solution is random) to be able to make averages with all the solutions . That is why I want to know how to call this function in each iteration in the most efficient way possible.","AnswerCount":4,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":647,"Q_Id":66196167,"Users Score":3,"Answer":"Some ways to optimize function calls:\n\nif the function arguments and results are always the same, move the function call out of the loop\nif some function arguments are repeated and the results for a given set of arguments are the same, use memoize or lru_cache\n\nHowever, since you say that your application is a variation on Runge-Kutta, then neither of these is likely to work; you are going to have varying values of t and the modeled state vector, so you must call the function within the loop, and the values are constantly changing.\nIf your algorithm is slow, then it won't matter how efficient you make the function calls. Look at optimizing the function to make it run faster (or convert to Cython) - the actual call itself is not the bottleneck.\nEDIT: I see that you are running this multiple times, to determine a range of values given the stochastic nature of this simulation. In that case, you should use multiprocessing to run multiple simulations on separate CPU cores - this will speed things up some.","Q_Score":2,"Tags":"python,performance,function,loops,call","A_Id":66198269,"CreationDate":"2021-02-14T14:03:00.000","Title":"How can I efficiently call a function in a loop with python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I would like to send DirectInput keys to an inactive window without interfering with my actual mouse. I tried using PostMessage, SendInput and SendMessage but pywin32 uses virtual keycodes while ctypes does work with DirectInput. I have no idea how I can make it send in an inactive window.","AnswerCount":1,"Available Count":1,"Score":-0.1973753202,"is_accepted":false,"ViewCount":552,"Q_Id":66222584,"Users Score":-1,"Answer":"Try using this, it manages to work for me send the keystrokes to the inactive window,\nUse (but add error checking) hwndMain = win32gui.FindWindow(\"notepad\", \"\u200bprueba.txt: log keys\") hwndEdit = win32gui.FindWindowEx","Q_Score":3,"Tags":"python,ctypes,pywin32","A_Id":66222675,"CreationDate":"2021-02-16T10:24:00.000","Title":"How to send DirectInput keys to an inactive window in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using the ResNet18 pre-trained model which will be used for a simple binary image classification task. However, all the tutorials including PyTorch itself use nn.Linear(num_of_features, classes) for the final fully connected layer. What I fail to understand is where is the activation function for that module? Also what if I want to use sigmoid\/softmax how do I go about that?\nThanks for your help in advance, I am kinda new to Pytorch","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":854,"Q_Id":66222699,"Users Score":3,"Answer":"No you do not use activation in the last layer if your loss function is CrossEntropyLoss because pytorch CrossEntropyLoss loss combines nn.LogSoftmax() and nn.NLLLoss() in one single class.\nThey do they do that ?\nYou actually need logits (output of sigmoid) for loss calculation so it is a correct design to not have it as part of forward pass. More over for predictions you don't need logits because argmax(linear(x)) == argmax(softmax(linear(x)) i.e softmax does not change the ordering but only change the magnitudes (squashing function which converts arbitrary value into [0,1] range, but preserves the partial ordering]\nIf you want to use activation functions to add some sort of non-linearity you normally do that by using a multi-layer NN and having the activation functions in the last but other layers.\nFinally, if you are using other loss function like NLLLoss, PoissonNLLLoss, BCELoss then you have to calculates sigmoid yourself. Again on the same note if you are using BCEWithLogitsLoss you don't need to calculate sigmoid again because this loss combines a Sigmoid layer and the BCELoss in one single class.\ncheck the pytorch docs to see how to use the loss.","Q_Score":1,"Tags":"python,pytorch,resnet","A_Id":66222964,"CreationDate":"2021-02-16T10:32:00.000","Title":"ResNet family classification layer activation function","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Newbie here... 2 days into learning this.\nIn a learning management system, there is an element (a plus mark icon) to click which adds a form field upon each click.\u00a0 The goal is to click the icon, which generates a new field, and then put text into the new field.\u00a0 This field does NOT exist when the page loads... it's added dynamically based on the clicking of the icon.\nWhen I try to use \"driver.find_element_by_*\" (have tried ID, Name and xpath), I get an error that it can't be found. I'm assuming it's because it wasn't there when the page loaded. Any way to resolve this?\nBy the way, I've been successful in scripting the login process and navigating through the site to get to this point. So, I have actually learned how to find other elements that are static.\nLet me know if I need to provide more info or a better description.\nThanks,\nBill","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":45,"Q_Id":66250310,"Users Score":0,"Answer":"Apparently I needed to have patience and let something catch up...\nI added:\nimport time\nand then:\ntime.sleep(3)\nafter the click on the icon to add the field. It's working!","Q_Score":0,"Tags":"python,selenium,selenium-chromedriver","A_Id":66250513,"CreationDate":"2021-02-17T21:38:00.000","Title":"Selenium\/Python - Finding Dynamically Created Fields","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I create a Todo web application in Django and i deploy it on Heroku. I want to know how can i push the notification in my browser for upcoming task.Thanks in advance.","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":823,"Q_Id":66259563,"Users Score":2,"Answer":"You should use websockets and async functionality of Django to be able to push realtime notifications as they occur.\nBasic http protocol does not give you such functionality.","Q_Score":1,"Tags":"python,django,heroku","A_Id":66259742,"CreationDate":"2021-02-18T12:02:00.000","Title":"How to push the notification on web browser using django","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"In my template, I want to show the join date of a user, so I am using {{ user.date_joined }} which shows the date and time (in local time zone - same as what is shown in the admin panel). To just show the date, I use {{ user.date_joined.date }}, but it seems to be converting the date and time to UTC before showing the date (I am in EST\/EDT - I never remember which is which).\nFor example:\n{{ user.date_joined }} ==> Feb. 18, 2021, 7 p.m.\n{{ user.date_joined.date }} ==> Feb. 19, 2021\nIs there a way for me to change this so that it shows the same date as the full date and time?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":153,"Q_Id":66272633,"Users Score":1,"Answer":"Found a solution\/workaround for anyone else with a similar question.\nInstead of using {{ user.date_joined.date }} like a traditional datetime object, I used {{ user.date_joined|date }}","Q_Score":0,"Tags":"python,python-3.x,django,django-templates","A_Id":66272941,"CreationDate":"2021-02-19T06:19:00.000","Title":"Django User.date_joined.date using UTC time?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I just tried to install package WoE using pip which works fine. Then in Jupyter Notebook when I try to run the command:\nfrom WoE import WoE\nI receive an error that there is no module named \"WoE\"\nI keep trying to figure out how to use sys.path.append to make this module work but I cannot figure it out. Any help or advice would be appreciated!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":44,"Q_Id":66281276,"Users Score":0,"Answer":"Try running command prompt as admin and then doing the command py -m pip install WoE. If that still doesn't work try restarting your computer, it could just be an issue with Jupyter not seeing the module yet. You can also do py -m pip show WoE and if that gives you a file location then that means it did install correctly.","Q_Score":0,"Tags":"python,jupyter-notebook,sys.path","A_Id":66282893,"CreationDate":"2021-02-19T16:21:00.000","Title":"Solving ModuleNotFoundError: Importing the module WoE and manipulating sys.path.append to allow my notebook to identify the new module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"i got this message when i wanted run a beysian personalized ranking by GPU in colab, How can i resolve this problem ?\nmessage is :\nGPU training requires factor size to be a multiple of 32 - 1. Increasing factors from 100 to 127.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":337,"Q_Id":66284758,"Users Score":0,"Answer":"It could be that google colab is running out of ram\nwhy?\nbecause we are loading all data at once.or generating all data at once.\nexample :\ngoogle colab having 12 GB of ram. and it running out of ram.\nSo what i would suggest is:\nwe can process that data in chunks. if the total size of the data is 12 GB. than we can divide it into chunk(file) of 1 Gb.\n12 GB data = 12 chunks(files) of 1 Gb\nso now we have to load only 1 GB file into ram. which won't crash our notebook.","Q_Score":0,"Tags":"python,google-colaboratory","A_Id":66284829,"CreationDate":"2021-02-19T20:44:00.000","Title":"my colab notebook crash, how can i resolve it?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"i got this message when i wanted run a beysian personalized ranking by GPU in colab, How can i resolve this problem ?\nmessage is :\nGPU training requires factor size to be a multiple of 32 - 1. Increasing factors from 100 to 127.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":337,"Q_Id":66284758,"Users Score":0,"Answer":"On Colab a multitude of things could lead to crash. It's likely that you ran out of RAM or out of GPU memory.","Q_Score":0,"Tags":"python,google-colaboratory","A_Id":66284848,"CreationDate":"2021-02-19T20:44:00.000","Title":"my colab notebook crash, how can i resolve it?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am relatively new to oop and had a quick question about the best way to approach coding a certain type of calculation. I'm curious if there's an established design pattern to approach this sort of problem.\nConsider a chemical process flow where you convert materials (a,b) with attributes such as temperature, pressure, flow rate, etc. into a final product c. To get there, I need unit operations D,E,F... each with its own set of attributes (cost, size, etc.). I would only need information flow in one direction as closed loops will probably increase the complexity (if not, I would really appreciate insight into how closed loops would work).\na,b --> D --> E --> F --> c\nUltimately I would like to be able to do a system cost analysis, where I would sum up the cost attributes of D,E,F.\nMy current thought process to approach this is to define a \"materials\" object, then have D inherit materials, E inherit D... c inherit F then lastly a \"system\" object inherit c to analyze the system variables. Since I would like to be able to swap out D,E,F for say G,H,I, there also needs to be code for conditional inheritance where D must be able to accept inputs a,b (based on defined attributes) and E be able to inherit D for the same reason. One of the things I'm unsure of is how object c would be able to understand how to sum up attributes of all the inherited objects (probably based on some consistent naming convention of objects\/attributes?).\nSorry for the somewhat lengthy question - if you are aware of AspenPlus, I'm looking to replicate a smaller scale version of this (ie no solvers) in Python. Thank you for reading through this!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":71,"Q_Id":66287297,"Users Score":0,"Answer":"I would argue that in your case functional programming is actually more suited than OOP since what it boils down to is a set of operations process on \"blank\" materials that results in a new material, well actually the same with different properties.\nIf I was restrained to OOP I would create different classes :\n\nMaterialType which is basically a string or enum (of a, b & c)\nExternalProperties for temperature\/pressure, etc.\nMaterial which contains the Material_Type and various properties\/functions aimed at transforming the material type so for instance it could contain a transform function with an unbounded list of ExternalProperties\nLaboratory to do all the operations\n\nHere object c would be the MaterialType which the Material can calculate without inheriting of everything else.\nIt's hard to propose an accurate concretisation since your example is very abstract but I think inheritance brings more problems than solutions here.","Q_Score":1,"Tags":"python,oop,design-patterns","A_Id":66299410,"CreationDate":"2021-02-20T02:07:00.000","Title":"Python OOP Design Pattern for Calculation Flows","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Suppose I have a list of 100 numbers. I can find the mean by summing and dividing by the number of elements. But how can I find two values, one that gravitates towards the left of the list (assuming the list is ordered) and one towards the right, so that the list is equally divided into three blocks?\nSorting the array and taking the 33th and the 66th elements doesn't work because I could have all 1's before the 33th position and bigger values after, so the 33th position would be too early in the array. Those two 'means' depend on the values of the array and not solely on the indices.\nI'm sure what I'm trying to do has a proper naming but I can't really remember it now.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":77,"Q_Id":66290266,"Users Score":0,"Answer":"You could try numpy.quantile for example np.quantile(your_list, [0.33, 0.66]) I think should do the trick","Q_Score":0,"Tags":"python,arrays,list,numpy,mean","A_Id":66290439,"CreationDate":"2021-02-20T10:01:00.000","Title":"How to find multiple equally distributed means of a numpy array?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"For example: I want to know wether 5 and 500 have a 1:100 ratio, I also want to know how I can see if they roughly have the same ratio or not, how do I do this??","AnswerCount":4,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":406,"Q_Id":66293480,"Users Score":1,"Answer":"If you need to know whether a\/b and c\/d are roughly the same ratio, then (in Python 3 only) you can do math.abs(a\/b - c\/d) < margin. The smaller the positive number margin is, the more close the ratios have to be for the expression to return True. margin = 1\/100 would be within a percentage point.","Q_Score":1,"Tags":"python,python-3.x","A_Id":66293671,"CreationDate":"2021-02-20T15:45:00.000","Title":"How do I check if 2 numbers are equal to a specific ratio in Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"i need to create random numbers in python, i have been using the random library, but is this library really random or is it just pseudo random? and if it is pseudo random how can I get real random numbers in python?","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":58,"Q_Id":66298189,"Users Score":3,"Answer":"All computer generated random numbers are pseudo-random. If you want a more \"randomized\" version, you can use the secrets module instead of the random module.","Q_Score":0,"Tags":"python,random","A_Id":66298209,"CreationDate":"2021-02-21T01:11:00.000","Title":"Real random python numbers","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm having a hard time connecting my facial recognition system (realtime) to the database.\nI am using python language here. Try to imagine, when the system is doing REAL-TIME face detection and recognition, it will certainly form frame by frame during the process (looping logic), and I want if that face is recognized then the system will write 'known face' in the database. But this is the problem, because what if the upload to the database is done repeatedly because the same frame is continuously formed?\nthe question is, how do you make the system only upload 1 data to the database and if the other frames have the same image, the system doesn't need to upload data to the database?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":97,"Q_Id":66298575,"Users Score":0,"Answer":"you dont show any code, but to do what you're asking you want to have a flag that detects when a face is found and sets the variable. Then clear the variable once the flag leaves the frame. to account for false positives you can wait 4-5 frames before clear the flags and see if the face is still in the frame (i.e someone turns their head and the tracking looses the face)","Q_Score":0,"Tags":"python,face-recognition,yolo","A_Id":66298603,"CreationDate":"2021-02-21T02:28:00.000","Title":"Connect face recognition model to database efficiently","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using django-email-verification for sending verification link to email of the user but it tales time to send email , i want to send mail with celery for the same to speed it up , please guide me how can i add celery configs?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":127,"Q_Id":66306295,"Users Score":0,"Answer":"Celery isn't going to make this run any faster. What Celery will do for you is make the task asynchronous.","Q_Score":0,"Tags":"python,django,email,celery,email-verification","A_Id":66306824,"CreationDate":"2021-02-21T19:35:00.000","Title":"send email verfication link using django-email-verification with celery","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"In python, after I set some filter with warnings.filterwarning (or some package I import does), how can I access the list of active filters? I tried sys.warnoptions but it always gives me an empty list.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":34,"Q_Id":66316703,"Users Score":1,"Answer":"I found it looking at the source code. It's warnings.filters.","Q_Score":2,"Tags":"python,warnings","A_Id":66316874,"CreationDate":"2021-02-22T13:32:00.000","Title":"How to access active warning filters list?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"do I convert it a txt file? how do I inject the new line in between the other lines? I'm trying to inject a wallet address to a simple mining batch file without needing to physically open it prior.\npretty much the last step to automating my mining rigs for full self sufficiency.\nif anyone has any way of doing this, please describe in full detail or show an example, as I am self taught and in way over my head for a project that's exceeding expectations before release lol","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":49,"Q_Id":66362462,"Users Score":0,"Answer":"I would read in the entire file with f.readlines() so you get a list of strings (where each string represents a line in the file), write some logic that determines where the new string should go in between, and then re-write that to a file after.","Q_Score":1,"Tags":"python,html,batch-file,helper","A_Id":66363316,"CreationDate":"2021-02-25T04:35:00.000","Title":"how to inject code with a batch into a batch that has existing code","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I made an API for my AI model but I would like to not have any down time when I update the model. I search a way to load in background and once it's loaded I switch the old model with the new. I tried passing values between sub process but doesn't work well. Do you have any idea how can I do that ?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":44,"Q_Id":66370017,"Users Score":0,"Answer":"You can place the serialized model in a raw storage, like an S3 bucket if you're on AWS. In S3's case, you can use bucket versioning which might prove helpful. Then setup some sort of trigger. You can definitely get creative here, and I've thought about this a lot. In practice, the best options I've tried are:\n\nSet up an endpoint that when called will go open the new model at whatever location you store it at. Set up a webhook on the storage\/S3 bucket that will send a quick automated call to the given endpoint and auto-load that new item\nSame thing as #1, but instead you just manually load it. In both cases you'll really want some security on that endpoint or anyone that finds your site can just absolutely abuse your stack.\nSet a timer at startup that calls a given function nightly, internally running within the application itself. The function is invoked and then goes and reloads.\n\nCould be other ideas I'm not smart enough (yet!) to use, just trying to start some dialogue.","Q_Score":0,"Tags":"python,fastapi","A_Id":66394917,"CreationDate":"2021-02-25T14:02:00.000","Title":"Load new model in background","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I was able to convert a .py file to and exe file,\nhowever when I try to send it via Gmail, it detects as a virus.\nAlso, when trying to transfer the file on a USB flash drive, the computer says it's a virus.\nAny ideas on how to fix this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":118,"Q_Id":66370571,"Users Score":0,"Answer":"Apart from getting your exe signed (not really a viable option unless you're working on a big and important project) or writing the program in a natively compiled programming language like C, no, there is no way to avoid the detection since the Py2Exe converter you're using embeds the Python interpreter and all needed dependencies into the binary, which is a technique often used by viruses.\nEDIT FOR:\nI didn't actually get the fact that Gmail is the thing blocking the exe, not your AV. Well, as said by other comments, Gmail blocks certain files by default. Try adding the exe to a zip or rar archive and send that instead of the plain .exe.","Q_Score":0,"Tags":"python,exe,converters,antivirus,virus","A_Id":66370775,"CreationDate":"2021-02-25T14:34:00.000","Title":"Created an EXE file from .py and it's detected as virus","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I was recently trying to solve a data science test. Part of the test was to get the number of observations in a dataset for which the variable X is less than the 4th 5-quantile of this variable X.\nI don't realy understand what they meant by the 4th 5-quantile! I tried using pandas df.quantile function but I wasn't able to figure out how to use it in my case","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1216,"Q_Id":66372010,"Users Score":0,"Answer":"4th 5-quantile translates value = data.quantile(4\/5)","Q_Score":0,"Tags":"python,pandas,dataframe,statistics,data-science","A_Id":66394110,"CreationDate":"2021-02-25T16:00:00.000","Title":"Is there a pandas method to find the 4th 5-quantile of a dataset?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have two applications that access the same DB. One application inserts data into a table. The other sits in a loop and waits for the data to be available. If I add a new connection and close the connection before I run the SELECT query I find the data in the table without issues. I am trying to reduce the number of connections. I tried to leave the connection open then just loop through and send the query. When I do this, I do not get any of the updated data that was inserted into the table since the original connection was made. I get I can just re-connect and close, but this is a lot of overhead if I am connecting and closing every second or 2. Any ideas how to get data that was added to a DB from an external source with a SELECT query without having to connect and close every time in a loop?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":40,"Q_Id":66372325,"Users Score":0,"Answer":"Do you commit your insert?\nnormally the best way is you close your connection, and it is not generating very overhead if you open a connection for the select query.","Q_Score":0,"Tags":"python,mysql,sql,pymysql","A_Id":66372679,"CreationDate":"2021-02-25T16:17:00.000","Title":"pymysql SELECT * only detecting changes made externally after instantiating a new connection","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Let's say I have two complex images Z_1 and Z_2. I want to make a relative-phase map of the second image with respect to the first. This means:\nZ_2_relative = Z_2 * np.exp(-1j * np.angle(Z_1))\nThis creates a new complex valued matrix where the complex-phase should now be given by\nnp.angle(Z_2_relative) == np.angle(Z_2) - np.angle(Z_1)\nBut according to python these two are not equal. I bet it has something to do with the np.angle function.. but I cant pinpoint it, or know how to fix it...\nPS: Sorry, cant make a reproducible piece of code atm. Can do it later today","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":18,"Q_Id":66386086,"Users Score":0,"Answer":"Bah.. stupid question. Sorry for anyone that read it. If you do module 2pi, then everything is the same","Q_Score":0,"Tags":"python","A_Id":66386806,"CreationDate":"2021-02-26T12:47:00.000","Title":"Subtracting angles of complex valued matrix","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm attempting to thread a function call in my Python catastr^H^H^H^H^H^Hreation, and I've read up on how to use the threading.Thread() call. My function takes a simple string argument, so theoretically it should be as easy as:\nthread = threading.Thread(target = my_func, args = (string_var, ))\nbearing in mind that the args() needs to be a tuple. Got it. However, it appears as though I'm still doing something wrong because I continually get the barffage from Python:\nTypeError: my_func() takes 1 positional argument but 2 were given\nI'm a bit stumped here. Any guidance?\nThanks!","AnswerCount":3,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":55,"Q_Id":66389451,"Users Score":0,"Answer":"Seems the issue is that because it's a method (thanks gribvirus74 for the idea) and I'm attempting to thread it, it won't inherit the self. And that appears to be the issue. I moved the function outside of the class and called it with the Thread(). Works fine now.","Q_Score":0,"Tags":"python,multithreading,tuples","A_Id":66389727,"CreationDate":"2021-02-26T16:27:00.000","Title":"Python Thread() - Function Arg Tuple Not Working?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm sorry for the title of my question if it doesn't let clear my problem.\nI'm trying to get information from an image of a document using tesseract, but it doesn't work well on pictures (on print screens of text it works very well). I want to ask if somebody know a technique that can help me. I think that letting the image black and white, where the information I want is in black would help a lot, but I don't know how to do that.\nI will be glad if somebody knows how to help me. (:","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":74,"Q_Id":66403978,"Users Score":0,"Answer":"Using opencv might help to preprocess the image before passing it to tesseract.\nI usually follow these steps\n\nConvert the image to grayscale\nIf the texts in the image are small, resize the image using cv2.resize()\nBlur the image (GaussianBlur or MedianBlur)\nApply threshhold to make the text prominent (cv2.threshold)\nUse tesseract config to instruct tesseract to look for specific characters.\nFor example If the image contains only alphanumeric upper case english text then passing\nconfig='-c tessedit_char_whitelist=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\" would help.","Q_Score":1,"Tags":"python,image,image-processing,tesseract,python-tesseract","A_Id":66404196,"CreationDate":"2021-02-27T22:20:00.000","Title":"How to get information from an image of a document, like name, CPF, RG, on python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"In VS Code, many extensions, such as Tab Nine and Lint, rely on specific Python packages to function. On the other hand, the code I develop may need a different set of packages. Because there is the potential for package conflict and because we want the environment that we develop code to mimic the production environment, it is convenient to have the dev environment\/extensions use one Anaconda Environment and the code I develop to use a different Anaconda Environment. But I am not sure how to configure this. Can someone help?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":27,"Q_Id":66414367,"Users Score":0,"Answer":"Down in the bottom left corner of VS code you can manually select the python environment depending on which codebase you are working with. The selection can be saved in the settings.json file so you don't have to manually reselect each time.","Q_Score":0,"Tags":"python,visual-studio-code,anaconda,vscode-settings","A_Id":66414999,"CreationDate":"2021-02-28T22:12:00.000","Title":"VSCode and Anaconda Environments: How to have dev extensions\/environment and my code under development use different Anaconda environments","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"So I am trying to build a login dialog for my application using qt\/python.\nI got confused by QT's view\/model architecture. QT provides models and view for tables, lists etc., but how do I go about implementing a login dialog using this architecture?\nI use a ui file that I created with QtDesigner.\nShould I create a user model that interfaces with the DB and retrieves user data, handling the login process, and return this result to the view? (view and controller combined, as per QT's terminology)\nI would like to use the same architecture throughout the application, but I got confused with this one. Do I even need a model for this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":24,"Q_Id":66425819,"Users Score":0,"Answer":"Models are for binding data to view. You can create list model with user\/password fields and use QWidgetMapper to bind it to two QLineEdits but there's no much use in it since there's no much data and no complicated interactions.","Q_Score":0,"Tags":"python,pyqt","A_Id":66425984,"CreationDate":"2021-03-01T16:23:00.000","Title":"QT View\/Model Login dialog","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"So im trying to simply just trying to make a directory with kivy and i simply cant get it to work. I a useing the os.mkdir() function.\nI have tried to just simply os.mkdir(\"a\"), but i couldnt find any directory named a (after doing a full phone search, with the phone plugged in to my pc).\nI have alos tried os.getcwd() as in os.mkdir(os.getcwd()+\"a\"), but to no avail.\nTo put it simply i am lost, can't find anything about it online either... So if you know how i would greatly appreciate to be enlightend on the subject, thx in advance.\nAnd i am importing os, also tried to run os.mkdir before importing kivy.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":354,"Q_Id":66429880,"Users Score":0,"Answer":"I have tried to just simply io.mkdir(\"a\")\n\nThere is no io.mkdir - do you mean os.mkdir?\nThe directory will be created inside the current directory of the script, which is a folder inside the app's private directory as defined by Android.\nThat means you should see your new directory in e.g. os.listdir(\".\").","Q_Score":0,"Tags":"python,android,kivy,buildozer","A_Id":66430097,"CreationDate":"2021-03-01T21:24:00.000","Title":"How would one go about making a directory (mkdir) in python with kivy on android(buildozer)?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to deploy a flask app with http.server (ngnix not installed by admin). I want any user who logs into the cluster to access it. Is it possible?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":26,"Q_Id":66436982,"Users Score":1,"Answer":"HTTP server interfaces are visible to all users that are connected to a machine that has direct network access to the machine your server is running on.\nIf you need them to access the interface just provide the ip address and port where the server is running and the will be able to access it as users of the Flask app you are running. Just make sure you allow the users to access the needed resources.","Q_Score":0,"Tags":"python,linux,http,server","A_Id":66437057,"CreationDate":"2021-03-02T09:49:00.000","Title":"If I run an http server in my user account (linux cluster) how to enable other users to access it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"For establishing many-to-many relationships, django admin has a nice widget called 'filter_horizontal'.\nThe problem is - it only displays primary key of the related table.\nHow do I add other fields from the related table?\nFor example, if I have a many-to-many relationship in my Order model with User model, in 'Order' django admin I can only see User's primary key(id). How do I add their name into the widget?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":52,"Q_Id":66443136,"Users Score":0,"Answer":"Turns out it is changed in str method for the User model","Q_Score":0,"Tags":"python,django,admin","A_Id":66510005,"CreationDate":"2021-03-02T16:20:00.000","Title":"Django admin many-to-many - how to show additional fields?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Hey everyone I installed Python3.9 on my Mac using homebrew package manager but now I do not know how to install packages to it for use\nCan anyone please tell me, thanks !","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":642,"Q_Id":66444227,"Users Score":0,"Answer":"You should first do some research on the Python virtual environment, but the final answer to your question is to use pip install for installing Python packages. Be aware that there are other options out there, but pip is the most prevalent.","Q_Score":1,"Tags":"python,macos,homebrew","A_Id":66444366,"CreationDate":"2021-03-02T17:28:00.000","Title":"Installing packages in python installed using home-brew","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"i need to halign text in kivymd button to the left and i found solutions for default kivy like text_size: self.size and halign='left', is button still a label in kivymd like in kivy? If no then how do you align text inside it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":213,"Q_Id":66447022,"Users Score":0,"Answer":"Try the following:\ntext_align:'center'","Q_Score":0,"Tags":"python,kivy,kivymd","A_Id":67648878,"CreationDate":"2021-03-02T20:56:00.000","Title":"how do i align text in kivymd button?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using Windows subsystem for Linux WSL with the Ubuntu App (Ubuntu 20.04 LTS). I have installed Anaconda (Anaconda3-2020.11-Linux-x86_64) on my Windows 10 Education 1909. I have Jupyter notebook, and can run this in the Firefox on my computer and it seams to be working properly. However when I try to install packages such as:\nUbuntu console: pip install scrapy\nThen the Jupyter notebook can not find it.\nJupyter notebook: import scrapy\nI am currently working in the base environment, but I believe that Jupyter is actually running python from a different source (I also have Anaconda on my Windows).\nI confirmed this by running:\nimport sys and sys.version both in the WSL and in the Jupyter notebook.\nJupyter notebook returns: '3.6.6 |Anaconda, Inc.| (default, Oct 9 2018, 12:34:16) \\n[GCC 7.3.0]'\nWSL returns: '3.8.5 (default, Sep 4 2020, 07:30:14) \\n[GCC 7.3.0]'\nconfirming that the \"wrong python is used\".\nI am hesitant to delete my Windows Anaconda since I have my precious environments all set up there and are using them constantly.\nThe spessific package that forces me to linux can be found at \"http:\/\/www.nupack.org\/downloads\" but requires registration for downloads.\nI do not have Anaconda or python in my Windows environment variables.\nI would be happy If I either would know where to install my packages (as long as they are in Linux), or if someone knows how to force Jupyter to use the Anaconda from WSL.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":558,"Q_Id":66474736,"Users Score":0,"Answer":"Thanks to Panagiotis Kanavos I found out that I had both Anaconda3 and Miniconda3 installed and that the WSL command line used the miniconda3 version while Jupiter Notebook used Anaconda3.\nThere is probably a way of specifying which version to use but for me I simply deleted Miniconda and it now works.","Q_Score":1,"Tags":"python,jupyter-notebook,windows-subsystem-for-linux,anaconda3","A_Id":66489815,"CreationDate":"2021-03-04T12:09:00.000","Title":"Anaconda on Windows subsystem for Linux (WSL) uses the \"wrong\" anaconda when creating a Jupyther Notebook","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"An analytic task has been given to me to solve it by python and return back the result to the technical staff. I was asked to prepare the result in a jupyter notebook and such that the resulting code would be fully runnable and documented.\nHonestly, I just started using jupyter notebook and generally found it pretty useful and convenient in generating reports integrated with codes and figures. But I had to go into some level of difficulty when I wanted to use specific packages like graphviz and dtreeviz, which was beyond doing a simple pip install xxx.\nSo, how should I make sure that my code is runnable when I do not know what packages are available at the destination Jupyter notebook of the next guy who wants to run it or when they want to run it using a Jupiter Lab? especially regarding these particular packages!","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":31,"Q_Id":66483484,"Users Score":1,"Answer":"One solution for you problem would be to use docker to develop and deploy your project.\nYou can define all your dependencies, create your project and build a docker image with them. With this image, you can be sure that anyone who is using it, will have the same infrastructure like yours.\nIt shouldn't take you a lot of time to learn docker and it will help you in the future.","Q_Score":0,"Tags":"jupyter-notebook,ipython,graphviz,runnable,jupyter-lab","A_Id":66759240,"CreationDate":"2021-03-04T21:42:00.000","Title":"How to make sure my jupyter notebook is runnable on any other computer or on any jupyter Lab?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am creating an ERP web application using Django. How can i connect multiple apps inside of a project with one database. I am using the PostgreSQL database and also how can i centralized the database for all modules of ERP. How can i perform operations in other module and see if user is authenticated or not","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":220,"Q_Id":66504952,"Users Score":0,"Answer":"Your apps use only the database(s) set up in your settings.py file.","Q_Score":3,"Tags":"python-3.x,django,postgresql","A_Id":66511623,"CreationDate":"2021-03-06T11:01:00.000","Title":"Multiple applications inside a Django project","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am looking for a method to get information of a \"trend\" regarding some hashtag\/key word on Twitter. Let`s say I want to measure how often the hashtag\/key word \"Python\" is tweeted in time. For instance, today, \"Python\" is tweeted on average every 1 minute but yesterday it was tweeted on average every 2 minutes.\nI have tried various options but I am always bouncing off the twitter API limitations, i.e. if I try to download all tweets for a hashtag during the last (for example) day, only a certain franction of the tweets is downloaded (via tweepy.cursor).\nDo you have any ideas \/ script examples of achieving similar results? Libraries or guides to recommend? I did not find any help searching on the internet. Thank you.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":388,"Q_Id":66505663,"Users Score":0,"Answer":"Try a library called:\nGetOldTweets or GetOldTweets3\nTwitter Search, and by extension its API, are not meant to be an exhaustive source of tweets. The Twitter Streaming API places a limit of just one week on how far back tweets can be extracted from that match the input parameters. So in order to extract all historical tweets relevant to a set of search parameters for analysis, the Twitter Official API needs to be bypassed and custom libraries that mimic the Twitter Search Engine need to be used.","Q_Score":0,"Tags":"python,web-scraping,twitter,tweepy","A_Id":66505759,"CreationDate":"2021-03-06T12:33:00.000","Title":"Tweets scraping - how to measure tweeting intensity?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"I want to know how to get the most recent message sent in a channel of a discord server with discord webhooks in python? I have not tried anything yet.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":206,"Q_Id":66523058,"Users Score":0,"Answer":"Webhooks are only meant for sending messages, not reading messages in a channel. The only way to get the last message from the channel is if you have a bot user in the server that can read message history in that channel.","Q_Score":0,"Tags":"python,discord,discord.py,webhooks","A_Id":66523831,"CreationDate":"2021-03-08T00:48:00.000","Title":"How to use dhooks to find the most recent message sent in a channel","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am looking for a way to print out the raw http query string when I use the request library in python3. It's for troubleshooting purposes. Anyone has an idea how to do this. I tried to use prepared requests, but it is not what I'm looking for.Any suggestion?\nthanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":77,"Q_Id":66531827,"Users Score":0,"Answer":"import requests\nresponse = requests.get('https:\/\/api.github.com')\nYou can use:\nresponse.text or response.content or response.raw","Q_Score":0,"Tags":"http,python-requests","A_Id":67973369,"CreationDate":"2021-03-08T14:41:00.000","Title":"output raw query string with python requests library","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I wanted to import the albumentations package to run a deep learning task, but it has conflicts and failed when I tried to install it in the current environment, so I used conda create --name to create a new one, and in the new environment the albumentations package is installed successfully, but I can not find it in the python interpreter setting, and the project keeps showing \"No module named 'albumentations' \", so , how to fix this problem?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":18,"Q_Id":66533908,"Users Score":0,"Answer":"I just tried create a new Base environment in the Setting-->Python Interpreter--> add --> Virtualenv Environment , and in the new Base environment, the newly created interpreter will appear below the Existing environment option.","Q_Score":0,"Tags":"python,development-environment","A_Id":66537417,"CreationDate":"2021-03-08T16:53:00.000","Title":"how to add the newly created conda interpreter to a specific project","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a problem parsing DAG with error:\nBroken DAG: [\/usr\/local\/airflow\/dags\/test.py] No module named 'airflow.providers'\nI added apache-airflow-providers-databricks to requirements.txt, and see from the log that:\nSuccessfully installed apache-airflow-2.0.1 apache-airflow-providers-databricks-1.0.1 apache-airflow-providers-ftp-1.0.1 apache-airflow-providers-http-1.1.1 apache-airflow-providers-imap-1.0.1 apache-airflow-providers-sqlite-1.0.2 apispec-3.3.2 attrs-20.3.0 cattrs-1.3.0 clickclick-20.10.2 commonmark-0.9.1 connexion-2.7.0 flask-appbuilder-3.1.1 flask-caching-1.10.0 gunicorn-19.10.0 importlib-resources-1.5.0 inflection-0.5.1 isodate-0.6.0 marshmallow-3.10.0 marshmallow-oneofschema-2.1.0 openapi-schema-validator-0.1.4 openapi-spec-validator-0.3.0 pendulum-2.1.2 python-daemon-2.3.0 rich-9.2.0 sqlalchemy-jsonfield-1.0.0 swagger-ui-bundle-0.0.8 tenacity-6.2.0 termcolor-1.1.0 werkzeug-1.0.1\nBut the scheduler seems to be stuck:\nThe scheduler does not appear to be running. Last heartbeat was received 19 hours ago.\nHow can I restart it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":2000,"Q_Id":66561217,"Users Score":0,"Answer":"well after remove all deps in the requirements , the worker in mwaa run normally , now can try test the bad deps","Q_Score":3,"Tags":"python,airflow,scheduler,directed-acyclic-graphs,mwaa","A_Id":66655747,"CreationDate":"2021-03-10T08:45:00.000","Title":"AWS Managed Airflow - how to restart scheduler?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I am working on Google Colaboratory, and I have to implement OCL (Object Constraint Language), I searched a lot, but I didn't find how to implement it. Can someone give me an idea please?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":221,"Q_Id":66562115,"Users Score":0,"Answer":"It is surely possible for you to implement OCL, duplicating the efforts of one of the existing Open Source implementations such as Eclipse OCL or USE. There is an official OMG specification that will define what you need to do, however it has many deficiencies that will require research to solve and design around. I would be surprised if you can implement a 'full' implementation of OCL from scratch with plausible accuracy in less than a person year.\nI suspect that you have mis-stated what you want to do or have misunderstood what someone has instructed you to do.","Q_Score":0,"Tags":"python,google-colaboratory,ocl","A_Id":66567998,"CreationDate":"2021-03-10T09:46:00.000","Title":"How to implement OCL (Object Constraint Language) in Python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to know how I can send messages in discord, without creating a bot.\nLike I want the program to send messages through my own account. Most of the results I got when I searched this up is to create a bot. But I would like to know if there's a way to do it without creating the bot. Thanks :)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":90,"Q_Id":66577819,"Users Score":0,"Answer":"To access discord with a bot trough your own account, you can't use a discord bot. What you could do, is to automate \"your input\" in discord. Imagine a google sheet for example and now recording your input to copy the first line, delete it afterwards, then paste it in discord and send the message. now you could repeat this for every line in the file.\n(You can find such program using google)\nBUT this solution restricts you to your input. Any events discord provides like on_member_join for example aren't useable for this approach. It's more a user bot than a discord bot","Q_Score":0,"Tags":"python,python-3.x,list,discord,bots","A_Id":66578384,"CreationDate":"2021-03-11T07:02:00.000","Title":"How to send messages in discord without using bot application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"How do I download QtDesigner for PyQt6? If there's no QtDesigner for PyQt6, I can also use QtDesigner of PyQt5, but how do I convert this .ui file to .py file which uses PyQt6 library instead of PyQt5?","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3695,"Q_Id":66613380,"Users Score":2,"Answer":"You can install QtCreator or use command line pyuic6 -o main.py main.ui","Q_Score":0,"Tags":"python,pyqt5,qt-designer,pyqt6","A_Id":66614227,"CreationDate":"2021-03-13T12:13:00.000","Title":"Downloading QtDesigner for PyQt6 and converting .ui file to .py file with pyuic6","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"with tokenize I know you can split text into individual words, but I am confused on how to add characters to indicate the beginning and end of sentences after tokenizing. In my case I want to put ^ to indicate the beginning of the sentence and $ to indicate the end of the sentence. I am asking because I am trying to implement bigram probability models and this is for a school assignment, which is why this is a reinvent the wheel problem.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":41,"Q_Id":66619452,"Users Score":0,"Answer":"tokenize is a part of python distribution, and intended to parse python source code. Is this actually a good tool for your problem? Have you tried nltk?","Q_Score":0,"Tags":"python,tokenize","A_Id":66619616,"CreationDate":"2021-03-13T23:07:00.000","Title":"Is there a Python function to mark the beginning and end of sentences with a specific character after tokenizing?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm working on Flutter project in Android Studio platform and I faced a problem with how to write and run python API code inside my Flutter project without letting it as a backend code in another platform? since when I run my Flutter project that connected with python API code in another platform as a backend using post method, it's worked with the emulator but it does not work with my physical android device.\nSo is there any recommend solution for either the first problem or the second.\nThanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":59,"Q_Id":66627916,"Users Score":0,"Answer":"No it's not possible to write python code Inside Flutter code\nBut you can write your api in different framework like Django ,mongodb and use it in your Flutter app","Q_Score":0,"Tags":"python,android,api,flutter,backend","A_Id":66627972,"CreationDate":"2021-03-14T18:07:00.000","Title":"Is it possible to write python code inside Flutter using Android Studio?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am currently starting a kind of larger project in python and I am unsure about how to best structure it. Or to put it in different terms, how to build it in the most \"pythonic\" way. Let me try to explain the main functionality:\nIt is supposed to be a tool or toolset by which to extract data from different sources, at the moment mainly SQL-databases, in the future maybe also data from files stored on some network locations. It will probably consist of three main parts:\n\nA data model which will hold all the data extracted from files \/ SQL. This will be some combination of classes \/ instances thereof. No big deal here\n\nOne or more scripts, which will control everything (Should the data be displayed? Outputted in another file? Which data exactly needs to be fetched? etc) Also pretty straightforward\n\nAnd some module\/class (or multiple modules) which will handle the data extraction of data. This is where I struggle mainly\n\n\nSo for the actual questions:\n\nShould I place the classes of the data model and the \"extractor\" into one folder\/package and access them from outside the package via my \"control script\"? Or should I place everything together?\n\nHow should I build the \"extractor\"? I already tried three different approaches for a SqlReader module\/class: I tried making it just a simple module, not a class, but I didn't really find a clean way on how and where to initialize it. (Sql-connection needs to be set up) I tried making it a class and creating one instance, but then I need to pass around this instance into the different classes of the data model, because each needs to be able to extract data. And I tried making it a static class (defining\neverything as a@classmethod) but again, I didn't like setting it up and it also kind of felt wrong.\n\nShould the main script \"know\" about the extractor-module? Or should it just interact with the data model itself? If not, again the question, where, when and how to initialize the SqlReader\n\nAnd last but not least, how do I make sure, I close the SQL-connection whenever my script ends? Meaning, even if it ends through an error. I am using cx_oracle by the way\n\n\nI am happy about any hints \/ suggestions \/ answers etc. :)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":36,"Q_Id":66628729,"Users Score":0,"Answer":"For this project you will need the basic Data Science Toolkit: Pandas, Matplotlib, and maybe numpy. Also you will need SQLite3(built-in) or another SQL module to work with the databases.\nPandas: Used to extract, manipulate, analyze data.\nMatplotlib: Visualize data, make human readable graphs for further data analyzation.\nNumpy: Build fast, stable arrays of data that work much faster than python's lists.\nNow, this is just a guideline, you will need to dig deeper in their documentation, then use what you need in your project.\nHope that this is what you were looking for!\nCheers","Q_Score":1,"Tags":"python,python-3.x","A_Id":66628813,"CreationDate":"2021-03-14T19:32:00.000","Title":"How do I include a data-extraction module into my python project?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Created a Flash Restful API with various end points for my website. Some endpoints need the users username and password to get user specific data. I\u2019m currently sending these as parameters in the API call but I\u2019m assuming this isn\u2019t secure so how does one do this safely?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":71,"Q_Id":66639116,"Users Score":0,"Answer":"you can make a seperate api route that acts as a login and returns a sessionID\/token on a successful login that can be used for authenticating to those endpoints you mentioned.","Q_Score":0,"Tags":"python,api,flask-restful","A_Id":66639816,"CreationDate":"2021-03-15T13:40:00.000","Title":"How to safely send a user data in API call","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have created an instance on GCP to run some machine learning model for an app I am working on for a little project. I want to be able to call one of the methods in one of the files from my app and I thought a Cloud Function would be suitable.\nTo make this question simpler, let's just imagine I have a file in my instance called hello.py and a method in this file called foo(sentence). And foo(sentence) simply returns the sentence parameter.\nSo how do I call this method foo in python.py and capture the output?\nThanks","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":330,"Q_Id":66639983,"Users Score":2,"Answer":"At Google Cloud (And Google also), \"all is API\". Thus, if you need to access from a product to another one, you need to do this through API calls.\nIf your Cloud Functions needs to invoke a script hosted on a Compute Engine VM instance, you need to expose an API on this Compute Engine instance. A simple flask server is enough, and expose it only on the private IP is also enough. But you can't directly access from your Cloud Functions code to the Compute Engine instance code.\nYou can also deploy a Cloud Functions (or a Cloud Run if you need more system packages\/libraries) with the model loaded in it, and like this perform all the computation on the same product.","Q_Score":0,"Tags":"javascript,python,node.js,google-cloud-platform,google-cloud-functions","A_Id":66657007,"CreationDate":"2021-03-15T14:34:00.000","Title":"How to call function in GCP Instance from Cloud Function","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm looking to keep my mouse events in sync with my objects after resizing the screen.\nI'm told I need to create a data structure to keep track of:\n\nResizing events\n\nNew coordinates to match the resize\n\n\nHow can I accomplish this using simple algebraic equations and integrate it into a resize event for accurate updating?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":64,"Q_Id":66645103,"Users Score":1,"Answer":"Do it the other way around create a virtual game map, scale to the size of the window when drawing the scene and scale to the size of the virtual map when receiving an event.","Q_Score":2,"Tags":"python,python-3.x,pygame,pygame-surface,pygame2","A_Id":67031573,"CreationDate":"2021-03-15T20:19:00.000","Title":"In pygame how can i create a data struct that keeps track of resizing events and the coordinates of objects?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"After a click, a mini banner (or a container drawer) opens, which I should click on it, but I can't interact with it.\nI was trying the \"driver.switchTo\" command but since there is no Iframe, I don't know how to do it.\nthe body is this:\n Go <\/a>","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":93,"Q_Id":66645314,"Users Score":1,"Answer":"I've had issues with this in the past, and largely I couldn't figure out what to do either. If you can just leave your computer alone during the process you can always try to use pyautogui to kind of cheat your way through it.","Q_Score":1,"Tags":"python,selenium,switch-statement","A_Id":66645596,"CreationDate":"2021-03-15T20:36:00.000","Title":"Switch to panel - Python Selenium","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am working on a Python Turtle Snake Program, and I want to make my Turtle longer.\nBy that, I mean that I increase the 1 Cube to 2 Cubes, then 3, etcetera, for my Snake Game.\nCan you please inform how I could do that with turtle?\nThanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":36,"Q_Id":66647935,"Users Score":0,"Answer":"I once made a game like that. You can just create more turtles and use them as the body. Make the first turtle as the head of the snake. Then whenever it eats food,run a function that will create another turtle as a body component and put it in the previous position of head component. Repeat this everytime the snake eats a food.\nI am not so good in explaining,so sorry for any inconvenience : )","Q_Score":0,"Tags":"python-3.x,python-turtle","A_Id":69835659,"CreationDate":"2021-03-16T01:33:00.000","Title":"How to make a Turtle Longer","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am very new to python and pygame and I'm currently making a very basic experiment with it. So far, I know how to draw an image on the screen, move it around, add a background, stuff like that. But what I have always been wondering is, how do I switch between screens in a game and how do I keep the code tidy when doing so?\nEvery time I try to add a new thing to my already unstable code, it takes only a few lines to break it and it becomes a confusing mess.\nIf for example, I want a start screen that shows the title and a \"press any key to continue\" kinda thing, how do I do it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":86,"Q_Id":66653278,"Users Score":0,"Answer":"A quick fix:\n\nMake the entire screen white and then draw the second screen onto the first one.\nThen when you need the other screen, just refill the screen with black and then continue.\nThis can be achieved by putting the screens in their own separate functions.\n\nLet me know if this helps out","Q_Score":0,"Tags":"python,pygame","A_Id":66653375,"CreationDate":"2021-03-16T10:24:00.000","Title":"How to make multiple screens in pygame? (As in, a \"menu\" screen, a \"main\" screen, a \"start\" screen, etc.)","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have been playing around with django channels + angular. I have created an app that simply sends notifications to front end with a counter 1,2,3,4. It works fine, except if I open the page in multiple tabs. I am also not able to disconnect from the websocket, I can use unsubscribe but it does not really close the connection but that's more kind of a angular question. Anyways how can I make my socket multithread, So if I make multiple requests from the same computer but from different tabs it will work and 2 different instances of the consumer will be created therefore, If I load 2 pages in the same computer the counter should be different independently increasing counter. Do I need redis for that ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":465,"Q_Id":66662639,"Users Score":0,"Answer":"my url router was missing .as_asgi()\nthis worked:\nURLRouter([path('wscrawpredict', CrawPredictConsume.as_asgi(),name=\"wscraw\")])","Q_Score":0,"Tags":"python,django,angular,websocket,django-channels","A_Id":66829614,"CreationDate":"2021-03-16T20:08:00.000","Title":"multiple independent websockets connections","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"So the default of anaconda is python 3.8, but you can invoke python2 by running python2 a_py_script.py. The issue comes from the fact that you'll need to import things (say biopython), and you can't import them as any conda install -c conda-forge biopython or pip install biopython will be understood to automatically slot it into python3.8 packages exclusively.\nI ask this because I have some python2.7 scripts that demand packages outside the default install scope and ideally I'd like to do this without having to create a new python=2.7 env and track down everything I need.\nI've tried pip2.7 install biopython and python2.7 -m pip install biopython to no avail. Could it be that I technically don't have python 2.7 even though I'm able to invoke it from command line via python2 because python3 just naturally has some special limited backwards compatibility to run my python2 scripts? (I did notice that conda list includes only 3.8 and no mention of 2.7)\nI've tried cloning my env but I don't know how to do it in such a way that swapts just the version of python. conda create --name py27test --clone base python=2.7 says too many arguments. I'd like to know if this is even advisible as my base environment I would presume is entirely built off of v3.8 so swapping out the python versions will just be bad time hence why this seems impossible?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":493,"Q_Id":66670918,"Users Score":0,"Answer":"You can't mix Python versions in a conda environment. You can call Python executables from outside your environment, but that's unadvisable for anything requiring dependencies. If you must use Python 2.7 and need dependencies installed, that needs to be done in a contained environment, one that does not mix Python 3 packages into it.\nIf you care about using your Python 2.7 scripts long-term, you should consider migrating them now; using unsupported software is only going to get harder over time.","Q_Score":0,"Tags":"python,pip,anaconda,conda,biopython","A_Id":66676641,"CreationDate":"2021-03-17T10:08:00.000","Title":"How do I install python2.7 packages under anaconda with python3.8 already in place?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Hi so I have been working on a notebook the last few days and showed it to my advisor yesterday and we walked through it together. I tried to start working on the project this morning and cannot find the file that I was working on. What is strange is that the directory that I was working in says it was last modified yesterday but when I look through the directory the file I am looking for cannot be found. I know that you are probably thinking \"this ding deleted the file on accident\" and although I really dont know how that could have happened, that is one suspicion of mine, but when looking at https:\/\/stackoverflow.com\/questions\/38819322\/how-to-recover-deleted-ipython-notebooks they mention that it should go to trash for my version of jupyter notebook upon deletion.\nI am asking if there is any way to possibly get the file back? or anywhere I can look for the file? I have looked in my trash can but it is not there.\nMacOS Big Sur 11.2.3\nJupyter NoteBook 6.1.5\nConda Version: 4.9.2\nConda-build version: 3.20.5\nPython: 3.8.5.final.0","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":41,"Q_Id":66672653,"Users Score":0,"Answer":"I do not know why this was the case but here is:\nI could not find the file of interest. Did all methods from before in above link, once I looked in the icloud Desktop in my finder it suddenly appeared in the normal desktop directory. Idk why, but if this happens to you, check the icloud directory corresponding to the directory you are in and it may appear in the corresponding normal directory after. Lesson learned: do some version control.","Q_Score":0,"Tags":"python,macos,jupyter-notebook,anaconda,storage","A_Id":66673358,"CreationDate":"2021-03-17T11:59:00.000","Title":"Cannot find .ipynb in directory that says it was last modified recently but has no recently modified files","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm making a simple project where I will have a downloadable scraper on an HTML website. The scraper is made in Python and is converted to a .exe file for downloading purposes. Inside the python code, however, I included a Google app password to an email account, because the scraper sends an email and I need the server to login with an available Google account. Whilst .exe files are hard to get source code for, I've seen that there are ways to do so, and I'm wondering, how could I make it so that anyone who has downloaded the scraper.exe file cannot see the email login details that I will be using to send them an email when the scraper needs to? If possible, maybe even block them from accessing any of the .exe source code or bytecode altogether? I'm using the Python libraries bs4 and requests.\nAdditionally, this is off-topic, however, as it is my first time developing a downloadable file, even whilst converting the Python file to a .exe file, my antivirus picked it up as a suspicious file. This is like a 50 line web scraper and obviously doesn't have any malicious code within it. How can I make the code be less suspicious to antivirus programs?","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":91,"Q_Id":66672822,"Users Score":0,"Answer":"Firstly, why is it even sending them an email? Since they'll be running the .exe, it can pop up a window and offer to save the file. If an email must be sent, it can be from the user's gmail rather than yours.\n\nSecondly, using your gmail account in this way may be against the terms of service. You could get your account suspended, and it may technically be a felony in the US. Consult a lawyer if this is a concern.\n\nTo your question, there's basically no way to obfuscate the password that will be more than a mild annoyance to anyone with the least interest. At the end of the day, (a) the script runs under the control of the user, potentially in a VM or a container, potentially with network communications captured; and (b) at some point it has to decrypt and send the password. Decoding and following either the script, or the network communications that it makes will be relatively straightforward for anyone who wants to put in quite modest effort.","Q_Score":1,"Tags":"python,html,download,exe,source-code-protection","A_Id":66673330,"CreationDate":"2021-03-17T12:08:00.000","Title":"Python exe - how can I restrict viewing source and byte code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm making a simple project where I will have a downloadable scraper on an HTML website. The scraper is made in Python and is converted to a .exe file for downloading purposes. Inside the python code, however, I included a Google app password to an email account, because the scraper sends an email and I need the server to login with an available Google account. Whilst .exe files are hard to get source code for, I've seen that there are ways to do so, and I'm wondering, how could I make it so that anyone who has downloaded the scraper.exe file cannot see the email login details that I will be using to send them an email when the scraper needs to? If possible, maybe even block them from accessing any of the .exe source code or bytecode altogether? I'm using the Python libraries bs4 and requests.\nAdditionally, this is off-topic, however, as it is my first time developing a downloadable file, even whilst converting the Python file to a .exe file, my antivirus picked it up as a suspicious file. This is like a 50 line web scraper and obviously doesn't have any malicious code within it. How can I make the code be less suspicious to antivirus programs?","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":91,"Q_Id":66672822,"Users Score":1,"Answer":"Sadly even today,there is no perfect solution to this problem.\n\nThe ideal usecase is to provide this secret_password from web application,but in your case seems unlikelly since you are building a rather small desktop app.\nThe best and easiest way is to create a function providing this secret_password in a separate file,and compile this file with Cython,thing that will obcufate your script(and your secret_password) at a very good extend.Will this protect you from lets say Anonymous or a state security agency?No.Here comes the reasonable thinking about how secret and important really your password is and from who you mainly can be harmed.\nFinally before compiling you can 'salt' your script or further obscufate it with bcrypt or other libaries.\n\nAs for your second question antiviruses and specifically windows don't like programms running without installers and unsigned.\nYou can use inno setup to create a real life program installer.\nIf you want to deal with UAC or other issues related to unsigned programms you can sign your programm(will cost money).","Q_Score":1,"Tags":"python,html,download,exe,source-code-protection","A_Id":66673053,"CreationDate":"2021-03-17T12:08:00.000","Title":"Python exe - how can I restrict viewing source and byte code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"How do I modify a np array based on the current value and the index? When I just want to modify certain values, I use e.g. arr[arr>target_value]=0.5 but how do I only modify the values of arr > target_value where also the index is greater than a certain value?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":74,"Q_Id":66706687,"Users Score":0,"Answer":"For that very specific example you would just use indexing I believe\neg arr[100:][arr[100:] > target_value]=0.5\nin general it could be conceptually easier to do these two things separately. First figure out which indices you want, then check whether they satisfy whatever condition you want.","Q_Score":0,"Tags":"python,arrays,numpy","A_Id":66706708,"CreationDate":"2021-03-19T10:45:00.000","Title":"Modify values in numpy array based on index and value","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Previous version of code wrote fine with Python 2.7 to AWS MySQL Version 8 with the following:\n\n\n\"\"\"INSERT INTO test_data(test_instance_testid,\nmeas_time,\ndata_type_name,\nvalue,\ncorner_case,\nxmit,\nstring_value)\nVALUES('15063', '2021-03-19 20:36:00', 'DL_chamber_temp', '23.4',\n'None', 'None', 'None')\"\"\"\n\nBut now, porting to Python 3.7 to the same server I get this:\n\npymysql.err.InternalError: (1366, \"Incorrect integer value: 'None' for column 'xmit' at row 1\")\n\nThis makes sense since it is a str value 'None' and not Python type None (although it used to work).\nIt is legal to fill these columns as NULL values--that is their default in the test_data table.\nIf I change the code and set the values to Python None, I get a different error which I don't understand at all:\n\n\"\"\"INSERT INTO test_data(test_instance_testid,\nmeas_time,\ndata_type_name,\nvalue,\ncorner_case,\nxmit,\nstring_value)\nVALUES('15063', '2021-03-19 20:36:00', 'DL_chamber_temp', '23.4',\nNone, None, None)\"\"\"\n\n\npymysql.err.InternalError: (1054, \"Unknown column 'None' in 'field list'\")\n\nI really appreciate any help or suggestions.\nThanks, Mike\nThanks for the help! Yes, NULL does work, but I'm stuck on how to handle value types on the fly within my method. Depending on the call I need to write a quoted value in one case and non-quoted NULL on others. For some reason my old code (illogically!) worked. I've tried everything I can think of without any luck.\nAny thoughts on how to do this?","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":788,"Q_Id":66718431,"Users Score":0,"Answer":"make default value as NULL at PhpMyAdmin","Q_Score":0,"Tags":"python,mysql","A_Id":66739265,"CreationDate":"2021-03-20T05:09:00.000","Title":"MySQL Version 8 Python 3.7 Cannot write None value as NULL","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Does anyone have any good suggestions for where I can store my custom Python modules on Google Cloud Platform?\nI have a bunch of modules that I would like to access from the different GCP services I am using (App Engine, Compute Engine, Cloud Functions etc), without having to copy the Python files and upload to the service's Python environment each time.\nI was thinking GCS could be an option but then I am not sure how I would then get the module into, say Cloud Functions or App Engine?\nAny ideas?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":50,"Q_Id":66726060,"Users Score":1,"Answer":"The code will eventually need to be written to your service's local storage. Python does not access code remotely during execution unless you write your code to do so (download the module and then execute). Package your code as modules and publish to PyPI and then add them as dependencies. When you deploy a service, your modules will be downloaded.","Q_Score":1,"Tags":"python,google-cloud-platform","A_Id":66726192,"CreationDate":"2021-03-20T20:14:00.000","Title":"Where to store my custom Python modules on GCP so they can be accessed by different GCP services?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Can you help with a definitive answer for MAC and PC.\nI have come across similar questions to this quite a lot on stackoverflow where a user will be using an editor such as IDLE or ATOM and they will get the module not found error, then they will go to terminal or command line prompt and try to pip install the module, and it will either install the module or say requirement already satisfied.\nOn returning to the editor and running the script it will still give the module not found error.\nI have seen the same question, but often asked about for specific modules.\nThis error started happening a lot for me when I was required to install anaconda for a course and was required to use other editors, but had previously been using a download of Python and working with IDLE.\nI often go between a MAC and a PC, where I have got the same issue, where I have an instance of anaconda installed and another instance of python installed.\nIt is very confusing how to untangle the different paths where some have modules and other don't.\nCould someone give some advice on how to rectify this?\nI wonder if there is a solution where I could do a pip install that would globally update all versions of python with a module?","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":3151,"Q_Id":66728011,"Users Score":3,"Answer":"This could happen if you have multiple versions of Python installed on your computer. For example you have a package installed on Python 3.5 but you run your script on Python 3.8. On cmd or Powershell you could try something like py -3.8 -m pip list or py -3.5 -m pip list to check which libraries you have installed on each version of Python. Then if the library is missing from the version that you used on your script you can install it specifically for this version using something like py -3.5 -m pip install library_name.","Q_Score":1,"Tags":"python,python-3.x,module,pip,anaconda","A_Id":66728046,"CreationDate":"2021-03-21T01:20:00.000","Title":"module not found even after pip install","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"is it possible to call a web service from cooja? May be I can read from border-router then call web service (via python script for example). I can ping border-router but I dont know how to read from node or write to node in cooja.I am new to contiki-ng and cooja. thanks in advance","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":59,"Q_Id":66732962,"Users Score":0,"Answer":"You can try the websense example at the folder ~\/contiki\/examples\/ipv6\/sky-websense","Q_Score":0,"Tags":"python,web-services,serial-communication,cooja,contiki-ng","A_Id":67021154,"CreationDate":"2021-03-21T13:35:00.000","Title":"is it possible to call a web service from cooja?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"For all those who are not familiar with ren'py: It's basically python with some modifications. Since the project is coded in python, which can easily be edited by anyone it is not a good idea to include a license validation in the python files.\nAn executable starts the game, so I thought about wrapping it with a license validation in an .exe (but I honestly don't know how I can take an executable, put some code around and have one executable including the actual one). Maybe there is another way, which is safer than the one I named, suggestions?","AnswerCount":1,"Available Count":1,"Score":0.537049567,"is_accepted":false,"ViewCount":707,"Q_Id":66735373,"Users Score":3,"Answer":"You don't. Ren'Py only features basic encryption to prevent players from accidentally deleting\/modifying files.\nAs security, game encryption isn't a fight worth picking. You have to decrypt the files to run them and that will always be a weak point to exploit. Anything you put on top is just delaying whoever wants in. You can write your game in binary and it will do exactly squat to someone who really wants to take it apart.\nRen'Py is designed to be mod friendly. Nothing you do will stop someone from dropping a rpyc file into the game directory and hooking into the game. Even if you modify the engine to only read specific files, you won't stop someone who can just insert the functionality back in. All you're really doing is making it more difficult to preserve the game after you're dead.\nNintendo can't stop people from extracting assets from their games. You don't stand a chance. You should hope to be so lucky as to have people interested enough in your game to want to mess around with the assets and code.\nIf you're talking about a license players need or some sort of login mechanism, you need to implement an online server to validate the credentials they input. There is no secure front-end way to validate credentials.","Q_Score":0,"Tags":"python,renpy","A_Id":66770104,"CreationDate":"2021-03-21T17:24:00.000","Title":"How to protect my ren'py project from being copied?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I wanna install three packages in anaconda, but I face the following error.\n Error: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'c:\\\\programdata\\\\anaconda3\\\\lib\\\\site-packages\\\\numpy-1.20.1.dist-info\\\\METADATA'.\nI have changed HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem@LongPathsEnabled to 1, but it does not still work. There are some similar problems with pip and some solutions are provided but I could not apply them. Is there any difference between the pip\\\\METADA error and numpy\\\\METADATA error?\nI have basic knowledge and I would be thankful if someone can explain how to fix it with details. For example, some people suggested installing in another directory, but I do not know how to do this.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1096,"Q_Id":66751849,"Users Score":0,"Answer":"You could remove the folder of \"numpy-1.20.1.dist-info\" in error information firstly, and try install again.","Q_Score":2,"Tags":"python,numpy,anaconda,metadata","A_Id":69358873,"CreationDate":"2021-03-22T18:26:00.000","Title":"Could not install packages due to an EnvironmentError: [Errno 2] numpy-1.20.1.dist-infor \\\\METADATA","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"In my admin.py, I have a lot of ModelAdmin classes and I want them to all override a function, has_module_permission. I want to base the module permission off of the user's permissions for the model corresponding to the ModelAdmin, and to do that I need to know the model name in order to run request.user.has_perm('app.add_') or something similar.\nI think an easy way of doing this is to create a class that has this function which is somehow able to get the model name, and then have each of the ModelAdmin classes inherit from that. The problem is that I don't know how to access the model's name from ModelAdmin. What's the best way of doing this?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":127,"Q_Id":66753140,"Users Score":0,"Answer":"If you just need the the model's name from ModelAdmin you can simply do the following: self.model.__name__","Q_Score":0,"Tags":"python,django,django-admin","A_Id":66753498,"CreationDate":"2021-03-22T20:06:00.000","Title":"Django overriding ModelAdmin classes with a function requiring Model name","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm lost with Python. After troubleshooting with a friend through Discord for literally months I am about to give up. This is my last attempt at trying to get Python fixed on my Windows 10 laptop.\nI'm using a Lenovo Legion 5, bought the laptop in November 2020. I've not been able to get anything related to Python to run in the CMD window. I can run Python no problem, but nothing I have installed through pip has ever worked. I can use virtualenvs, but only through PyCharm for example. Python has never really worked through the command line.\nYes I tried reopening the CMD window, rebooted the system many times, ran the CMD as administrator, installed the path variables for both Python and esptool.py but nothing seems to help.\nI honestly don't know where to start because none of the 250+ websites I've visited to so far that suggested a fix for any kind of issue I've been experiencing with Python has been working. I can run Python fine by the way, just none of the things installed through pip will work.\nLet's start with a use-case:\nI'm trying to run esptool.py so installed it with pip install esptool. This install worked fine, and I can confirm it is installed with pip show -f esptool.\nHowever, when running esptool.py version it told me:\n'esptool.py' is not recognized as an internal or external command, operable program or batch file.\nSo I added the local folder from the previous step to the %PATH% variables, after running esptool.py version it gave me a popup asking me with what kind of program I should open this, I didn't select to open with this kind of program from now on. This makes it so that I do not get an error, what now happens is that another window quickly opens and then exits without an error code. So I have no clue what's happening.\nWhat should happen is that it should tell me which version is installed in the CMD window.\nThere have been a few other things going on with my Windows 10 install, for one, the username that I used during the installation wasn't used to create the user directory. Windows 10 somehow instead chose a name that was related to the first 5 characters of my email address, which is totally strange as I haven't used that string in the installation of Windows 10 at all. This was a fresh install on a new laptop.\nNow, after an update of Win10 my user icon doesn't display anymore and I had to change ownership of the 'Windows Apps' folder in order to be able to access it. Changing the ownership also changed the name I now see on the login screen when I boot up the laptop. It changed from the 5 first chars of my email address to my full name in the login screen, only because I took ownership of this folder so I could access it.\nThere have been a lot of things going on that I think should not be changing all the time, things to do with administrator rights, ownership, etc.\nNow, since opening esptool.py doesn't open it, but also doesn't show me an error, I'm clueless and the only thing I can think of is doing a fresh system install, but I have a bunch of projects going on for which I need this laptop in working order and I don't have the mental health (due to corona) left to do a fresh system install. I'm worn down. Not in a dramatic way, I just don't have the spare energy to go through the whole process. So I'm hoping someone can point me in the right way to troubleshoot why my Python doesn't want to work natively.\nWhat happens when running esptool.py version is that I can see it opens a Python window, but without showing any content it closes within a few milliseconds.\nWhat is going on, how do I continue? I hope someone knows how to troubleshoot my system, to find the core of the problem.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":377,"Q_Id":66772433,"Users Score":0,"Answer":"It apparently was rather simple. First of all, thanks for the replies! And second of all, thanks for pointing me to superuser.com I wasn't aware of the site and will continue there.\nThe fix was to use python -m pip install esptool as suggested by Valentin Kuhn.\nTo answer AKD, I have a lot of experience with programming on my MacBook, but I'm not experienced with actually maintaining the system side, I'm a creative user. It's just that ever since I got a Windows laptop it's been nothing but trouble and after months of chatting about each individual issue with people on Discord nobody has been able to find a solution. I'm not expecting a GUI, just a simple \"esptool.py v3.0\" was the answer I was expecting from the command line.\nNow what I don't understand is that I've never found any hint to anyone suggesting python -m. I will get on superuser to find out more about why the standard instructions that work for most people, don't work for me.\nSorry for using the wrong site for my question, I came on here through another related question and it was past my bedtime and I wasn't thinking clear.","Q_Score":0,"Tags":"python,python-3.x,windows,pip,windows-10","A_Id":66777723,"CreationDate":"2021-03-23T22:55:00.000","Title":"PIP installed items don't want to work in Windows 10","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I'm a student. For my Distributed Systems project, I'm expected to create a gRPC project. I'm creating the project in Eclipse.\nTwo service implementation are to be coded in Java and the other is to be done in another coding language.\nI've tried searching for help online but the results I'm getting are related to gRPC and how gRPC works, not about the coding or using other coding.\nIdeally, I would like to use Python as the other language and to create it in Eclipse if possible. Does anyone have any information, documentation or examples I could look at, so I could can reference it?\nI am able to see online searches for both Java and Python, but I'm not sure how to use both in one project.\nThank you.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":62,"Q_Id":66781091,"Users Score":0,"Answer":"So I got a lot of feedback for lecturers and classmates.\nThe server doesn't care what programming language is used.\nSo Java, Python, Node.js etc, could all be sent to the server.\nA generalised simplistic idea of how I was able to understand is: Python converts its code to binary and sends it to the server. Same with Java and Node.js.\nI don't know why, but I was digging myself deeper trying to figure out what code (i.e. the binary) that needed to be the communication between the server and code. I was trying to encapsulate Python into Java and vice versa.\nWhy did I think this? Your guess is as good as mine.","Q_Score":1,"Tags":"eclipse,grpc,grpc-java,grpc-python","A_Id":66873041,"CreationDate":"2021-03-24T12:30:00.000","Title":"gRPC - Using code other than Java to create a Service Implementation","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"I was trying to apply a deep learning algorithm(CNN) in python but after separating training-testing data and transforming time series to image step my Colab Notebook crashed and restarted itself again.\nIt gives an error like \"Your session crashed after using all RAM\" and when I checked app.log I saw something about tcmalloc: large alloc. I didn't find anything to fix this crashed.\nDo you have any idea how to prevent this warning and fixed this situation?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1324,"Q_Id":66787279,"Users Score":3,"Answer":"Your session ran out of all available RAM. You can purchase Colab Pro to get extra RAM or you can use a Higher RAM machine and use the Neural Network there","Q_Score":5,"Tags":"python,tensorflow,memory-management,google-colaboratory,tcmalloc","A_Id":66789185,"CreationDate":"2021-03-24T18:35:00.000","Title":"tcmalloc: large alloc python in Google Colab","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I'm contributing to a project that is using sqlalchemy. This project has a model.py file where they define all their classes, for example Foobar(BASE). Now, I've created another module mymodel.py where I need to extend some of those classes. So for example, in mymodule.py I have Foobar(model.Foobar) which I use to extend the parent class with new properties and functions. The problem is that when using either of those classes, I get this error from sqlalchemy: sqlalchemy.exc.InvalidRequestError: Multiple classes found for path \"Foobar\" in the registry of this declarative base. Please use a fully module-qualified path..\nMy question then is, how can I fix this error without renaming my classes? Since they are defined in a different module, how do I use a \"fully module-qualified path\"?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":737,"Q_Id":66795228,"Users Score":0,"Answer":"As stated by SQLAlchemy there a two classes found named Foobar. One is model.Foobar and the second one is mymodel.Foobar. You need to use the fully module-qualified path which is mymodel.Foobar to reference the new class.","Q_Score":0,"Tags":"python-3.x,sqlalchemy,orm","A_Id":66800246,"CreationDate":"2021-03-25T07:52:00.000","Title":"SQLAlchemy how to use a \"fully module-qualified path\"?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Hello I know that the key to analyzing data and working with artificial intelligence is to use the gpu and not the cpu. The problem is that I don't know how to use it with Python in the visual studio code, I use Ubuntu, I already have nvidia installed","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1242,"Q_Id":66801401,"Users Score":1,"Answer":"You have to use with the libraries that are designed to work with the GPUs.\nYou can use Numba to compile Python code directly to binary with CUDA\/ROC support, but I don't really know how limiting it is.\nAnother way is to call APIs that are designed for parallel computing such as OpenCL, there is PyOpenCL binding for this.\nA bit limiting, but sometimes valid way - OpenGL\/DirectX compute shaders, they are extremely easy, but not so fast if you need to transfer data back and forth in small batches.","Q_Score":0,"Tags":"python,python-3.x,pandas,dataframe,visual-studio-code","A_Id":66802239,"CreationDate":"2021-03-25T14:18:00.000","Title":"how can i work with my GPU in python Visual Studio Code","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I would like to know how to convert annotations in YOLO format (e.g., center_X, center_y, width, height = 0.069824, 0.123535, 0.104492, 0.120117) to x1, y1, x2, y2 coordinates?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":489,"Q_Id":66801530,"Users Score":1,"Answer":"Given that the upper-left corner of the image is [0,0]: For the upper-left corner you have to do [x,y] = [center_X, center_Y] - 1\/2 * [width, height] . For the bottom-right corner [x,y] = [center_X, center_Y] + 1\/2 * [width, height] .","Q_Score":1,"Tags":"python,computer-vision,yolo","A_Id":66801978,"CreationDate":"2021-03-25T14:24:00.000","Title":"How to convert YOLO format annotations to x1, y1, x2, y2 coordinates in Python?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"It's probably a dumb question but i cant find the answer anywhere. So, I have made a simple site with Flask and it have a database in SQL(SQLite3). I'have never uploaded a site before and I don't know how to get the data after deployed. Plz help.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":76,"Q_Id":66803446,"Users Score":0,"Answer":"If your code already works locally, make sure it has a relative path like '.\/data\/sqllitedb.db'.\nPut it in a folder that isn't available to access from your website.\nWhen you deploy to your website, it should use the same relative path.\nSqlite is great because it is just a local file and as long as you use relative paths to your main site, you should be able to access it","Q_Score":2,"Tags":"python,sql,sqlite,flask","A_Id":66803891,"CreationDate":"2021-03-25T16:10:00.000","Title":"How will I access the data in my database after uploading my site to the web?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am using Python to automate some installations in my everyday workflow.\nThe installation requires mounting a .dmg file to the system in order to start and complete the installation. Everything works fine until I try to eject\/unmount the attached volume, it gives an error that the volume is used by Python and cannot be ejected\/unmounted. The installation process is already completed by the time the unmount is executed, so in theory, files should no longer be in use.\nForce unmount helps with the unmount process, but for some reason, it interferes with subsequent subprocess.Popen command that starts the installed application and the app crashes at startup. The crash doesn't occur if the volume is not unmounted, which is a sign the issue is caused by the unmount process.\nI would like to try to unmount the volume without forcing the process, but I don't know how to unlock the files being used by Python for the installation. Is there a way to force python to unlock those files?\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":80,"Q_Id":66804331,"Users Score":0,"Answer":"The issue was related to the fact the current working directory was set to a folder inside the mounted volume. Switching the CWD to HOME before unmounting process and subprocess execution fixes the issue.","Q_Score":2,"Tags":"python,macos,file,locking","A_Id":66805352,"CreationDate":"2021-03-25T17:07:00.000","Title":"How to force python to unlock files on macOS","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I have a problem: we are using a package that is not maintained for a while now. So we forked it in order to maintain it ourselves. The package already exists lets say it is named package_a. Most of the code and the __init__ are in the package_a\/ folder.\nNow we want to make our own package that will include our maintained code and we want to name is package_b. So far so good but the problems is that package_b wants to have the code and the __init__ in package_b\/ folder and github changes the contributions for all files when a folder is renamed. And I would like that credit for contributions stays where it is due, the 10k+ lines of code didn't just appear in my local repo out of thin air. Any suggestions how we can have package named package_b but keep the code in the original folder package_a\/?\nI am thinking along the lines of trying with some clever way of importing package_a into package_b or something along the line but I hope for a definite answer.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":57,"Q_Id":66804369,"Users Score":2,"Answer":"Instead of copying the code or trying to import A into B, extract the common code into a 3rd package which both A and B import. Or perhaps a subclass. This doesn't solve your contribution problem, but it does avoid making a big maintenance hassle by copying and pasting 10,000 lines of code.\n\nGit doesn't record copies and renames, but it can recognize when they happen. To give Git the best chance of recognizing a copy, do only the copy in its own commit. Make no changes to the content. Then in a second commit make any necessary changes to the copied code.\nIn normal Git you can nudge git log and git blame to honor copies and renames with -C. Git doesn't do this by default because it's more expensive.\nGithub will do what Github will do.\nRegardless of who Github says who wrote what line their contributions will still be in the project history. That's how it goes. You make your contribution and then others put their own work on top of it. This is normal. Their contributions remain in the history.\n\"History sheer\" is also normal, that's when a change touches many lines but is otherwise insignificant. For example, if you were to restyle the code that would cause a history sheer. git blame will say that was the last commit to touch the code. git blame -w mitigates this somewhat, and Github has an \"ignore whitespace\" option. History sheer is normal and so is learning to skip over it.\nThe tools work for us. Don't bend yourself for the benefit of the tools.\nIf you want to make a special shout out to your contributors, make a contributor's section to your README.md.","Q_Score":2,"Tags":"python,github","A_Id":66835236,"CreationDate":"2021-03-25T17:09:00.000","Title":"Rename folder in git without changing the contributors","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Sorry for my stupid question, but i dont understand how to add all permissions in my voice channel for one user. I have this await channel.set_permissions(member, some_permission), but i dont know what permission i need to use","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":304,"Q_Id":66824019,"Users Score":0,"Answer":"You should just make a role with those permissions and then give that role to the user. for example, await member.add_roles(var) var being the role and member being the member you want to add the role too.","Q_Score":0,"Tags":"python,python-3.x,discord,discord.py","A_Id":66847972,"CreationDate":"2021-03-26T20:37:00.000","Title":"How to give all permissions in voice channel discord.py","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I trained a chatbot in a file on my computer. I have everything else for my website up and running but I cannot get the python file into the site. Do you have any advice for how I can make an html messenger that uses user inputs and converses with the AI chatbot that way? Thank you!","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":69,"Q_Id":66828255,"Users Score":1,"Answer":"One easy way to do this is by building a server, where you can have your chatbot code. You can use Flask. The instant the HTML asks a question, you send an API call with the required message, which when received by the API runs that message through the chatbot and returns the response in the output. This can continuously go on in the chat.","Q_Score":0,"Tags":"python,html,css,flask","A_Id":66828292,"CreationDate":"2021-03-27T05:21:00.000","Title":"How the heck do I import my python chatbot into my html code?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Background\nI have a google sheet, who's data I need to process on my local system. The nature of processing is very tedious and long so I wrote a script for it.\nProblem\nI need to access the google sheet through the python script to process it further. Online it is mentioned that to read the private google sheet directly, I need to create a GCP project and within that project, I need to create a service account. After that I should download the credentials and share the google sheet with that service account email.\nTwo problems here are :\n\nDownloading the credentials -- insecure and my organization prohibits it.\nSharing of google sheet with service account email. organization also prohibits sharing sheet with outside organization emails.\n\nWhat I found as a solution\nI came across a solution of impersonating a service account but I could not find anything as to how can I do that. (Would appreciate any insights on that). All the other solutions suggested to download credentials which is a big NO.\nFor the sharing of sheets thing, I guess we can use drive API, but same problems are with that.\nI tried using gcloud auth login and gcloud auth application-default login but was getting errors\n\nRequest had insufficient authentication scopes.\". Details: \"Insufficient Permission: Request had insufficient authentication scopes.\n\nusing ['https:\/\/www.googleapis.com\/auth\/spreadsheets', https:\/\/www.googleapis.com\/auth\/drive'] as scopes\nWhat I need? (Summary)\nHow to access google sheets API (or download the Sheet from google drive) without downloading any sort of credentials.json.","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":1394,"Q_Id":66833449,"Users Score":2,"Answer":"problem\nYour only option to access private user data is to be authorized as a user who can access the file. Either logging in using Oauth2 or using a service account\n\nDownloading the credentials -- insecure and my organization prohibits it.\n\nIn order to use a google api you must first register your application on google developer console and download the client credentials then a user must authorize the application using Oauth2, which would mean both downloading the credentials.json file from google developer console and you getting user token credentials from the authorized user.\n\nSharing of google sheet with service account email. organization also prohibits sharing sheet with outside organization emails.\n\nIn order to use a service account you would again need to first register your application on google developer console and download the client credentials for the service account. Then you would need to share the sheet with the service account.\nservice account impersonation.\nService account impersonation is used by GSuite domain. You create a normal service account again downloading the credentials, and then the GSuite admin is able to delegate authority to the service account which will allow it to impersonate a user on the domain.\nThis would require you to have GSuite domain and the owner of the file being also on the GSuite domain, and you creating a project on google developer console and downloading the credentials.json for the service account, which you already stated you couldn't do.\nconclusion\nI guess what i am saying is there is no way with the limitations imposed by your organization for you to access a private google sheet or any private user data on googles system, via any api.","Q_Score":3,"Tags":"python-3.x,google-sheets,google-cloud-platform,google-drive-api,google-sheets-api","A_Id":66834681,"CreationDate":"2021-03-27T16:13:00.000","Title":"How to read private Google Sheets using Google Sheets API without service account or downloading credentials","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I'm working on a NLP classification problem over a large database of emails (~1 million). I need to use spacy to parse texts and I'm using the nlp.pipe() method as nlp.pipe(emails,n_process=CPU_CORES, batch_size=20) to loop over the dataset.\nThe code works but I'm facing a (maybe not so)weird behavior:\nthe processes are being created but they are all in SLEEP state but one, casually some of them go in RUN state for a few seconds and then back to sleep. So I find myself with one single process using one core at 100% but of course the script not using all the CPU cores.\nIt's like the processes don't get \"fed\" input data from pipe.\nDoes anybody know how to properly use spacy nlp pipe or anyway how to avoid this situation? no way to use nlp.pipe with the GPU?\nThank you very much!\nSandro\nEDIT: I still have no solution but i've noticed that if I set the batch_size=divmod(len(emails),CPU_CORES), the processes all starts running at 100% CPU and after a few seconds they all switch to sleeping state but one. It really looks like some element in spacy pipe gets locked while waiting for something to end.... any idea??\nEDIT2: Setting batch_size=divmod(len(emails),CPU_CORES) while processing a large dataset leads inevitably to a spacy memory error:\n\nMemoryError: Unable to allocate array with shape (1232821, 288) and data type float32\n\n*thing that is maybe not so weird as my machine has 10GB of RAM and (1232821\u00d7288\u00d732)bits \/ 8 = 1.4GB multiplied by 6 (CPU_CORES) leads to a 8.5GB of RAM needed. Therefore I guess that, having other stuff in memory already, it turns out to be plausible. *","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1341,"Q_Id":66844380,"Users Score":0,"Answer":"Ok, I think I found an improvement but honestly the behavior it's not really clear to me. Now the sleeping processes are way less, with most of them stable running and a few sleeping or switching between the two states.\nWhat I've done was to clean and speedup all the code inside the for loop and set the nlp.pipe args like this:\nfor e in nlp.pipe(emails,n_process=CPU_CORES-1, batch_size=200):\nIf anybody have any explanation about this or any suggestion on how to improve even more, it's of course more than welcome :)","Q_Score":2,"Tags":"python,multiprocessing,sleep,spacy","A_Id":66922559,"CreationDate":"2021-03-28T17:46:00.000","Title":"Spacy, using nlp.pipe on large dataset in python, multiprocessing leads to processes going in sleep state. How to proper use all CPU cores?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm working on a NLP classification problem over a large database of emails (~1 million). I need to use spacy to parse texts and I'm using the nlp.pipe() method as nlp.pipe(emails,n_process=CPU_CORES, batch_size=20) to loop over the dataset.\nThe code works but I'm facing a (maybe not so)weird behavior:\nthe processes are being created but they are all in SLEEP state but one, casually some of them go in RUN state for a few seconds and then back to sleep. So I find myself with one single process using one core at 100% but of course the script not using all the CPU cores.\nIt's like the processes don't get \"fed\" input data from pipe.\nDoes anybody know how to properly use spacy nlp pipe or anyway how to avoid this situation? no way to use nlp.pipe with the GPU?\nThank you very much!\nSandro\nEDIT: I still have no solution but i've noticed that if I set the batch_size=divmod(len(emails),CPU_CORES), the processes all starts running at 100% CPU and after a few seconds they all switch to sleeping state but one. It really looks like some element in spacy pipe gets locked while waiting for something to end.... any idea??\nEDIT2: Setting batch_size=divmod(len(emails),CPU_CORES) while processing a large dataset leads inevitably to a spacy memory error:\n\nMemoryError: Unable to allocate array with shape (1232821, 288) and data type float32\n\n*thing that is maybe not so weird as my machine has 10GB of RAM and (1232821\u00d7288\u00d732)bits \/ 8 = 1.4GB multiplied by 6 (CPU_CORES) leads to a 8.5GB of RAM needed. Therefore I guess that, having other stuff in memory already, it turns out to be plausible. *","AnswerCount":2,"Available Count":2,"Score":0.0996679946,"is_accepted":false,"ViewCount":1341,"Q_Id":66844380,"Users Score":1,"Answer":"I've found that using n_process=n works well for some models, like en_core_web_lg, but fails with others, such as en_core_web_trf.\nFor whatever reason, en_core_web_trf seems to use all cores with just a batch_size specified, whereas en_core_web_lg uses just one unless n_process=n is given. Likewise, en_core_web_trf fails with a closure error if n_process=n is specified.","Q_Score":2,"Tags":"python,multiprocessing,sleep,spacy","A_Id":67037039,"CreationDate":"2021-03-28T17:46:00.000","Title":"Spacy, using nlp.pipe on large dataset in python, multiprocessing leads to processes going in sleep state. How to proper use all CPU cores?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Given an arbitrary array with real numbers as entries, I want to return an array with the same shape, whose entries are the average over the closest neighbours of the original array.\nWhat I mean by this in the case of a given array of dimension 2, is that if the array has shape (n,m) with entries a_{i,j}, then on the entry (i,j) the value of the new array should be:\naverage(i,j)=1\/4 (a_{i+1,j} + a_{i-1,j} + a_{i,j+1} + a_{i,j-1}),\nwhere the first index is taken mod n and the second mod m.\nI would like to create a function whose argument is an arbitrary array, and returns an array of the same shape and entries the averages over the entries on the closest neighbours of the given array (for a d-dimensional array there are 2d closest neighbours, obtained by summing +1 and -1 on each index)\nI know how to do this for a fixed dimension d (just generalising the above equation), using d nested for loops, but I don't know how to do it when the dimensions are not fixed.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":291,"Q_Id":66846086,"Users Score":0,"Answer":"Scipy has a scipy.ndimage.convolve function, which can do exactly this. it takes the array, and a matrix of values to multiply the neighbors with. It should work for any number of dimensions.\nHowever if you are trying to write this function manually, I'd suggest trying an iterative or recursive approach, where each iteration or layer of recursion handles a dimension. In a 3D case, you would first handle the first dimension, and have the one sixth of the value of the neighbors in that dimension. The next iteration would do the same for dimension 2, etc.\nThe factor to multiply each neighbor with is 1\/(2n), since each entry has 2 neighbors in each dimension. This should scale up to any arbitrary number of dimensions.","Q_Score":0,"Tags":"python,arrays,numpy,numpy-ndarray","A_Id":66846266,"CreationDate":"2021-03-28T20:50:00.000","Title":"How to calculate average of closest neighbours in an array in numpy","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am confused as to how to get into script mode in Python's standard IDLE. I surprisingly cannot find how to get into it on Google.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":56,"Q_Id":66863444,"Users Score":0,"Answer":"I believe you mean the simple editor that ships with Python, \"IDLE\"?\nIf you have an IDLE console window open already, go to file->New File, or press ctrl+N to get a window where you can write and save a python file like a text editor.\nWhen you've written a script in that editor you can save it as you'd expect from File->Save and run it from Run->Run Module, or press F5 as a quick shortcut. It should then output any text to the IDLE console window.\nAlso see the comments directly beneath your question for some resources :) Happy scripting!","Q_Score":0,"Tags":"python,ide","A_Id":66863531,"CreationDate":"2021-03-30T00:52:00.000","Title":"How do I get into script mode for Python?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"import yfinance as yf\nterminal: ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behavior is the source of the following dependency conflicts.\nyahoo 0.1 requires requests==1.1.0, but you have requests 2.25.1 which is incompatible.\nhow can I address this issue\nRegards! :)","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1485,"Q_Id":66880867,"Users Score":0,"Answer":"The problem is that yfinance requires a newer version of requests than yahoo. For me it said the same thing as you got when I tried.\nImporting yfinance worked for me.\nI didn't specify anything for requests and just installed the above. Generally, you can specify installation version using =x.x at the end, i.e. pip install requests==1.1.0.","Q_Score":0,"Tags":"python,finance","A_Id":66881009,"CreationDate":"2021-03-31T02:32:00.000","Title":"Addressing a pip\u00b4s dependency issue: requests==2.25.1 versus requests==1.1.0","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"import yfinance as yf\nterminal: ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behavior is the source of the following dependency conflicts.\nyahoo 0.1 requires requests==1.1.0, but you have requests 2.25.1 which is incompatible.\nhow can I address this issue\nRegards! :)","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1485,"Q_Id":66880867,"Users Score":0,"Answer":"It sounds like you have both yahoo and yfinance installed in the same environment\/setup. I suggest creating a virtual environment with virtualenv so you can have the appropriate requests for each libraries.\nAlternatively you can submit a PR for yahoo to use a more recent version of requests","Q_Score":0,"Tags":"python,finance","A_Id":66881232,"CreationDate":"2021-03-31T02:32:00.000","Title":"Addressing a pip\u00b4s dependency issue: requests==2.25.1 versus requests==1.1.0","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to code a function that will accept a list and then return the length of the list times the largest integer (not float) in the list, if the list does not contain an integer, it needs to return an empty string.\nI had been trying to use the max function but I cannot work out how to only call for the largest integer not float, or is there a way to sort the list first to only look at integers?","AnswerCount":7,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":62,"Q_Id":66887008,"Users Score":0,"Answer":"you might be able to use an if statement to check if the number is an interger","Q_Score":0,"Tags":"python,integer","A_Id":66887051,"CreationDate":"2021-03-31T11:30:00.000","Title":"python - is there a function to return the maximum integer but not float from a list","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Robot Framework supports two ways to interact with the tests and modify the test structure:\n\nthe visitor internal API\nthe listener API\n\nI would like to prepend, to specific tests, a given keyword, or even more precisely to wrap the test in a given keyword, if that test has a specific tag. Which of the two approaches should I choose, and how I should use the API of the Body of Robot Framework to wrap it in a Wait Until Keyword Succeeds?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":582,"Q_Id":66890396,"Users Score":1,"Answer":"I think the Listener API might be the way to go but why not use the Test and Suite Setup Keywords to be able to pull off what you are trying to do. However, in general, i.e. not just in Python or Robot Framework, it is a bad idea to have one test depend on the execution of another test. Ideally, each test should be able to run on its own, whether first or last or anywhere in the sequence so perhaps there might be a need to refactor your tests and\/or Keywords to be able to achieve what you are attempting.","Q_Score":2,"Tags":"python,robotframework","A_Id":66894693,"CreationDate":"2021-03-31T15:04:00.000","Title":"Wrapping a test case in Robot Framework in keyword based on the tag of a test","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have created project and even i have client_secret.js file, when i try to run the program first time it asks to login, when I tried to login through gmail (which I have used to create project) it says\n\n\"Google hasn\u2019t verified this app\"\n\nMessage, so for that i'm looking how to get out from this step.","AnswerCount":2,"Available Count":1,"Score":-0.0996679946,"is_accepted":false,"ViewCount":71,"Q_Id":66899042,"Users Score":-1,"Answer":"This is occuring because the application you created is not verified by google so you are not able to login in that you need to verify it by google suite and then you are able to login I also get that problem when i tried to create an browser for myself","Q_Score":1,"Tags":"python-3.x,google-sheets,google-drive-api,google-oauth,google-developers-console","A_Id":66899090,"CreationDate":"2021-04-01T05:49:00.000","Title":"How to read files from Google drive through python when it says Google hasn\u2019t verified this app?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"So, i entered code below to round a column to the nearest integer, though it still shows up with decimals.\nEg. I want to round 62.040 to just 62 though once the code is entered it shows 62.0 in the output\ndata['Final'] = np.ceil(data['Total'].round())","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":209,"Q_Id":66912904,"Users Score":2,"Answer":"This should work pretty ok data['Final'] = round(data['Total'])\nThis converts the decimal number to it nearest integer and the returned number doesn't have a decimal point\nNote: I'm assuming that data is just dictionary that contains float numbers, since no more information was provided","Q_Score":2,"Tags":"python,python-3.x,pandas,dataframe","A_Id":66913053,"CreationDate":"2021-04-01T23:56:00.000","Title":"how can i stop showing the decimal .0 after the whole number? python","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm new with dramatiq and I do not find a way how to start dramatiq in detach mode like Celery?\nI try to start with flags --d --detach, but nothing works.\nPlease inform me how to start dramatic in detach mode when I start dramatiq app:broker","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":64,"Q_Id":66915309,"Users Score":0,"Answer":"I found it's already work on detach mode, but if you wish to read the logs you need to have your terminal in open view","Q_Score":0,"Tags":"python,dramatiq","A_Id":66949143,"CreationDate":"2021-04-02T06:31:00.000","Title":"How to run dramatiq tasks run in detach mode?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm working in python and I have an image that is represented by the shape (4,386,258), I would like to represent it with the shape (3,386,258). Is there a way to do that? I don't know how to combine the information in order to get the right map","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":25,"Q_Id":66917084,"Users Score":0,"Answer":"Assuming your image is 386 pixels by 258 pixels and you have 4 channels, it means you want to convert the colour representation to one using only 3 channels, probably RGB. You haven't specified what libraries you used to read-in the image or where it is from, but most would have methods to handle this for you, so you don't have to write the conversion manually. They should also have methods of finding what the current colour representation is.","Q_Score":1,"Tags":"python,arrays,numpy","A_Id":66917203,"CreationDate":"2021-04-02T09:17:00.000","Title":"How to map an array of shape (4,386,258) to an array of shape (3, 386,258) in python?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"So i was trying to make a voice classifier, the challenge was to predict if the person talking is me or is other person, i already build a simple code that converts .wav file into an array, so all my datasets of audio files of me talking will be converted into arrays, the thing is that I am a beginner and i dont know how to only use one variable for predicting(my voice), is like saying true or false, how can i make a neural network(CNN) that works like that?\nOr should i use another type of machine learning? And not deep learning? I would like to use deep learning for this project.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":61,"Q_Id":66925505,"Users Score":0,"Answer":"Because it seems that you are relatively new to the topic, I would propose that you start with an easier machine learning model for this simple classification task. Maybe for the first model a Logistic Regression could be enough.\nSo, you say you collected some samples of your own voice (your positve class), but did you also collect some negative samples from other people?\nAfter this, I would suggest to chunk the converted samples into equal siced sequences and label them (your voice or another?).\nNow with this as basis, you can test some easier models like the Logistic Regression or the KNN. You then might move forward to some simple Feed-Forward-Neural-Networks and then go on to some advanced models like CNN's or RNN's.","Q_Score":1,"Tags":"python,machine-learning,deep-learning,conv-neural-network,classification","A_Id":66926217,"CreationDate":"2021-04-02T21:34:00.000","Title":"CNN classified only one variable if it is true or false","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"If I send out a request to a user for them to reply to a yes or no question, how can I make it such that after a certain amount of time, the question expires and is no longer accepting replies?\nBackground\nI'm currently working on a discord.py bot, and I'm getting to the part where I start scanning the messages for user input. How it works is that somebody can challenge someone to a game of tic tac toe, and then the challenged person has 10 seconds to reply with yes or no. How can I make it such that after 10 seconds, the challenge expires?\nExamples\nOne example I thought of is the bot Dank Memer. If you challenge someone to a tic tac toe game on there, then the challenged person has to respond to you within a time limit, or else the challenge expires. It also works with commands like pls trivia, where after 10 seconds it stops accepting answers to the question.\nI'm pretty sure that people have already asked this question, but I have looked over and over on Google and I can't find a solution. It's probably because of my wording, I think.\nIt's also hard for me to do a minimal-reproducible example, as that would require you guys to have to create a discord account and token for the bot, which is not at all efficient.","AnswerCount":3,"Available Count":1,"Score":0.1325487884,"is_accepted":false,"ViewCount":279,"Q_Id":66926822,"Users Score":2,"Answer":"You can use a await client.wait_for(check=check). Check is a function you must define that needs to return either true or false. Within check, you can add various conditions and actions if you need to. I made a command that does a math equation with it, if you'd like to see an example.","Q_Score":1,"Tags":"python,discord,discord.py","A_Id":66926879,"CreationDate":"2021-04-03T00:54:00.000","Title":"Is there a way to make it such that the user must answer within a time limit on discord.py?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Is there a way to display a list of the widgets or the items inside a list view? the items were also added by buttons, then next thing that i want to do is to display a list of the added items in another screen? how would i do this?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":93,"Q_Id":66926981,"Users Score":0,"Answer":"You can provide an id to your ListView and later on access it in your code where you want it. After accessing ListView you can just call lstvw.children (assuming you accessed it as lstvw). It will provide you list of all the children.","Q_Score":0,"Tags":"python,python-3.x,kivy,kivy-language,kivymd","A_Id":66940104,"CreationDate":"2021-04-03T01:29:00.000","Title":"Displaying a list of all the items\/widgets inside a ListView Kivy\/KivyMD","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I would think it's obvious that it should uninstall all packages when removing an environment, since how would they be accessed otherwise, but I haven't seen documentation saying so, so I'm checking here if all packages need to be removed first.","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":1349,"Q_Id":66932971,"Users Score":1,"Answer":"The conda environment will be deleted. Sometimes some packages stay behind, although they are not bound to any environment. You can delete these under\n -> envs -> .","Q_Score":5,"Tags":"python,anaconda,conda","A_Id":66934267,"CreationDate":"2021-04-03T15:41:00.000","Title":"If I remove a conda environment will it automatically remove all packages?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am planning to use a same user model for two different users with some additional fields in one model. Is it possible to do this in Django? If it is possible, how can I do it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":42,"Q_Id":66943719,"Users Score":0,"Answer":"You have two options :\nFirstly\nYou create a new Model (call it ExtendedUser) and you put the extra fields in that model.\nYou then set your ExtendedUser model to inherit from your MainUser model. This will create two tables with a one to one link between them.\nThe advantage of this is that your ExtendedUser model will inherit any methods defined in your original MainUser model, and you only need add methods to the ExtendedUser model if you absolutely have to. You can also write functions which can deal with both the MainUser and ExtendedUser models easily, since they are all instances of the MainUser model. One of the benefits of using inhertiance is if you write a query on the ExtendedUser model fetching all fields, it well fetch the MainUser fields too.\nA Second (worse) option :\nHave a single extended model with a flag on it which says whether to use the extra fields. This can be made to work, but will make your queries more complex, and if you need the extra fields to be indexed, the indexes are likely to be a bit less efficient.\nNote : having a second table with a relationship between the two is no bad thing in SQL - that is how data is normally managed. Having special optional fields for some types of users isn't great as mentioned.","Q_Score":0,"Tags":"python,django,authentication","A_Id":66943833,"CreationDate":"2021-04-04T16:55:00.000","Title":"Different user with more fields in the same model in Django","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I've tried conda install -c anaconda boost and I get the error fatal error C1083: Cannot open include file: 'boost\/python.hpp': No such file or directory. I've added the boost download to the system and user paths, I've followed the direction on how to install boost python on Windows. What am I missing? What else can I do? I get the same error regardless of what I try.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":395,"Q_Id":66959565,"Users Score":0,"Answer":"My answer comes quite late, but I hope it will be of use for other people. In fact the arborescence has changed in an update\nfor instance in my case with Anaconda\n\nin the 1.67 version , python.hpp is in \\anaconda3\\envs\\myenv\\Library\\include\\boost\nin newer version (tested with 1.73) , python.hpp is in \\anaconda3\\envs\\myenv\\Library\\include\\boost\\python which prevents it from encountering it\n\nYou can either modify the path referencing these files or install the version that works","Q_Score":0,"Tags":"python,boost","A_Id":68359174,"CreationDate":"2021-04-05T20:44:00.000","Title":"How to install boost python on anaconda with windows 10","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I'm using Pygame.midi and you can select from 127 instruments.\nI want to know how I can change\/add midi instruments to this list.\nIs there a list of pygame.midi instruments anywhere and if not what libraries is pygame using to actually do midi?\nI've seen something called PortMidi and I'm wondering if this is what Pygame is using.\nI just want to know how I can access pygame.midi and add instruments.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":108,"Q_Id":66975443,"Users Score":1,"Answer":"Pygame is not providing the instruments. It's just sending MIDI commands to your system's built-in synthesizer, usually part of your sound card. MIDI allows for 127 instruments at a time. There is a standard called \"General MIDI\" that tries to define a baseline of 127 instruments, and that's probably what your system is using.\nYou use \"sysex\" (system exclusive) messages to tell the synthesizer to change the instrument-to-channel assignments. pygame supports that with the write_sys_ex command, but you have to know the internals of your synthesizer to know which commands to send.","Q_Score":1,"Tags":"python,pygame,midi,pyportmidi","A_Id":66975564,"CreationDate":"2021-04-06T19:39:00.000","Title":"How to access and change Pygame.midi?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm just picking up some async Python and trying to write a simple TCP port scanner using the Asyncio module.\nI can open a full-fledged TCP connection with 3-way handshakes via asyncio.open_connection. However, I want to create an SYN-ACK half-open connection\u2014similar to what nmap uses\u2014using asyncio. I was rummaging through the streams API but couldn't find anything. Is there a high-level method to do this? If not, how do I do this?","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":203,"Q_Id":66976054,"Users Score":1,"Answer":"asyncio doesn't give you such control on TCP\/IP stack layers and even hides some complex tasks such as callbacks, low-level protocols, transports.\nYou can do it using a raw socket.\nModules that can be useful\n\npython-nmap\nscapy","Q_Score":1,"Tags":"python,asynchronous,tcp,async-await,python-asyncio","A_Id":67002079,"CreationDate":"2021-04-06T20:30:00.000","Title":"Is there an easy way to do half open TCP connection via Python Asyncio?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm wondering how to install two different versions of a module for python. I host some scripts on a server and some particular ones require older version of the module because some things just doesn't work in the newer version and vice versa, some things doesn't work on the older version.\nI know i can use pkg_resources and require a certain version, but if i try to install and use another version it just replaces the other one.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":66,"Q_Id":66976414,"Users Score":2,"Answer":"Easiest solution would be to use virtual environments for one or both of your scripts. This is however not recommended in the long run if you want to scale and manage. You should switch up the script using the older version or move to something like a docker based solution.","Q_Score":1,"Tags":"python,pip,python-module","A_Id":66976513,"CreationDate":"2021-04-06T21:02:00.000","Title":"How to install different versions of modules for python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm new to Python and Pandas, and i'm struggling to create a frequency distribution table form my df.\nMy dataframe is something like this:\n\n\n\n\nBalances\nWeight\n\n\n\n\n10\n7\n\n\n11\n15\n\n\n12\n30\n\n\n13\n20\n\n\n10\n15\n\n\n13\n20\n\n\n\n\nedit: The balance numbers are its respective ID\nI need the frequency of each balance used (in this example, balance 10 would be 2 and so on) the min, max and mean of the measurements results.\nI was to use df.groupby(['balances']) but how can i use the results form using df.groupby to creat a new table? Is that the way?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":573,"Q_Id":66988987,"Users Score":1,"Answer":"df.groupby(['balances']).count() should solve what you're looking for","Q_Score":2,"Tags":"python,pandas,frequency-distribution,frequency-table","A_Id":66989052,"CreationDate":"2021-04-07T15:12:00.000","Title":"Creating a frequency distribution table in Python","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have documents in different MongoDB databases referencing each other (mongoengine's LazyRefereneceField), so each time I need to get the field's value, I need to connect and disconnect from the field's relevant database, which I find very inefficient.\nI've read about connection pooling, but I can't find a solution on how to implement it using MongoEngine. How can I create a connection pool and reuse connections from it every time I need to the value for a LazyReferenceField?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":366,"Q_Id":66989859,"Users Score":0,"Answer":"MongoEngine is managing the connection globally (i.e once connected, it auto-magically re-use that connection), usually you call connect just once, when the application\/script starts and then you are good to go, and don't need to interfere with the connection.\nLazyReferenceField is not different from any other field (ReferenceField, StringField, etc) in that context. The only difference is that it's not doing the de-referencing immediatly but only when you explicitly request it with the .fetch method","Q_Score":0,"Tags":"python-3.x,mongodb,connection-pooling,mongoengine","A_Id":66993289,"CreationDate":"2021-04-07T16:04:00.000","Title":"Use connection pool with MongoEngine","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I salute all brethren here. Please I was tasked by my superior in a pharmacy outlet to generate barcode taking into consideration drug's country of origin ID or code, supplier code, product code and product classification as in pain killer etc. All these must be serialize into a readable barcode. So it means this must link to a database. Please brethren, how do I go about this in python kivy?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":43,"Q_Id":67000886,"Users Score":0,"Answer":"Too opened question I think ?\nYou encapsulate:\n\nInstall kivy\nWrite your program\nDeploy it\n\nI suppose you want to focus on how to program it and you will manage to learn how to install and deploy it.\nI suppose that you want to use the phone's camera to analyse the barcode.\nI have an application that need to take photos and analyze the text on it to write it in a form. I didn't manage to make it work personnaly. Try to know if the kivy cam is \"stable enough\" to allowed saving\/loading\/real_time_analyze on Android.\nIf you manage to make your camera work, you will need to focus on the analyse of the barcode. I think that you can reuse working library and use it on your application (or on a AWS lambda as a micro-service).","Q_Score":0,"Tags":"python,kivy,barcode","A_Id":67004327,"CreationDate":"2021-04-08T09:14:00.000","Title":"Barcode with kivy","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to find the correlation between categorical and numerical columns in my dataset using Python, can anyone help?\nHere is the data that I have.\nThank you in advance.\n\n\n\n\nLight_Sensor_Reading\nLight_Sensor_Status\n\n\n\n\n231\nDim\n\n\n231\nDim\n\n\n231\nDim\n\n\n231\nDim\n\n\n231\nDim\n\n\n231\nDim\n\n\n231\nDim\n\n\n231\nDim\n\n\n231\nDim\n\n\n232\nDim\n\n\n950\nVery_bright\n\n\n988\nVery_bright\n\n\n987\nVery_bright\n\n\n986\nVery_bright\n\n\n986\nVery_bright\n\n\n986\nVery_bright\n\n\n986\nVery_bright\n\n\n986\nVery_bright\n\n\n986\nVery_bright\n\n\n986\nVery_bright\n\n\n986\nVery_bright\n\n\n986\nVery_bright\n\n\n986\nVery_bright\n\n\n985\nVery_bright\n\n\n985\nVery_bright","AnswerCount":4,"Available Count":1,"Score":0.049958375,"is_accepted":false,"ViewCount":5742,"Q_Id":67021061,"Users Score":1,"Answer":"it doesn't mean anything to calculate the correlation between two variables if they are not quantitative.\nI think what you want to do is to study the link between them.\nThe purpose is to explain the first variable with the other one through a model.\nYou can use the logistic regression.\nBut you will only know if there is a link between these two variables with a T-Test or a wilcoxon test depending on the normality of the data","Q_Score":2,"Tags":"python,correlation","A_Id":67024223,"CreationDate":"2021-04-09T12:20:00.000","Title":"how to find the correlation between categorical and numerical columns","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"When I run time.mktime(datetime.strptime(\"2012-03-09\", \"%Y-%m-%d\").timetuple())\nI get the value 1331251200.0.\nNow I want to know how can I invert this? So if I pass in 1331251200.0, how do I get as output 2012-03-09? I know strftime is the inverse of strptime, but I don't see how to invert the whole thing because of the timetable function.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":31,"Q_Id":67029057,"Users Score":0,"Answer":"So the way to do this is by time.strftime(\"%Y-%m-%d\", time.localtime(time.mktime(datetime.strptime(\"2012-03-09\", \"%Y-%m-%d\").timetuple()))).\nI didn't know strftime would turn the timetable to a string before I asked.","Q_Score":0,"Tags":"python,datetime,python-datetime","A_Id":67029130,"CreationDate":"2021-04-09T22:35:00.000","Title":"How do I find the date string from the numeric value?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am unfamiliar with the instaboy.py python package. I am wondering if there are any security issues with this package like possibly getting information leaked. I am wondering how does the API work if there are a lot of people using this package. Wouldn't you need your own personal Instagram API token? I am confused by the whole concept and if anyone could explain even just a little bit it will be much appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":427,"Q_Id":67041693,"Users Score":0,"Answer":"Bots are now easily detected by Instagram. Your account could be banned for 3 days, 7 days, 30 days or definitively if Instagram detects too many attempts\nUsually bots simulate a browser via Sellenium and then create a \"browse like a human\" bot to create likes, follow, unfollow, etc.","Q_Score":0,"Tags":"python,api,instagram-api,facebook-access-token,instagram-graph-api","A_Id":67127196,"CreationDate":"2021-04-11T05:16:00.000","Title":"Is instabot.py safe to use?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I would like to programatically delete image placeholders which are full (PlaceholderPicture objects in the python-pptx API)\nand replace them with empty ones (PicturePlaceholder), the goal being to \"refresh\" pictures instead of always having to fill out an empty presentation.\nI think I know how to delete a shape, but creating a new PicturePlaceholder proves harder than expected.\nWhen I try to create one I am asked to provide a sp and a parent and I cannot find in the documentation what these parameters refer to.\nDoes my approach make sense, and if so is it possible to create new placeholders programmatically? Could anyone explain what are the parameters I should pass to the constructor?\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":100,"Q_Id":67054615,"Users Score":0,"Answer":"python-pptx has no API support for this, which means you would need to directly manipulate the underlying XML of the slide to accomplish it (and be outside the python-pptx \"safety net\").\nsp is the shape element (generally an element, hence the name) and parent would be a reference to the slide.\nAs a general approach, I would create an empty placeholder and compare its XML to that of a \"filled\" placeholder which is the same in every respect. Then the job is to make one into the other.\nNote that a picture placeholder has a relationship to the \"image part\" (e.g. PNG file) stored elsewhere in the PPTX package (.pptx file). This will need to be dealt with and not left dangling.\nAnother possibility is just to swap the image and leave everything else in place, which on paper at least would be less disruptive.\nBecause none of these options has API support, pursuing them involves taking on responsibility for a lot of details that python-pptx takes care of for you and learning a fair amount about the internals. If that sounds like something you'd rather avoid then you'll want to find another way to accomplish the broader outcome you have in mind.","Q_Score":0,"Tags":"automation,powerpoint,python-pptx","A_Id":67062581,"CreationDate":"2021-04-12T07:59:00.000","Title":"How can I replace a full image placeholder by an empty one?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":1,"ERRORS":0,"REVIEW":0},{"Question":"I use the below statement, extracting cell content as legend name (I have 3 set of values to plot on y-axis, thus need 3 legend parameters)\nplt.legend(df.iat[0, 0], df.iat[0, 1], df.iat[0, 2])\nthe compiled error says that 'legend only accepts two non-keyword arguments'\nI print out the df.iat[0, 0], df.iat[0, 0], df.iat[0, 0], all these 3 are the cell content I expect.\nAnyone know how I can fix it?","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":316,"Q_Id":67055120,"Users Score":0,"Answer":"You have to put the values in a list:\nplt.legend([df.iat[0, 0], df.iat[0, 1], df.iat[0, 2]])","Q_Score":0,"Tags":"python,pandas,csv,matplotlib","A_Id":67055221,"CreationDate":"2021-04-12T08:34:00.000","Title":"pandas plt.legend issue. error says that 'legend only accepts two non-keyword arguments'","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"Is a very simple page, that have some buttons redirecting to external links. That external links have to change arbitrarely when certain people decides it.\nI was wondering about making a login screen in other page and depending which user logs in, set the link writting it in a txt file that would be recovered by the main page. Don't need security so i just would make the user go to the other page and login and that would change the link in a txt file hosted in the same directory that the index.html is.\nThe problem is that i cannot make that idea (writing a .txt in the project folder) with JavaScript (or i think so), and i don't think that using a database worth it (neither want to because i read that would have to use node.js or something like that and i really don't know those tecnologies, only some python and sql server -that is in fact not supported by my hosting service-), cause are just 3 people associated to 1 link each. I can easily make that task with python but don't know how to call it from JS and neither if Ajax request would be useful for this case.\nI hope someone can help me!\nedit - the changes have to apply for the page itself not in the user session, so everyone who enters see the page with the changes\nedit 2 - absolutely all the info (users and links) are always the same, doesnt change so i can put it in variables, are just 4 or 5 so i can easily use an array, the only thing that i would have to register is which one to pick (since it depends on who decides it).","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":31,"Q_Id":67057096,"Users Score":0,"Answer":"IT seems you want to use some sort of client side storage across different html pages - for that, you can use cookies, localSotrage or sessionStorage.","Q_Score":0,"Tags":"javascript,python,html,css","A_Id":67057191,"CreationDate":"2021-04-12T10:52:00.000","Title":"How can I make an one-user input have consequences in the behaviour of all page?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Today I faced a problem regarding pip3 in Ubuntu. Ubuntu comes with python 3.8 but I wanted to use latest versions of python, like 3.9 or maybe 3.10. So I installed it using 'ppa:deadsnakes' repository and also installed pip. But the problem is I want to use pip in python 3.9 instead of version 3.8. So I changed the default python version to 3.9 and everything crashed.\nSo reverted to python 3.8. Whenever I install some package it gets installed using python 3.8.\nHelp me, how can I use python 3.9 pip and install packages in python 3.9 without changing the default version.\nAny help is appreciated.\n--> Thing I want is that when I want to install python package using\npip3 install it must install in python3.9 and not in python3.8","AnswerCount":4,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":7823,"Q_Id":67059399,"Users Score":0,"Answer":"you can use pip for python3.9 by pip3.9 install ","Q_Score":2,"Tags":"python,python-3.x,ubuntu-20.04","A_Id":67059454,"CreationDate":"2021-04-12T13:35:00.000","Title":"How to use pip for python 3.9 instead of inbuilt python 3.8 in Ubuntu?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Today I faced a problem regarding pip3 in Ubuntu. Ubuntu comes with python 3.8 but I wanted to use latest versions of python, like 3.9 or maybe 3.10. So I installed it using 'ppa:deadsnakes' repository and also installed pip. But the problem is I want to use pip in python 3.9 instead of version 3.8. So I changed the default python version to 3.9 and everything crashed.\nSo reverted to python 3.8. Whenever I install some package it gets installed using python 3.8.\nHelp me, how can I use python 3.9 pip and install packages in python 3.9 without changing the default version.\nAny help is appreciated.\n--> Thing I want is that when I want to install python package using\npip3 install it must install in python3.9 and not in python3.8","AnswerCount":4,"Available Count":3,"Score":0.1488850336,"is_accepted":false,"ViewCount":7823,"Q_Id":67059399,"Users Score":3,"Answer":"Hello everyone I fixed my issue.\nThe problem is we cannot override default python version in Ubuntu as so many things depend on it.\nSo I just made an alias as : alias pip3='python3.9 -m pip' and alias for python : alias python3='\/usr\/bin\/python3.9'\nIf anyone face this issue please do what I specify and you will be good to go.\nNow all my packages are being installed in python3.9.","Q_Score":2,"Tags":"python,python-3.x,ubuntu-20.04","A_Id":67078527,"CreationDate":"2021-04-12T13:35:00.000","Title":"How to use pip for python 3.9 instead of inbuilt python 3.8 in Ubuntu?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Today I faced a problem regarding pip3 in Ubuntu. Ubuntu comes with python 3.8 but I wanted to use latest versions of python, like 3.9 or maybe 3.10. So I installed it using 'ppa:deadsnakes' repository and also installed pip. But the problem is I want to use pip in python 3.9 instead of version 3.8. So I changed the default python version to 3.9 and everything crashed.\nSo reverted to python 3.8. Whenever I install some package it gets installed using python 3.8.\nHelp me, how can I use python 3.9 pip and install packages in python 3.9 without changing the default version.\nAny help is appreciated.\n--> Thing I want is that when I want to install python package using\npip3 install it must install in python3.9 and not in python3.8","AnswerCount":4,"Available Count":3,"Score":1.0,"is_accepted":false,"ViewCount":7823,"Q_Id":67059399,"Users Score":6,"Answer":"You don't need to install pip separately\nYou should be able to refer to it as such\npython3.9 -m pip install","Q_Score":2,"Tags":"python,python-3.x,ubuntu-20.04","A_Id":67059447,"CreationDate":"2021-04-12T13:35:00.000","Title":"How to use pip for python 3.9 instead of inbuilt python 3.8 in Ubuntu?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":1,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I made a sample app that just says hello world with kivy and I am trying to put it on an android tablet I bought.\nI used a virtual machine (Virtual box) and use bulldozer to loaded to the tablet. However when I run it the terminal just prints in a loop\n#waiting for the application to start\nany idea on what could be the problem, or how can I start the application","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1169,"Q_Id":67081236,"Users Score":0,"Answer":"I had trouble with this too. But if it runs that far then it should've successfully compiled the .apk. It should be in the same folder that you ran the buildozer command. You can even run an HTTP server with buildozer serve and access it via localhost:THE_PORT_NUMBER_HERE. Then you can just transfer or download the .apk to your device. And then install and run it after accepting the correct permissions.","Q_Score":1,"Tags":"python,kivy,kivy-language,buildozer,kivymd","A_Id":71406743,"CreationDate":"2021-04-13T19:27:00.000","Title":"kivy app in adroid with buildozer, terminal loops on \"#waiting for application to start\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I made a sample app that just says hello world with kivy and I am trying to put it on an android tablet I bought.\nI used a virtual machine (Virtual box) and use bulldozer to loaded to the tablet. However when I run it the terminal just prints in a loop\n#waiting for the application to start\nany idea on what could be the problem, or how can I start the application","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":1169,"Q_Id":67081236,"Users Score":0,"Answer":"Make sure you have enabled developer mode on the phone, the phone must be plugged in to the VM (In VirtualBox: Devices -> USB -> {phone}) and that the screen is unlocked.\nOn the phone you should see a \"USB debugging connected\" notification when it's plugged in.\nIf the phone is properly connected, you'll see it in Android Studio in a number of places, including the LogCat and right at the top of the screen in a little dropdown to the left of the run button.\nLastly, you can run the app manually and then connect the debugger if you want. Just run the app on the phone, then click the little icon in the top right with the green bug with an arrow over it.","Q_Score":1,"Tags":"python,kivy,kivy-language,buildozer,kivymd","A_Id":67081320,"CreationDate":"2021-04-13T19:27:00.000","Title":"kivy app in adroid with buildozer, terminal loops on \"#waiting for application to start\"","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am developing a code using python and Django for web scraping. I have provided the required url and already fetched the data.\nBut there is a tab on the url saying \"show more results\".\nHow can I make my Django project to click on that tab of \"show more results\" on the url and the fetch the new results now.\nI have used Beautiful Soup library for web scraping\/","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":25,"Q_Id":67103986,"Users Score":0,"Answer":"BeautifulSoup is an HTML parser and nothing more, if you want to automate clicking and so on you have to use other tools such as selenium.\nAnother idea might be getting the URL of \"Show more results\" and scrape the stuff that it loads. I assume it is loading the thing dynamically so look at your Network Tab (Ctrl+Shift+i then Network) and see which URL it is loading you may be able to scrape it.","Q_Score":0,"Tags":"python,python-3.x","A_Id":67104104,"CreationDate":"2021-04-15T07:22:00.000","Title":"how to make django project click on a particular tab of a url","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am trying to scrape information off of a website (on Chrome) where I need to click on each subpage to get the information I need. After about 7, I get blocked by the website. I think if I was able to switch IPs either each time or once I get blocked, that would work.\nI am using Selenium to open the site and navigate to the subpages. I have tried using a try-catch block so far and a while loop but I am getting errors I do not know how to address.\nDoes anyone have an alternative approach or previous success doing this?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":292,"Q_Id":67111892,"Users Score":0,"Answer":"You can use rotating proxies to change your IP per request or with a time interval but If you don't want to use any proxy you can restart your router to get a new IP address from your ISP but If you have a static IP from your ISP even through you restar your router your IP will stay the same.","Q_Score":2,"Tags":"python,python-3.x,selenium-webdriver,web-scraping,ip-address","A_Id":67113586,"CreationDate":"2021-04-15T15:57:00.000","Title":"In python with selenium, how do you rotate IP addresses?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":1},{"Question":"I'm doing a segmentation task. Now I successfully segmented the area of interest and find the contour of the area. How can I calculate the min\/max axis length of the contour? The axis does not have to be orthogonal.\nWhat I already got are:\ncoordinates of points on the contour.\ncentroid of the contour.\nWhat I already tried:\nI have found a fitting-ellipse of the contour. However, fitting-ellipse can only find the orthogonal axis which might not be the minimum or maximum length across the centroid.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":58,"Q_Id":67118098,"Users Score":0,"Answer":"Since you already have the contour, you might want to do this:\nfor alpha = 0 to 45 degrees, rotate the contour by alpha, draw a line over the centroid of your contour that is parallel to X-axis, find out the intersection points of this line and the contour, that is one \"axis\" at current angle alpha. continue rotating the contour and find more of such \"axis\", find the longest one as your max axis, shortest one as your min axis.","Q_Score":0,"Tags":"python,geometry,medical-imaging","A_Id":67711250,"CreationDate":"2021-04-16T01:53:00.000","Title":"how to find min\/max axis length across the centroid of a closed curve","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm working on a Python application where the desired functionality is that the webcam is used to take in a live video feed and based on whether a condition is true, an image is clicked and uploaded to a database.\nThe database I am using is MongoDB. As far as I can understand, uploading images straight-up to a database is not the correct method. So, what I wanted to do is the following:\n\nan image is clicked from the webcam\nthe image is uploaded to an S3 bucket (from the same Python script, so using boto3 perhaps)\na URL of the uploaded image is retrieved (this seems to be the tricky part)\nand then this URL along with some other details is uploaded to the database. (this is the easy part)\n\nMy ideal workflow would be a way to take that image and upload it to an S3 bucket, retrieve the URL and then upload this URL to the database all in one .py script.\nMy question is: how do I upload an image to an S3 bucket and then retrieve its public URL all through boto3 in a Python script?\nI also welcome any suggestions for a better approach\/strategy for storing images into MongoDB. I saw on some pages that GridFS could be a good method but that it is not recommended for the image uploads happening frequently (and really that using AWS is the more preferable way).","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":302,"Q_Id":67120896,"Users Score":1,"Answer":"You don't need to 'retrieve' the public url, you get to specify the bucket and name of the s3 object when you upload it, so you already have the information you need to know what the public url will be once uploaded, its not like s3 assigns a new unique name to your object once uploaded.","Q_Score":0,"Tags":"python,mongodb,amazon-web-services,amazon-s3,boto3","A_Id":67125119,"CreationDate":"2021-04-16T07:29:00.000","Title":"How to upload an image to MongoDB using an S3 bucket and Boto3 in Python","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"since i couldn't find the best way to deal with my issue i came here to ask..\nI'm a beginner with Python but i have to handle a large dataset.\nHowever, i don't know what's the best way to handle the \"Memory Error\" problem.\nI already have a 64 bits 3.7.3 Python version.\nI saw that we can use TensorFlow or specify chunks in the pandas instruction or use the library Dask but i don't know which one is the best to fit with my problem and as a beginner it's not very clear.\nI have a huge dataset (over 100M observations) i don't think reducing the dataset would decrease a lot the memory.\nWhat i want to do is to test multiple ML algorithms with a train and test samples. I don't know how to deal with the problem.\nThanks!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":61,"Q_Id":67126819,"Users Score":0,"Answer":"This question is high level, so I'll provide some broad approaches for reducing memory usage in Dask:\n\nUse a columnar file format like Parquet so you can leverage column pruning\nUse column dtypes that require less memory int8 instead of int64\nStrategically persist in memory, where appropriate\nUse a cluster that's sized well for your data (running an analysis on 2GB of data requires different amounts of memory than 2TB)\nsplit data into multiple files so it's easier to process in parallel\n\nYour data has 100 million rows, which isn't that big (unless it had thousands of columns). Big data typically has billions or trillions of rows.\nFeel free to add questions that are more specific and I can provide more specific advice. You can provide the specs of your machine \/ cluster, the memory requirements of the DataFrame (via ddf.memory_usage(deep=True)) and the actual code you're trying to run.","Q_Score":0,"Tags":"python,pandas,tensorflow,out-of-memory,dask","A_Id":69481669,"CreationDate":"2021-04-16T14:12:00.000","Title":"Import and work with large dataset (Python beginners)","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I am tinkering with redis and mysql to see how caching can improve performance. Accesing data from Cache is\/should be faster than accessing it from database.\nI calculated the time required for both the case in my program and found out that accesing from cache was much slower than accesing from the database . I was\/am wondering what might be the cause(s).\nSome points to consider:\n\nI am using Azure Redis Cache.\nThe main application is on VM instance.\nI hosted MYSQL server on another VM instance.\nThe table is very small with 200-300 records.\nThere is no error in the time calculation logic.\n\nEDIT:\nLoad time for cache=about 1.2s\nLoad time for mysql= about 15ms\nTurns out my application and MySQL server were in a same region while the redis cache was in a different region across the globe causing much higher latency.\nBut I would still want someone to explain why the fetch time for sql was much more smaller.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":218,"Q_Id":67141393,"Users Score":0,"Answer":"If the table of 200-300 rows is fully cached in MySQL's \"buffer_pool\", then it won't take much time to fetch all of them and send them back to the client. 15ms is reasonable (though it depends on too many things to be more specific).\nIf you are fetching 1 row, and you have an index (esp, the PRIMARY KEY) to locate that one row, I would expect it to be even faster than 15ms.\nI'm summarizing a 40K-row table; it is taking under 2ms. But note: client and server are on the same machine. 15ms could represent the client and server being a few hundred miles apart.\nHow long does a simple SELECT 1 take? That will give you a clue of the latency, below which you cannot go without changing the physical location of machines.","Q_Score":0,"Tags":"mysql,redis,mysql-python,mysql-connector","A_Id":67152749,"CreationDate":"2021-04-17T18:02:00.000","Title":"Accessing Cache Slower than Accessing Database","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":1},{"Question":"Currently, I have two python bots running on VDS, both of them are using selenium and running headless chrome to get dynamically generated content. While there was only one script, there was no problem, but now, it appears that the two scripts fight for the chrome process (or driver?) and only get it once the other one is done.\nHave to mention, that in both scripts, Webdriver is instantiated and closed within a function, that itself is ran inside a Process of multiprocessing python module.\nRunning in virtual environment didn't do anything, each script has their own file of chrome driver in their respective directories, and by using ps -a I found that there are two different processes of chromedriver running and closing, so I am positive that scripts aren't using the same chrome. \nSometimes, the error says \"session not started\" and sometimes \"window already closed\".\n\nMy question is - how do I properly configure everything, so that the scripts don't interfere with each other?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":47,"Q_Id":67144301,"Users Score":0,"Answer":"For anyone having the same problem - double-triple-quadriple-check that the function, that you're passing in the Process, is the one instantiating Webdriver. I can't believe this problem is fixed just like that.","Q_Score":2,"Tags":"python,selenium,selenium-webdriver,python-multiprocessing,ubuntu-18.04","A_Id":67184590,"CreationDate":"2021-04-18T00:50:00.000","Title":"How to manage several selenium scripts running at once on VDS?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"I'm new to LDA and I want to calculate the topic similarity between words. Can I get the topic distribution of a word? If so, how can I do this in gensim.ldamodel?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":92,"Q_Id":67148633,"Users Score":0,"Answer":"Gensim's LDA mallet wrapper has a load_word_topics() function (I would assume this is true for its python LDA implementation as well). It returns a matrix that is words X topics. From that, you can get a vector of frequencies each word in each topic. That would be the topic-word distribution for a given word.","Q_Score":0,"Tags":"python,gensim,lda,topic-modeling","A_Id":67153031,"CreationDate":"2021-04-18T12:40:00.000","Title":"Can I get topics distribution of a word in LDA?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I have a template where I'm showing with a 'for' my elements, and those elements have a Edit button, so what I want to do, is when the user clicks edit, a pop up appears with the form and the information of that item.\nSo I don't know how to do that:(","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":29,"Q_Id":67154813,"Users Score":0,"Answer":"so if you are using Javascript in your template then you can get the row index of clicked button and then get information from there and bind it to your popup.","Q_Score":1,"Tags":"python,django,popup","A_Id":67154916,"CreationDate":"2021-04-19T01:04:00.000","Title":"How can I pass information from an item to a Modal in django to edit it?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I would like to know how to get the first message in a channel.\nBut more preferably could you point me to the part of the documentation that explains this, please?","AnswerCount":1,"Available Count":1,"Score":0.3799489623,"is_accepted":false,"ViewCount":511,"Q_Id":67154885,"Users Score":2,"Answer":"TextChannel has a history method.\nIf you type await channel.history() you can get all messages in that text channel. But this starts from last message. To start from first message, use oldest_first=True in method. Also you can limit the amount of message with a keyword argument limit.","Q_Score":0,"Tags":"python,python-3.x,discord,discord.py","A_Id":67155078,"CreationDate":"2021-04-19T01:17:00.000","Title":"How to get the first message in a channel","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I work on one project in that code in python script.py and with help of pyinstaller build exe file but issue is that I want to add publisher name in exe file. FREE\nexe with publisher name\nI browse on google but I do not get a solution.\n\ni don't have a code sign certificate.\nI don't have a signtool\ni don't know how to connect a self sign certificate with an exe file.\n\nPlease guide me.","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1068,"Q_Id":67162747,"Users Score":0,"Answer":"There is no way to do this for free. If you want to sign your executables, you will need to buy a code-signing certificate and use signtool to sign them. Code signing certificates cost about $300 per year. signtool is part of the Windows SDK; you can get it in the free \"community\" editions of Visual Studio.","Q_Score":0,"Tags":"python,windows-installer,pyinstaller,signtool","A_Id":67173656,"CreationDate":"2021-04-19T13:14:00.000","Title":"how to add Publisher Name in Pyinstaller exe file","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Please can you provide an example of how this can used in a python notebook environment with docplex. I see examples with java on ATSP problem. The point is I do not know how to create these cuts upfront. Given a LP root node, I can generate the cut. So, \"add_user_cut_constraint(cut_ct, name=None)\" should in a way take in as input the root node. How do I retrieve that in a generic way?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":73,"Q_Id":67163382,"Users Score":0,"Answer":"Look at this code in my contribs repository:\nhttps:\/\/github.com\/PhilippeCouronne\/docplex_contribs\/blob\/master\/docplex_contribs\/src\/cut_callback.py\nIt is not a notebook, but you'll get the idea on how to interface callbacks with Docplex.","Q_Score":0,"Tags":"python,jupyter-notebook,docplex","A_Id":67165020,"CreationDate":"2021-04-19T13:54:00.000","Title":"Examples in docplex to use the user cut callback method technology","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"OOBPermutedVarDeltaError states that\n\nFor any variable, the measure is the increase in prediction error if the values of that variable are permuted across the observations. This measure is computed for every tree, then averaged over the entire ensemble and divided by the standard deviation over the entire ensemble\n\nTo find its equivalent would I need to calculate the increase in prediction error across observations and then average it across the entire ensemble? Being fairly new to ML, I am not sure how I would implement it even. Any help would be most appreciated.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":26,"Q_Id":67172243,"Users Score":0,"Answer":"No, there arent any. Python and Matlab, does not scale 1:1","Q_Score":1,"Tags":"python,matlab","A_Id":72350666,"CreationDate":"2021-04-20T03:57:00.000","Title":"Is there any python equivalent of OOBPermutedVarDeltaError from Matlab?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":1,"REVIEW":0},{"Question":"recently I made a little program that generates a country with a bit of info, like the country name, size and most importantly cities.\nIt generates a random number of cities and towns and villages based on the country's size, this is all text based so that is why I would give it a nice flare with some graphics.\nNow, I have been researching a bit and it seems that my best option would be Perlin noise or some form of noise, so my question is, how would I go about doing this? Where do I start? Are there other ways of accomplishing this?\nSo, in short, how do I take the randomly generated text cities and towns and villages in my program and randomly generate them on some form of map? I hope this all makes sense. Also, my program is written in python.","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":181,"Q_Id":67176945,"Users Score":1,"Answer":"There is lots of problem in what you saying. What platform are you using? Arcade? PyGame? etc. I will write the arcade code for you so you can use. To use arcade, type pip install arcade in Windows, or pip3 install arcade on Linux.\nEdit:\nPlease can you post your code so I can implement?","Q_Score":0,"Tags":"python,noise","A_Id":67177343,"CreationDate":"2021-04-20T10:17:00.000","Title":"How would I go about generating cities and countries with perlin noise?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I would like to generate some data (position of the snake, available moves, distance from the food...) to create a neural network model so that it can be trained on the data to play the snake game. However, I don't know how to do that. My current ideas are:\n\nPlay manually (by myself) the game for many iterations and store the data (drawback: I should play the game a lot of times).\nMake the snake do some random movements track and track their outcomes.\nPlay the snake with depth-fist search or similar algorithms many times and store the data.\n\nCan you suggest to me some other method or should I choose from one of those? Which one in that case?\nP.S. I don't know if it is the right place to ask such a question. However, I don't know whom\/where to ask such a question hence, I am here.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":109,"Q_Id":67177184,"Users Score":1,"Answer":"If using a neural network, start simple. Think inputs and outputs and keep them simple too.\nInputs:\n\nHow many squares to the left of the head are free\nHow many squares to the right of the head are free\nHow many squares forward of the head are free\nRelative position of next food left\/right\nRelative position of next food forward\/back\nLength of snake\n\nkeep inputs normalized to the minimum and maximum possible values to keep inputs in range -1.0 to 1.0\nOutputs:\n\nTurn Left\nTurn Right\nStraight Ahead\n\n(choose the output with highest activation)\nNext problem is training. Typical application might be use a genetic algorithm for all the weights of the above neural network. This randomizes and tests new versions of the neural network every life. After X attempts, create a new evolution and repeat to improve. This is pretty much doing random moves automatically (your second choice)\nNext problem is fitness for training. How do you know which neural network is better? Well you could simply use the length of the snake as a fitness factor - the longer the snake, the better and more 'fit'","Q_Score":0,"Tags":"python,neural-network,reinforcement-learning","A_Id":67346604,"CreationDate":"2021-04-20T10:33:00.000","Title":"Generate the data for A.I. to play the Snake game","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Is there a way to add a comment to an order's timeline via the REST API ?\nIf so, what's the scope access ? And how to do this.\nThanks","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":683,"Q_Id":67186251,"Users Score":2,"Answer":"You cannot add a comment to the timeline. You can see your App's interactions with an order on the timeline, exposed by Shopify, but you cannot inject stuff yourself. If you want to decorate an order with comments, you would add your comment to the order notes. That works fine, but as you can tell, it is not timestamped by Shopify, so it lacks an \"official\" standing... nonetheless. Just use Notes.","Q_Score":1,"Tags":"python,rest,shopify,shopify-api","A_Id":67187016,"CreationDate":"2021-04-20T20:56:00.000","Title":"Add comment to an order's timeline in Shopify","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"So in my table there are a number and a timestamp row, there are multiple numbers per day\nits like:\n\n\n\n\nnumber\ntimestamp\n\n\n\n\n3\n20.02.2021 16:05:00\n\n\n7\n20.02.2021 16:10:00\n\n\n20\n20.02.2021 16:15:00\n\n\n5\n21.02.2021 16:00:00\n\n\n\n\nnow i want the average of the numbers of the day of 20.02.2021 but i don't know how i should do that with SQLAlchemy\nany suggestions?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":38,"Q_Id":67194732,"Users Score":0,"Answer":"Not sure if this will fully answer your question, but to get just the date portion of a timestamp you can recast the timestamp as date by:\nselect your_timestamp_column::date","Q_Score":0,"Tags":"python,postgresql,flask,sqlalchemy","A_Id":67195487,"CreationDate":"2021-04-21T11:13:00.000","Title":"How to query only the date in a timestamp","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to make a small data science tool (kinda like a mini version of WEKA). Now, I have these datasets that have large amounts of features (70-100+), and they're mostly categorical. I'm using Python sklearn for the Machine Learning logic and I need to convert these categories into numeric values according to the sklearn errors I've gotten.\nGiven this, One Hot Encoding isn't an option because it will enlarge the dimensionality too much.\nI've researched other ways that may work like frequency encoding, label encoding, etc. But I'm not really sure what to choose in my case.\nAlso, would anyone know how WEKA actually handles these? I inputted my datasets in WEKA and they worked fine, they gave me good results!\nAny help would be greatly appreciated. Thanks!","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":147,"Q_Id":67197522,"Users Score":0,"Answer":"That depends on the algorithm: Some handle categorical attributes natively, like J48 (Weka's C4.5 implementation), which performs multi-way splits on categorical attributes. Others have to convert the data, like SMO (support vector machine), which binarizes nominal attributes and increases the number of attributes to learn from.","Q_Score":0,"Tags":"python,machine-learning,scikit-learn,weka,categorical-data","A_Id":67203824,"CreationDate":"2021-04-21T14:07:00.000","Title":"What is the best way to encode a large number of categorical features?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":1},{"Question":"I have a programming project in mind, but have only scratched the surface of my programming experience. I'm just about done with my first Python class, so that's about how much experience I have.\nNow my question, is it possible to read and recognize an image (business card\/playing card\/ image with text) and produce an operation based on the information read? The image would be at a distance, and I would be using a camera or xbox kinect.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":20,"Q_Id":67199323,"Users Score":0,"Answer":"yeah it's possible, you can train machine learning models.","Q_Score":3,"Tags":"python,image,image-processing","A_Id":67199350,"CreationDate":"2021-04-21T15:56:00.000","Title":"Recognizing images and incorporating into code","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to create something and I don't know if it's possible or \"clean\" :\n\nFrom python, call function A of my C++ code to compute something complicated\nThe C++ code returns just the pointer to the python\nDo other things in python...\nFrom python, call function B of my C++ code, it takes the pointer and other things as arguments.\n\nI really don't need to use my complicated C++ class in my Python algorithm, that's why I just want to save the pointer in python.\nAnyone has any advice on how to do that ?\nEdit : In the end I wrapped the c++ class in python, thank you everyone.","AnswerCount":2,"Available Count":2,"Score":1.2,"is_accepted":true,"ViewCount":66,"Q_Id":67227334,"Users Score":1,"Answer":"A pointer is just data that can be marshaled and sent to anything. It is however a very bad idea because when doing that, you have to assure that that pointer remains valid as long as the python part has the pointer. There is no possibility to check whether the pointer is still valid, so dereferencing a pointer that you receive from an external party could crash your program.\nA better idea in a lot of situations is to send a key to a table. When that key is sent back, it can be used to get the needed information from that table and it can be handled when the table doesn't have the key anymore. It is easiest to use std::map for the table. Of course, you could store the pointer in a container and check for that, but a string or number is easier to debug.","Q_Score":1,"Tags":"python,c++,cython","A_Id":67227563,"CreationDate":"2021-04-23T09:22:00.000","Title":"How save a C++ pointer in python to pass it again later?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm trying to create something and I don't know if it's possible or \"clean\" :\n\nFrom python, call function A of my C++ code to compute something complicated\nThe C++ code returns just the pointer to the python\nDo other things in python...\nFrom python, call function B of my C++ code, it takes the pointer and other things as arguments.\n\nI really don't need to use my complicated C++ class in my Python algorithm, that's why I just want to save the pointer in python.\nAnyone has any advice on how to do that ?\nEdit : In the end I wrapped the c++ class in python, thank you everyone.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":66,"Q_Id":67227334,"Users Score":0,"Answer":"It would be better to create a class in C++ and store that pointer in the class itself as private. Then create function calls to access those pointers.\nOnce the class is implemented generate the .so file of your lib and import it in python. This way you can simply use your C++ code in python and also will not have to save the pointer.","Q_Score":1,"Tags":"python,c++,cython","A_Id":67227731,"CreationDate":"2021-04-23T09:22:00.000","Title":"How save a C++ pointer in python to pass it again later?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":1,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I can't figure out how to write regex that matches these:\n\neveryone hi\nhi everyone\nhi\n\nBut not this:\n\neveryone hi everyone\n\nThe regex (?:everyone )?hi(?: everyone)? will match the latter as well (which is not what I want). How to make such a regex? Or is it just not possible? I couldn't do enough research because I couldn't express the problem in correct words. Sorry if I posted a duplicate","AnswerCount":3,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":67,"Q_Id":67232268,"Users Score":3,"Answer":"You could explicitly make a regex for each case (the first will capture two), utilizing beginning and end of line tokens\n(^hi( everyone)?$)\n(^everyone hi$)","Q_Score":4,"Tags":"python,regex","A_Id":67232530,"CreationDate":"2021-04-23T14:57:00.000","Title":"Regex match no groups, 1st group OR 2nd group but not both. Something like 'NAND'","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"can anyone tell me how to fix this?\nModuleNotFoundError: No module named 'sklearn.linear_model._logistic'\nFile \"c:\\users\\chintan\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\streamlit\\script_runner.py\", line 332, in _run_script\nexec(code, module.dict)\nFile \"C:\\Users\\chintan\\Desktop\\streamlit\\Final_year_project\\App.py\", line 329, in \nmain()\nFile \"C:\\Users\\chintan\\Desktop\\streamlit\\Final_year_project\\App.py\", line 264, in main\nloaded_model = load_model(\"logistic_regression_hepB_model.pkl\")\nFile \"C:\\Users\\chintan\\Desktop\\streamlit\\Final_year_project\\App.py\", line 96, in load_model\nloaded_model = joblib.load(open(os.path.join(model_file),\"rb\"))\nFile \"c:\\users\\chintan\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\sklearn\\externals\\joblib\\numpy_pickle.py\", line 588, in load\nobj = _unpickle(fobj)\nFile \"c:\\users\\chintan\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\sklearn\\externals\\joblib\\numpy_pickle.py\", line 526, in _unpickle\nobj = unpickler.load()\nFile \"c:\\users\\chintan\\appdata\\local\\programs\\python\\python37\\lib\\pickle.py\", line 1088, in load\ndispatchkey[0]\nFile \"c:\\users\\chintan\\appdata\\local\\programs\\python\\python37\\lib\\pickle.py\", line 1376, in load_global\nklass = self.find_class(module, name)\nFile \"c:\\users\\chintan\\appdata\\local\\programs\\python\\python37\\lib\\pickle.py\", line 1426, in find_class\nimport(module, level=0)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":131,"Q_Id":67235806,"Users Score":0,"Answer":"Try to install a version like: pip install scikit-learn==0.22","Q_Score":0,"Tags":"python,scikit-learn","A_Id":67241490,"CreationDate":"2021-04-23T19:24:00.000","Title":"getting an issue in sklearn.linear_model._logistic in ml","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":1,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I am working on a project that just scrapes data from 3 devices (2xserial and 1xssh). I have this part implemented no problem.\nI am now heading towards the second part where I need be be able to send the data I need using protobuf to the clients computer where they will receive and display on their own client.\nThe customer has provided examples of their GRPC servers, and it's written in C#.\nCurrently, for security reasons, our system uses RedHat 8.3 and I am using a SSH Protocol Library called Paramiko for the SSH part. Paramiko is a Python library. Also the machine I am extracting data from only runs on Linux.\n\nHere are my main questions, and I apologize if I got nowhere.\n1.) The developer from the client side provided us with a VM that has a simulator and examples written in C# since their side was written in C#. He says that it's best to use the C# because all examples can be almost re-used as it's all written, etc. While I know it's possible to use C# in Linux these days, I've still have no experience doing so I don't know how complicated\/tedious this can get.\n2.) I write code in C# and wrap all the python code, which is also something I've never done, but I would be doing this all in RedHat.\n3.) I keep it in python because sending protobuf messages works across languages as long as it is sent properly. Also from the client side, I'm not sure if they will need to make adjustments if receiving protobuf messages written in Python(I don't think this is the case because it's just serialized messages, yea?).\nAny advice would be appreciated. I am looking to seek more knowledge outside my realm.\nCheers,\nZ","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":332,"Q_Id":67237330,"Users Score":0,"Answer":"If you're happy in Python, I would use option 3. The key thing is to either obtain their .proto schema, or if they've used code-first C# for their server: reverse-engineer the schema (or use tools that generate the schema from code). If you only have C# and don't know how to infer a .proto from that, I can probably help.\nThat said: if you want to learn some new bits, option 1 (using C# in your system) is also very viable.\nIMO option 2 is the worst of all worlds.","Q_Score":1,"Tags":"python,c#,protocol-buffers,grpc,redhat","A_Id":67240519,"CreationDate":"2021-04-23T22:05:00.000","Title":"GRPC: Sending messages from Python to C#, best method?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Python: how to get unique ID and remove duplicates from column 1 (ID), and column 3 (Description), Then get the median for column 2\n\n\n\n\nID\nValue\nDescription\n\n\n\n\n123456\n116\nxx\n\n\n123456\n117\nxx\n\n\n123456\n113\nxx\n\n\n123456\n109\nxz\n\n\n123456\n108\nxz\n\n\n123456\n98\nxz\n\n\n121214\n115\nabc\n\n\n121214\n110\nabc\n\n\n121214\n103\nabc\n\n\n121214\n117\nabz\n\n\n121214\n120\nabz\n\n\n121214\n125\nabz\n\n\n151416\n114\nzxc\n\n\n151416\n135\nzxc\n\n\n151416\n127\nzxc\n\n\n151416\n145\nzxm\n\n\n151416\n125\nzxm\n\n\n151416\n121\nzxm\n\n\n\n\nProcced table should look like:\n\n\n\n\nID\nxx\nxz\nabc\nabz\nzxc\nzxm\n\n\n\n\n123456\n110\n151\n0\n0\n0\n0\n\n\n121214\n0\n0\n132\n113\n0\n0\n\n\n151416\n0\n0\n0\n0\n124\n115","AnswerCount":4,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":180,"Q_Id":67243543,"Users Score":0,"Answer":"Well you have e.g. 6 'ID' with value '123456'. If you only want unique 'ID', you need to remove 5 'ID' rows, by doing this you will not have duplicate 'Description' values anymore. The question is, do you want unique ID or unique Description values (or unique combination of both)?","Q_Score":0,"Tags":"python","A_Id":67244109,"CreationDate":"2021-04-24T13:54:00.000","Title":"Python: how to get unique ID and remove duplicates from column 1 (ID), and column 3 (Description), Then get the median for column 2 (Value) in Pandas","Data Science and Machine Learning":1,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm running a jupyter notebook remotely on a server by\n\nconnecting to the server: ssh server:address\ninitialize the jypter notebook ipython notebook --no-browser --port=7000\nusing another terminal window, stabilish remove connection to the notebook ssh -N -f -L localhost:6001:localhost:7000 server:address \nfinally I access it throw localhost:6001 in my browser.\n\nThe thing is: I'd like to keep the notebook running when I turn my computer off. Any ideas on how can I do it?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":200,"Q_Id":67253338,"Users Score":0,"Answer":"You could create a crontab on your remote server with your command ipython notebook --no-browser --port=7000 to manage the execution of Jupiter notebook, that could be the way go.","Q_Score":1,"Tags":"python,ssh,jupyter-notebook,remote-access","A_Id":67253456,"CreationDate":"2021-04-25T12:20:00.000","Title":"Jupyter Notebook remote browser without disconnecting","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm not sure what to search for this.\nI am writing a piece of code using python fire to create a command line interface.\npython test.py function argument\nis there a way to make the shell interpret the following like the command above:\ntest function argument\nSimilar to how I can just call jupyter lab and it will open a notebook etc.\nI have a feeling this is more to do with setting up my bashrc or similar instead of something I can do in Python.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":52,"Q_Id":67258005,"Users Score":0,"Answer":"Add the hashbang (at the start of the file, in case you don't know) \n#!\/usr\/bin\/env python \nor\n#!\/usr\/bin\/env python3\nReplace the 3 with whatever version you have installed and want that file to run\nSave the file to an already existing PATH or add the file location to PATH\nNow you can hopefully run it by typing test.py function argument\nRename test.py to test \nNow you should be able to run it as test function argument\nAlso make sure your file is set as executable","Q_Score":1,"Tags":"python,linux,python-fire","A_Id":67258132,"CreationDate":"2021-04-25T20:32:00.000","Title":"Command line interface for python module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm not sure what to search for this.\nI am writing a piece of code using python fire to create a command line interface.\npython test.py function argument\nis there a way to make the shell interpret the following like the command above:\ntest function argument\nSimilar to how I can just call jupyter lab and it will open a notebook etc.\nI have a feeling this is more to do with setting up my bashrc or similar instead of something I can do in Python.","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":52,"Q_Id":67258005,"Users Score":0,"Answer":"You're correct that it has to do with adding to your .bashrc. You want to set an alias.\n\nMake sure your code has an appropriate shebang line at the top, ex. #!\/usr\/bin\/python3\nAdd the following to .bashrc, ex. alias test=python3 \/path\/to\/test.py\n\nFrom there, you can use sys.argv in your code to handle arguments within the program.","Q_Score":1,"Tags":"python,linux,python-fire","A_Id":67258041,"CreationDate":"2021-04-25T20:32:00.000","Title":"Command line interface for python module","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"We know that when generating a class in Python2, if there is a metaclass attribute, it will be generated by the metaclass referenced by the attribute. Bug when the class is not generated, it should have no attribute, how does it control the generation of the class?","AnswerCount":2,"Available Count":1,"Score":0.2913126125,"is_accepted":false,"ViewCount":37,"Q_Id":67267316,"Users Score":3,"Answer":"Because the body of the class definition statement is evaluated before the creation of the class object.\nSo indeed, the class doesn't have that attribute, the class doesn't even exist yet. But the class definition statement has been evaluated.","Q_Score":0,"Tags":"python,python-2.x,metaclass","A_Id":67267545,"CreationDate":"2021-04-26T13:12:00.000","Title":"If __metaclass__ is a class attribute, how does it control the generation of the class?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Can you advise me on the analogs of the socket library on Python? The task is this, I need to write a very simple script with which I could execute remote commands in cmd windows. I know how this can be implemented using the socket library, but I would like to know if there are any other libraries for such a case.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":33,"Q_Id":67272337,"Users Score":0,"Answer":"Sockets is a low level mechanism by which two systems can communicate each other. Your OS provides this mechanism, there's no analogs.\nNext examples come from the application layer and they work with sockets in their lower communication layers: a socket open by your http server, usually 80 or 443 or a websocket open by your browser to communicate with your server. Or the DNS query that your browser executes when tries to resolve a domain name, also works with sockets between your PC and the DNS server.","Q_Score":0,"Tags":"python,sockets","A_Id":67279572,"CreationDate":"2021-04-26T19:00:00.000","Title":"analogs of socket in python","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I'm currently dealing with a material science dataset having various information.\nIn particular, I have a column 'Structure' with several pymatgen.core.Structure objects.\nI would like to save\/store this dataset as .csv file or something similar but the problem is that after having done that and reopening, the pymatgen structures lose their type becoming just formatted strings and I cannot get back to their initial pymatgen.core.Structure data type.\nAny hints on how to that? I'm searching on pymatgen documentation but haven't been lucky for now..\nThanks in advance!","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":104,"Q_Id":67283018,"Users Score":2,"Answer":"pymatgen.core.structure object can be stored with only some sort of fixed format, for example, cif, vasp, xyz... so maybe you, first, need to store your structure information to cif or vasp. and open it and preprocess to make it \"csv\" form with python command.(hint : using python string-related command).","Q_Score":0,"Tags":"python,pandas,dataframe,encoding,pymatgen","A_Id":69388052,"CreationDate":"2021-04-27T12:25:00.000","Title":"Saving\/Storing pymatgen Structures","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"I want to make a bot with discord.py that can stream videos from mp4 into a voice channel. Is it possible? and if it is possible how would I be able to do it (and sorry if this is a stupid question i am a beginner)","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":104,"Q_Id":67286450,"Users Score":0,"Answer":"At the moment it isn't possible, you can only stream audio.","Q_Score":1,"Tags":"python,discord.py","A_Id":67286558,"CreationDate":"2021-04-27T15:50:00.000","Title":"how to make a video stream bot for discord.py?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":1,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"my goal is to make a bot that is able to show youtube videos through screen sharing or camera. Does anyone know how to do it?\nI tried to find out how to do it but I have not managed to find something similar on internet, even on stack overflow.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":100,"Q_Id":67299823,"Users Score":0,"Answer":"It happens that zoom will share a video in the way that you want.","Q_Score":0,"Tags":"python,api,youtube","A_Id":67604712,"CreationDate":"2021-04-28T11:58:00.000","Title":"how to make a discord bot in python that can show a youtube video?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":1,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":0,"API_CHANGE":0,"API_USAGE":1,"CONCEPTUAL":0,"DISCREPANCY":0,"DOCUMENTATION":0,"ERRORS":0,"REVIEW":0},{"Question":"Let's say i need to have the javascript in a seperate file, then how can i add a {{variable}} for example in the javascript file without having to use a