Newest python Questions

Q&A for system and network administrators

Upload to S3 bucket slows over time

I'm part way through uploading about 200,000 files (each is ~1MB max) to an S3 bucket from an EC2 instance (both in Europe West). From monitoring the EC2 with CloudWatch (looking at the NetworkOut ...

How do I run multiple on-going python scripts that might be changed in the future?

In a prod environment, I want to run some python scripts that run on start-up and never stop. Currently I am trying to run them as daemon processes, i.e. something like this in systemd: #!/bin/bash ...

Large number of apache virtualhosts: Python mod_wsgi vs PHP

I have a large number of low-traffic sites I'd like to host on the same Apache server, as many as 500 sites. Currently, I'm powering the pages with PHP and I have a different virtualhost set up for ...

Interprocess communication with uWSGI

I have a uWSGI application that accepts data over the internet and another process that responds to that data in a queue-like fashion. I send want to send data from the uWSGI application to the second ...

Packet fragmentation confusion

I was playing around with dpkt in Python, trying to decode PPPoE - and the program was working just fine, till I noticed that the Offset in the encapsulation IP packets was always 0, even with clearly ...

Apache wsgi python errro log full of [wsgi:error] withtout explanation

I've a server running django with mod-wsgi checking my apache error log i see an entry for every page hit on the server. Everything works fine the error log is full of messages like this: [Sat Dec ...

How upgrade version pip by proxy?

for my task need install pywin32 pack. Python can install new pack only by proxy. pip --proxy http://<username>:<password>@<hostname>:<port> install pywin32 But installing ...

Make CherryPy init.d script not return until fully launched?

I have a number of CentOS 6 init.d scripts I have written to launch Python CherryPy based web apps. The problem I am having is that when the script is executed, it starts the app and then immediately ...

Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource

I have done a fair bit of searching for the past few days and I can not get this to work properly. I am using AngularJS & Webapp2 Python (Google App Engine). I am using a factory resource: app....

Unable to reach a python flask-enabled web server on gce

I am running a very simple http server on a VM in GCE. The code is very simple from flask import Flask, render_template, request, json, abort app = Flask(__name__) @app.route('/', methods=['GET']) ...

How to access flask website with apache server on LAN [closed]

i have a flask website with apache server.I can access the site with its ServerName and when i tried using the ip http://127.0.0.1 and http://192.168.1.4, it shows apache default webpage. I cant ...

Mask URL for a Django + Ember Web Application

Background: I have a web-app running on my server with Django (for the backend) and Ember (for the frontend). I recently bought a domain (for example... newdomain.com) on godaddy and I am trying to ...

Python hangs while importing module under Lustre filesystem

I am noticing that my python script is getting stuck while importing simple modules within lustre filesystem of the cluster that I run on. This is reproduced by the following simple example: main.py ...

'netcat -e' not relaying output

I'm using netcat to create a backdoor running a python script with the following command: netcat -l -p 1234 -e 'python /script.py' then I'm connecting to the backdoor with another shell using: ...

Connect to DigitalOcean MongoDB droplet through PyMongo [on hold]

I have a Digital Ocean MongoDB 3.4.2 Droplet, running on Ubuntu 16.04. My laptop is running Windows 10 and what I want to do is to be able to connect from it via a Python script using PyMongo to read ...

Adding CentOS 6.8 Client to Spacewalk

I'm trying to add a CentOS 6.8 client to Spacewalk 2.6 to I can push out updates. In order to add the client I need to first install some packages: rhn-client-tools rhn-check rhn-setup rhnsd m2crypto ...

In setting up a Django host, migrate.py often fails to create a .sock file

I am learning to use Django on Nginx. To set up a new host at sitename.com I do: ~$ mkvirtualenv sitename ~$ pip install Django ~$ django-admin.py startproject sitename ~$ cd sitename ~$ ./manage.py ...

How to create a background service on linux with chef?

I have a Python script that I'm executing using screen on an ubuntu host, and I want to turn that into a proper background service using a Chef recipe. The python script just starts up an SMTP server ...

Using IP Address In Nginx server_name I Django

I'm using django, uwsgi and nginx. I have tried nginx and django documentation for serving static files. My conf file is: http { upstream django { server 127.0.0.1:8000; } server { listen ...

Writing a pam_python module: “KeyError: getspnam(): name not found”

I'm using a pam_python module to log usernames and passwords used in SSH attempts. in /etc/pam.d/sshd I added this line: auth requisite pam_python.so /lib64/security/pwreveal.py This is /...

rsync-path: No such file or directory when used with subprocess.Popen

I use rsync to deploy code from one server to another. On a staging directory I build the application by placing all files (e.g. php scripts) like they should appear on the remote application server (...

Cannot update LDAP admin password

I have the following python script to update LDAP password. import ldap from ldap import LDAPError user_dn = "CN=******,OU=Admins,OU=Example Users,DC=Example,DC=com" old_password = "pass01" ...

Cloud SQL periodic issues connecting OperationalError: (2062, 'Cloud SQL socket open failed with error: Transport endpoint is not connected')

Periodically connection attempts to the 2nd Gen MySQL server receives this error: OperationalError: (2062, 'Cloud SQL socket open failed with error: Transport endpoint is not connected') This will ...

Limit download size [closed]

Is there a way to limit the downloading total amount of data through a network interface? Can tc do it? Or we have to develop our own script to limit total download size? If so which language is most ...

Systemd : Run a Python Script At Startup (virtualenv)

I have a python script that I normally run it with this command: (environment) python run.py I want to run this script at start. (I'm using ubuntu) Here is my service: [Unit] Description=My Script ...

Why is posix.lstat taking such a long time? (duplicity backing up of 9p virtio filesystem)

I have a filesystem mounted with 9p virtio through KVM, and am backing it up using duplicity to a remote SSH server. I' m trying to speed up the backup process, which seems unreasonably slow to me. ...

Ganglia unable to create tcp accept channel receiving NaN on graphs

Just recently, I started receiving errors for Ganglia and now on my graphs I am seeing NaN for all of the nodes except for one of them. The node that doesn't have the NaN issue is the one hosting the ...

How do I loop over items 1 by 1 in Ansible config (YAML/Jinja2)?

I am trying to loop over my hosts from my inventory in Ansible, and use the name of the host of that iteration in a command. In particular, I am trying to set the hostname of each of my hosts to ...

Restarting nginx&gunicorn without sudo

Can I run systemctl restart gunicorn && systemctl restart nginx without sudo? Currently I get: out: Authentication is required to reload 'gunicorn.service'. out: Authenticating as: ...

deploy Django 1.10 project with Python 3.5 to Azure

just wanna know if I can deploy Django 1.10 project with Python 3.5 to Azure Cloud? I mean, I do not develop it using Visual Studio but only text editor (Atom or Sublime),,thank you

python uwsgi not loading changes

i am using uwsgi to serve python application. app was using a particular vrsion of falcon python now i upgraded the package by removing it and reinstalling it. but the change is not reflected by the ...

Why is my Windows BuildBot service failing immediately with error 7000?

I'm setting up a BuildBot worker in a Windows Server 2016 Datacenter Edition VM running on Azure. This is going build our product for Windows, using the Visual Studio C++ compiler. I've got to the ...

ec2: after moving eni, can connect to mysql from command line but not from python app

We had an interesting failure during a routine DB upgrade yesterday that I'm not sure how to debug. Setup: Rebuild new master DB, run a script from the new host to attach the ENI to the new host ...

ModSecurity: Warning. Operator EQ matched 0 at REQUEST_HEADERS

im running a python/django website on apache and modwsgi i've been looking trough my error log and i have tons of this( i had to delete bunch of them in the middle becuz of posting limitation ) [...

Reverse proxy a virtual host while also hosting a directory listing?

The answers I've found re: setting up a virtualhost as a reverse proxy don't seem to be working for me. I'm trying to do something pretty simple. I want to use Apache to reverse proxy a flask ...

QGIS-Server Plugin Process per client (WMS, Apache2, FCGI)

I have a working infrastructure containing Apache2 with FCGI and QGIS-Server bundled in a Docker Container to deliver a WMS. My written Plugin (Python) for QGIS-Server is working like expected. It ...

Can this work as a Containerized Architecture for a Django/NGINX/MongoDB Web App?

I am attempting to build a reliable web App using Django and Nginx. This web app is simple in design, will be built with an MVC styled design, and needs to be secure, yet speedy. The question is ...

ImportError: No module named site. On CentOS 7 + python3.5

I'm trying to setup server few days in a row with no luck, I checked all the related topics and didn't find solution for the problem. I'm using CentOS 7, mod_wsgi, apache, python3.5 under ...

CentOS 7 / Apache / mod_wsgi - UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 2727: ordinal not in range(128)

I've deployed a Python web application (uses Pyramid) in Apache (httpd) using mod_wsgi. After starting the Apache service the error below (from Apache log) occurs when we make a http request to the ...

MemoryError when using gdb's Python extension on Jessie

In the past, I frequently used the possibility to attach gdb to a running Python process and use the py-* extensions for debugging. However, since Debian Jessie, this does not work anymore and throws ...

Make a phone number ring for some time using a 56KB modem [migrated]

we have an old modem model US Robotics Sportster Flash and we'd need to use it to open a door in our organization, by making a phone call to an internal number (say, 101). We are running on an Ubuntu ...

Django 1.10.3 Apache wsgi - ImportError: cannot import name signals

Overnight django stopped working, possibly because of an automatic package upgrade on the server. Its wsgi script now fails to load in production, but running the development server works fine. What ...

Nginx uWSGI responses truncated

I tried to write a web service as a joke today at http://dont-tread-on-memes.controversial.io. It's a flask app that serves fairly large images. The Flask app works well on its own, as does an ...

Provide a web Interface for a virtual machine [closed]

We are developing software written in C with a interface for Python. Now we would like to provide an online interface where people can hack in python and testrun this code. kind of like pythonanywhere ...

IIS error 1326 when trying to chdir to mapped drive

I'm trying to run a Django app over IIS 8 on Windows Server 2012. When the program tries to change to a directory on the database server, which also has a drive mapped to it, error 1326 occurs, ...

why yum could not find the python-pip packages on some PCs

I got a very strange problem and cannot figure out why. When I run yum info python-pip command on some CentOS 7 machines, it returns Error: No matching Packages to list. But, I used to install python-...

Apache ignores WSGIScriptAlias if same directory exists in root

I notice a peculiar error when serving Django app through mod_wsgi. In my document root, I have /admin directory that is restricted to 127.0.0.1 using LocationMatch directive. I also have /admin ...

python script runs to completion when run manually, but hangs midway when run through systemctl service

I have a simple python script. All it does is reads an HTML file, parses it and then gives out on stdout the list of all hyperlinks present in the html file. After reading the links it stores them ...

Make Pythonanywhere web server act like Django's built in server

Django's built in server updates apps in real time. In PythonAnywhere one has to reload manually. Is there a way to make PythonAnywhere web server act like the built in feature of Django?

How Uninstall pip and python [closed]

I wanted to install version 3 of python and pip but instead issued sudo apt-get install python-pip python-dev how do I uninstall python and pip, I tried sudo apt-get uninstall but did not work, what ...
Translating... 0%