I am working on Debian Stable Linux which is otherwise working very well. I have following code in a python script file named “myrev” which works to reverse order of lines of given text file: It works properly and prints out reverse order of lines if I use following Linux command However, if I try to redirect output with following
Tag: python
How do I run Perl’s “prove“ TAP harness in unbuffered mode?
As part of a test suite written in Python 3[.4-.6] on Linux, I have to run a number 3rd-party tests. The 3rd-party tests are bash scripts. They are designed to run with Perl’s prove TAP harness. One bash script can contain up to a few thousands of individual tests – and some of them can hang indefinitely. After a timeout,
Jupyterhub using sudo without root: can’t run sudospawner without pw
I’m struggling to fire up jupyterhub, running with limited sudo rights, without root privileges. If I understand correctly, this makes it possible to run notebook servers as real system users on a shared system without running the Hub itself as root. I followed the following steps, but for someone reason the following command keeps giving me the error that my
Connect Python to Remote DB2 Server
Using Python’s DB2 API, ibm_db, I am attempting to connect to a remote DB2 server (at IP address 10.0.0.001 which I can successfully ssh into). Both client and server machines are Linux / Ubuntu 16.0 LTS. In all my attempts and solutions, I continually run into the regular SQL1639N error. Python 3.5 (attempted both connection versions) Error [IBM][CLI Driver] SQL1639N
Copying a NamedTemporaryFile in Linux results in empty file
I am writing some contents to a tempfile.NamedTemporaryFile in Python 3 under Ubuntu 16.04. Under certain circumstances, I want to copy that file to a different location after the writing is done. The problem is reproduced with the following code: mytest.txt is empty once the execution is over. If I use delete=False when creating the NamedTemporaryFile I can inspect its
How to ssh.invoke_shell() work under Linux
The problem is that in theory the var channel_data must have and print This: Inted of that, it print this: The host “xxxx@yyyyy~$” it never appeared, so the part of the code when I asked for: It never happened. The only difference from this, to the paramiko librarie example I saw, was that the code work on Windows. So the
Creating files from a Python script within a shell script within a shell script
I’m trying to run a Python script from a shell script within a shell script, but I’m running into some problems. Imagine my root shell script looks like this: and my test2.sh: The python file is in the same directory as test2.sh but test2.sh’s working directory seems to be the root’s so it cannot find the python script. So, if
KeyError: Python script executed by linux service unable to access environment var
So I have a simple service on my Raspberry Pi that runs a Python script on boot. I have also set the env variable by running export OPSESPORT=XXXX. This is the service file: And in somefile.py, I have: Which leads to the following error when checking logs of the service: This is super weird since if I just run the
Unable to import paramiko
I wrote a Python script on my laptop(written in 2.7.14) which makes use of paramiko module. It runs just fine on my laptop. I moved this script to a linux box & while running it, I get an error saying paraniko not found which is of course because the linux machine where I moved the script to doesn’t have paramiko
Not able to import pandas and numpy
I am trying to run following simple script on Debian Stable Linux: But it is giving following error: Following versions of pandas and numpy are installed through Debian Repositories: Where is the problem and how can it be solved? Edit: I find that the same above file works perfectly in another folder! I am using correct filename for command. There