Call Python script from bash with argument

To execute a python script in a bash script you need to call the same command that you would within a terminal. For instance > python python_script.py var1 var2 To access these variables within python you will need import sys print(sys.argv[0]) # prints python_script.py print(sys.argv[1]) # prints var1 print(sys.argv[2]) # prints var2

python-dev installation error: ImportError: No module named apt_pkg

I met this problem when doing sudo apt-get update. My env is debian8, with python2.7 + 3.4(default) + 3.5. The following code will only re-create a apt_pkg….so file for python 3.5 sudo apt-get install python3-apt –reinstall The following code solved my problem, cd /usr/lib/python3/dist-packages Locate the appropriate .so file for the python version installed on … Read more

How to set the locale inside a Debian/Ubuntu Docker container?

Put in your Dockerfile something adapted from # Set the locale RUN sed -i ‘/en_US.UTF-8/s/^# //g’ /etc/locale.gen && \ locale-gen ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 If you run Debian or Ubuntu, you also need to install locales to have locale-gen with apt-get -y install locales this is extracted from the very … Read more

No module named _sqlite3

It seems your makefile didn’t include the appropriate .so file. You can correct this problem with the steps below: Install sqlite-devel (or libsqlite3-dev on some Debian-based systems) Re-configure and re-compiled Python with ./configure –enable-loadable-sqlite-extensions && make && sudo make install Note The sudo make install part will set that python version to be the system-wide … Read more

Setting Django up to use MySQL

MySQL support is simple to add. In your DATABASES dictionary, you will have an entry like this: DATABASES = { ‘default’: { ‘ENGINE’: ‘django.db.backends.mysql’, ‘NAME’: ‘DB_NAME’, ‘USER’: ‘DB_USER’, ‘PASSWORD’: ‘DB_PASSWORD’, ‘HOST’: ‘localhost’, # Or an IP Address that your DB is hosted on ‘PORT’: ‘3306’, } } You also have the option of utilizing MySQL … Read more

What is difference between arm64 and armhf?

armhf stands for “arm hard float”, and is the name given to a debian port for arm processors (armv7+) that have hardware floating point support. On the beaglebone black, for example: :~$ dpkg –print-architecture armhf Although other commands (such as uname -a or arch) will just show armv7l :~$ cat /proc/cpuinfo processor : 0 model … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)