Hot answers tagged

5

Python 2 and Python 3 are significantly different, and most programs written using Python 2 can’t be migrated automatically to Python 3. Debian 10 includes both: Python 2.7.16, and Python 3.7.3. These were the versions of Python 2 and 3 current at the time Debian 10 was frozen for release. Python 2 is no longer supported upstream, since earlier this year (...


4

Because os.system doesn't return exitcode but waitstatus. To convert it to return code you need to use os.waitstatus_to_exitcode (or os.WEXITSTATUS for older Python versions). In [2]: os.WEXITSTATUS(256) ...


3

You are anchoring your regex to the beginning of the line: ^[^#;]ser1 That means "match lines that start with any character other than # or ;, and then the sting ser1. So, the [^#;] is matching the u of user1. If you want to give the whole word, you need to look for lines starting with user1 directly: ^user1 Alternatively, allow for 0 occurrences of ...


3

The problem is that you try to achieve two things explicitly which however imply each other: the line should start with user1 the line should not start with a comment sign (# or ;) However, your second regular expression states "the line shall start with any character that is not # or ;, and then contain user1. So, grep expects that there is a ...


3

In Ubuntu 16.04, the pygmentize binary is provided by the python-pygments package, using the Python 2 module. In my experiments, minted works fine with the Python 2 version of pygments — it invokes the pygmentize binary, and whether that’s implemented using Python 2 or Python 3 doesn’t make any difference as far as minted is concerned. To reproduce, run sudo ...


3

8.1.2 is the latest version that's available in the RHEL repos for RHEL 7.6 (and also RHEL 7.8) for the corresponding version of Python which is 2.7. Version 19.3.1 is available but it's for Python 3.8. You can see it available if you enable the necessary RHEL repos and search for the package with yum: subscription-manager repos enable rhel* yum list ...


3

You are doing nothing wrong, 8.1.2 is the newest version of pip available in the EPEL 7 repo. RHEL/CentOS 7 usually doesn't get new versions of software, only bugfixes, and same applies to EPEL. There are some CVE fixes and other recent patches in the pip EPEL repo so I'd assume it's being actively maintained and safe to use.


2

$ python3 -c 'import sys with open(sys.argv[1]) as f: for l in f: a, b = map(lambda x: l.find(x), ["(",")"]) print(l[a+1:b]) ' out > out1 $ cat out1 XOR4DGHFDH22DSVT ND2DGH557GGHDSVT SDK1DNG45GKDSVT the idiomatic way / pythonic way is to use the with-open clause as it automatically closes the file descriptor at eof and also ...


2

Try SSH_ASKPASS man ssh ... SSH_ASKPASS If ssh needs a passphrase, it will read the passphrase from the current terminal if it was run from a terminal. If ssh does not have a terminal associated with it but DISPLAY and SSH_ASKPASS are set, it will execute the program specified by SSH_ASKPASS and open an X11 window to read the passphrase. This is ...


2

While it is easy to "run from RAM", this will not solve your problem. The SD card will only get corrupted if you power off or remove the card, while also writing to the card. Solutions: Stop writing to the card. Enable journaling on the file-system. Shutdown properly shutdown -h now. Reboot properly shutdown -r now.


1

For certain models of RPi it's possible to boot the RPi over network using DHCP/BOOTP and TFTP (and then very probably NFS). This requires an other permanent system providing DHCP/BOOTP, TFTP and NFS services since the RPi has nothing when it's booting. This can work only with Ethernet, not Wireless. Documentation on how to do this for RPi 3B and even RPi 4 ...


1

When you pipe a program as a string to a command interpreter, the interpreter reads it from its standard input, which is therefore bound to the reading end of the pipe: commands that try reading interactively provided information from it will generally receive an EOF. For instance: $ echo 'read x; echo "$x"' | bash # Just prints an empty line, ...


1

Answer base on discussion with @Tiago in the comments to help other with similar issue: Amazon Linux is based on CentOS 7 so the repository should work there. The repository has been moved https://repo.ius.io/ius-release-el7.rpm so the correct command to enable is sudo yum install https://repo.ius.io/ius-release-el7.rpm https://dl.fedoraproject.org/pub/epel/...


1

Using join on the first field (Order No.) of both files with , as field separator: join -t, -o1.1,1.2,1.3,1.4,2.1,2.2,2.3 main.csv october-2020.csv > output.csv and $ cat output.csv Order No.,invoiceNumber,invoiceAmount,invoiceAmountNet,Order No.,Timestamp,ID 20001,20010,500,5,20001,2020-10-01 12:00:00,123456 20002,20011,400,4,20002,2020-10-02 13:00:00,...


Only top voted, non community-wiki answers of a minimum length are eligible