I’m trying to embed a Pyhton3 program into a C++ one. After following several tutorials and blog posts I get the following code, which fails: The result is the following: So, importing sys works but importing my own module fails, while adding the path to my modules seemed to work. Any idea ? Answer Repl…
Tag: python-3.x
How can I merge two files in one using BASH or Python script?
We assume that I have two files like this: File1 : File2 : I want to combine them in order to get one file with this output file : OuputFile : So, in Windows, I made this batch file to get what I expected, but, I have no idea how to do it in BASH (Bourne-Again shell) or in Python
Crontab Entry Causing Unknown Command
The entry Is causing the following error: My script has the shebang at the top: I think the python3 path is correct: As suggested, I looked for a CR but none found: What should I try? Thanks Answer Make sure the end-of-line does not contains Carriage return, but only new line. If there’s carriage return…
Why can’t python sockets resolve url’s with http in it
My Script basically looks like this i am getting an error, like this This means that python can’t resolve that particular host, if i remove the http:// and leave it as goal.com or make that request through my browser, it’s just fine and the script and the browser don’t throw any errors, one …
Root autentication on a Python program
I have the root password saved in a variable. How I can give the root authorization at my program? This can be an example: Answer It is impossible to do it in the way you try. Your program is already started under some non-root user and you cannot change it inside this program. You can spawn other process whi…
Cannot simultaneously run python 2 and 3 due to import errors
I am trying to be able to run python2 and python3 simultaneously on a server that I do not have root access to and which does not have a recent python3 implementation. This works fine on my own server which I do have root access to, but I can’t figure out what I am doing wrong. For reference, the python…
How to run python 3 on Synology NAS
I’m a little new to linux and I’m having trouble running Python scripts on Synology NAS running on DSM 5.1 I installed a Python 3 module, but when I call I get How can I run python 3 ? Thanks Answer As suggested by Geotob the solution is simply calling python3
Disable OpenGL for Python / Matplotlib
I’m doing a Python course for which I have installed Arch Linux in a VM. When I use Matplotlib.pyplot to plot things (x vs y) I get a bunch of errors. When I turn of 3D support for the VM it simply asks for openGL. My script does create a plot (empty canvas) but without a line. I think it
Infinite while not working with os.execvp
I am programming in python which involves me implementing a shell in Python in Linux. I am trying to run standard unix commands by using os.execvp(). I need to keep asking the user for commands so I have used an infinite while loop. However, the infinite while loop doesn’t work. I have tried searching o…
Python3 error “no module named bluetooth” on Linux Mint
I am trying to connect my Lenovo S10E to a Nintendo Wiimote via bluetooth. I am using a simple Python script, reproduced below. I am calling it from the Linux Mint (version 16, “Petra”) command line using python3 find_wii.py Script: I am receiving the error I have installed bluez and python wrappi…