Python is a high-level, interpreted programming language which emphasizes the clarity and readability of code. It’s popular for scripting, web development, data science, and learning to code.

Python subscription active
You will receive email notifications for new publications on Python.
276 Results
  • Question

    Unable to install pyhton 3.7 version on ubuntu 16.04 error Couldn't find any package by regex 'python3.7

    I have installed python 3 through this command sudo apt-get install python3 and when checked the version using python3 -V it was python 3.5.2 I wanted to install python version 3.7, and when tried the following sudo...
    Accepted Answer: Hello, Have you tried running python3.7 --version instead of only python3? If this still does not work what I would suggest is following these steps here: Run a quick update and install the following package: apt upd...
    1 By hayatjk Python
  • Question

    Django, React, Docker: Bad Request 400 when connecting to Django app.

    I am trying to set up a Django back-end, with a React front-end, both running inside a Docker container, using docker-compose to expose them at different ports (8000 for the Django app, 3000 for the React app. When I ...
    Accepted Answer: Here was the problem: Apparently using the .env file -- even after placing print(ALLOWED_HOSTS) to ensure the host was found -- does not actually work for some reason. I simply had to restore the ALLOWED_HOSTS setting...
    1 By jakuta Python Django React Docker
  • Question

    How to create a droplet using snapshot with digitalocean api?

    We have snapshot of droplet which is obtained using digitalocean api in python. We want to create a droplet using the snapshot. How to do it using digitalocean api?
    Accepted Answer: Hello, @onurene22 To launch a new droplet based on a snapshot, you need to supply it’s ID for the image parameter: curl -X POST -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $TOKEN' -d \ '{...
    1 By onurene22 API Python Load Balancing
  • Question

    How to reboot a Droplet with DigitalOcean API - PHP, Python, BASH examples?

    Recently someone asked me how to reboot a Droplet with the DigitalOcean API so I decided to put to together a few examples on how to do that with different scripts including: PHP script Python script BASH script And l...
    Accepted Answer: According to the official API documentation, you can reboot a droplet with the following curl request: curl -X POST -H "Content-Type: application/json" \ -H "Authorization: Bearer <^>API_TOKEN_HERE<^>" \...
    1 By bobbyiliev API Python Linux Basics PHP
  • Question

    How do I code a Discord Bot in Python on an Iphone or Chromebook?

    **I am trying to code a bot for discord, but I do not have a laptop or an android. The chromebook I have is a school owned one, so things like downloads and developer mode are blocked. I can't get the linux demo eithe...
    Accepted Answer: Hi there @eX2ii2t, This error normally means that you're using a version of Python that does not support async syntax. This is normally Python 2.x Looking at the website you linked, it does indeed appear that it is us...
    1 By eX2ii2t Python
  • Question

    Python script gets killed

    I am a newbie to digitalocean. I have just created the smallest VPS and then install python, pip and all required python modules in order to move my scripts which work fine on local server. Right now, my script starts...
    Accepted Answer: If this is smallest Droplet it could that script run out of memory. You should check syslog for Out Of Memory killer. syslog is located at /var/log/syslog and you can opet it with your favourite text editor: command n...
    1 By tolgaozden77 Python Ubuntu
  • Question

    Droplet rebuild for Mezzanine project - Host key mis-match

    After running into trouble trying to put my mezzanine site up, I decided to wipe the droplet clean and rebuild it for a fresh start. I selected the same image for the droplet, and closed all SSH connections. After try...
    Accepted Answer: Hello, I would recommend trying the following: Run the following to remove the cached key: ssh-keygen -R <^>YOUR_DROPLETS_IP<^> After that test it again. Regards, Bobby
    1 By SnekGuy Python Django
  • Question

    how to deploy a flask website with phpmyadmin database?

    Hello. this is my first time deploying. Can someone tell me how to deploy a website on digital ocean. the website is in my Gitlab account as well as on my computer. I'M using xampp database. I don't know where to begi...
    Accepted Answer: There appears to be a few options you can investigate (one with Docker containers and one without). Personally, I would give the complexity of understanding Docker containers a miss and get started with Justin Ellingw...
    2 By adenmi15 Python MySQL
  • Question

    Problems with the 'How To Set Up uWSGI and Nginx to Serve Python Apps' tutorial

    I'm going this tutorial Im up to the part where this command needs to be run uwsgi --socket
    Accepted Answer: I think I have found the solution, I had followed the DO server firewall tutorial and only had ports 22 and 80 allowed with ufw so just added 8080 and now works.
    1 By easycompany80 Python Django Nginx Ubuntu
  • Question

    Please i need some assistance on publishing a Django version 2.x app on Django Droplet.

    I created a Django droplet but it runs on Django 1.x and Python 2.x. How do I point the Django project to use python 3 and Django2.x?
    Accepted Answer: To be able to use different versions of python in virtual environments, you must first install the version of python you want at the system level (without activating any environment), you can also leave the previous v...
    4 By ojebode Django Python Ubuntu
  • Question

    "Access denied for user 'root'@'localhost'" during pymysql.connections

    I tried to set up a LAMP server by following this article ( It was set up witho...
    Accepted Answer: After some research, it is solved by making a couple of changes. For errno 1698, see link ( mysql> update user set p...
    1 By lfctatung LAMP Stack Python MySQL Ubuntu 16.04
  • Question

    pip install error

    I'm trying to install some modules using the following command: pip install lxml watchdog txredisapi twistar bcrypt numpy colorlog twisted mysql-connector-python firebase-admin google-api-python-client It executes a...
    Accepted Answer: Hey friend, Try installing those one at a time and see if you can narrow down what is failing. I would suggest that one of those modules may be the culprit. Jarland
    1 By varunmalik Python Ubuntu 16.04
  • Question

    Signed URLs for private objects in Spaces

    Hi, I currently have a set of files on S3 that are private. I need to temporarily generate a public, signed URL. This works with the boto API (see the code at the end). How can I do this programmatically with Spaces? ...
    Accepted Answer: Currently pre-signed URLs generated using the AWS v4 signature type are not supported. Unfortunately, v4 signatures are the default in most places, so this can cause some issues. Luckily, most clients allow you to ove...
    4 By mikeckennedy Python Ubuntu 16.04
  • Question

    how to sync to space?

    I'm coming over from AWS where I used the cli tool to sync entire folders of files to/from buckets. I'm looking at the boto3 library and other API calls, but don't see an easy way to sync folders. Is this possible wit...
    Accepted Answer: You can use those tools with DigitalOcean Spaces!
    2 By Gills DigitalOcean Python
  • Question

    Using DigitalOcean as a VPS for Discord Bot Hosting

    Quite new to this but I'm programming a bot on Python and I want it to be hosted 24/7. Right now it only pings you back after doing a little test but I will expand the commands list and allow it play music from YouTub...
    Accepted Answer: The $5 dollar droplets (I'd imagine) should be fine for this purpose. It's possible to "resize" the droplet later on if you need to. Ubuntu is probably the most popular choice and common place to begin at if you're n...
    1 By Snoodie Python Applications
  • Question

    Can someone please help me with this question, still new at while loops

    ● Create a new file called    ● Write a program that always asks the user to enter a number.    ● When the user enters the negative number -1, the program should stop  requesting the user to enter a number,  ...
    Accepted Answer: @jessetrading1993 It is unusual to have such kind of questions here but I will give you an answer, write this in your new file and execute it with python3 ``` sum = 0 i = 0 while True: n = int(input(...
    1 By jessetrading1993 Python
  • Question

    The provided ssh_keys value must be an array.

    I'm receiving The provided ssh_keys value must be an array., and I've tried various dumping of the array of ssh key ids. using API attribute described in
    Accepted Answer: ok, figured it out! the issue is with formatting the params. it has to be like 'ssh_keys[]': [123] instead of 'ssh_keys': [123].
    3 By traumalligator API Automated Setups Ghost Python Ubuntu 18.04
  • Question

    How to connect to a remote Microsoft SQL server

    I searched the current questions and didn't find anything about connecting to a remote microsoft sql server. There are plenty of questions about mysql remote connection, but nothing for microsoft sql server. The mi...
    Accepted Answer: How did it go? Seems like the first link is correct, you'll need the pyodbc (or PyMSSQL) driver to connect to MS SQL servers. Simple example from:
    3 By whetzels1 Python Ubuntu 16.04
  • Question

    XMLHttpRequest file upload to Spaces fails due to CORS issue

    I'm trying to upload a file to Spaces using XMLHttpRequest with a pre-signed url generated by the boto3 Python library. I'm using the v2 signature type as the AWS v4 signature is not supported (yet). (https://www.digi...
    Accepted Answer: @krksgbr what a coincidence, I was just about to post the solution to my own question. It turned out not to be a CORS issue at all (sorry about that DO), but related to the way the file was sent through Javascript. Ap...
    8 By al3x5 API Python Storage Ubuntu
  • Question

    How to set uploaded files public using boto3 Python library?

    Now that I am uploading files using the boto3 Python library, I have noticed that all of the files are marked as Private. How do I upload them to be Public?
    Accepted Answer: I found my answer in using the s3cmd tool instead of boto3.
    1 By Gills Python DigitalOcean Security