<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Python on Notities</title><link>https://d8224bcf.backup-website.pages.dev/en/tags/python/</link><description>Recent content in Python on Notities</description><generator>Hugo</generator><language>en</language><lastBuildDate>Mon, 20 Jul 2026 22:38:58 +0200</lastBuildDate><atom:link href="https://d8224bcf.backup-website.pages.dev/en/tags/python/index.xml" rel="self" type="application/rss+xml"/><item><title>SSH in remote machine with SSH keys and run command in new Python 3</title><link>https://d8224bcf.backup-website.pages.dev/en/blog/2024-ssh-in-remote-machine-with-ssh-keys-and-run-command-in-new-python-3/</link><pubDate>Wed, 03 Apr 2024 20:20:39 +0000</pubDate><guid>https://d8224bcf.backup-website.pages.dev/en/blog/2024-ssh-in-remote-machine-with-ssh-keys-and-run-command-in-new-python-3/</guid><description>&lt;p&gt;T﻿o make a script to run remote commands in a client server network.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;import subprocess

def ssh_exec_command(hostname, username, command):
 ssh_cmd = [&amp;#39;ssh&amp;#39;, f&amp;#39;{username}@{hostname}&amp;#39;, command]
 ssh_process = subprocess.Popen(
 ssh_cmd,
 stdin=subprocess.PIPE,
 stdout=subprocess.PIPE,
 stderr=subprocess.PIPE,
 text=True
 )
 output, error = ssh_process.communicate()

 if error:
 print(&amp;#34;Error:&amp;#34;, error)
 else:
 print(&amp;#34;Output:&amp;#34;, output)

# Replace these with your actual credentials and command
hostname = &amp;#39;remote_host_address&amp;#39;
username = &amp;#39;your_username&amp;#39;
command = &amp;#39;ls -l&amp;#39;

ssh_exec_command(hostname, username, command)
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>SSH in remote machine with SSH keys and run command in old Python 2</title><link>https://d8224bcf.backup-website.pages.dev/en/blog/2024-ssh-in-remote-machine-with-ssh-keys-and-run-command-in-old-python/</link><pubDate>Wed, 03 Apr 2024 20:12:58 +0000</pubDate><guid>https://d8224bcf.backup-website.pages.dev/en/blog/2024-ssh-in-remote-machine-with-ssh-keys-and-run-command-in-old-python/</guid><description>&lt;p&gt;I﻿n case you have an old legacy system with Python 2 still in use and want to make a script to run certain commands in a client server network.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;import subprocess

def ssh_exec_command(hostname, username, private_key_path, command):
 ssh_cmd = [&amp;#39;ssh&amp;#39;, &amp;#39;-i&amp;#39;, private_key_path, &amp;#39;-o&amp;#39;, &amp;#39;StrictHostKeyChecking=no&amp;#39;, f&amp;#39;{username}@{hostname}&amp;#39;, command]
 ssh_process = subprocess.Popen(
 ssh_cmd,
 stdin=subprocess.PIPE,
 stdout=subprocess.PIPE,
 stderr=subprocess.PIPE
 )
 output, error = ssh_process.communicate()

 if error:
 print(&amp;#34;Error:&amp;#34;, error)
 else:
 print(&amp;#34;Output:&amp;#34;, output)

# Replace these with your actual credentials and command
hostname = &amp;#39;remote_host_address&amp;#39;
username = &amp;#39;your_username&amp;#39;
private_key_path = &amp;#39;/path/to/your/private_key&amp;#39;
command = &amp;#39;ls -l&amp;#39;

ssh_exec_command(hostname, username, private_key_path, command)
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>Prevent opening Windows 11 Store when typing the command python</title><link>https://d8224bcf.backup-website.pages.dev/en/blog/2022-prevent-opening-windows-11-store-when-typing-the-command-python/</link><pubDate>Thu, 01 Dec 2022 19:30:38 +0000</pubDate><guid>https://d8224bcf.backup-website.pages.dev/en/blog/2022-prevent-opening-windows-11-store-when-typing-the-command-python/</guid><description>&lt;p&gt;Step 1: Open Settings in Windows 11&lt;/p&gt;
&lt;p&gt;Step 2: Go to Apps&lt;/p&gt;
&lt;p&gt;Step 3: Go to Advanced app settings&lt;/p&gt;
&lt;p&gt;Step 4: Go to App execution aliases&lt;/p&gt;
&lt;p&gt;Step 5: Disable the option for python.exe and python3.exe&lt;/p&gt;</description></item><item><title>Python dependencies when installing Oracle VirtualBox on Windows 11</title><link>https://d8224bcf.backup-website.pages.dev/en/blog/2022-dependencies-van-python-bij-de-installatie-van-oracle-virtualbox-op-windows-11/</link><pubDate>Thu, 01 Dec 2022 19:24:55 +0000</pubDate><guid>https://d8224bcf.backup-website.pages.dev/en/blog/2022-dependencies-van-python-bij-de-installatie-van-oracle-virtualbox-op-windows-11/</guid><description>&lt;p&gt;Step 1: install Python&lt;/p&gt;
&lt;p&gt;Step 2: add both the scripts folder and its parent folder to the path&lt;/p&gt;
&lt;p&gt;Step 3: CMD&amp;gt; pip install pywin32&lt;/p&gt;</description></item><item><title>Set the Python interpreter version for the extension: Code Runner in VSCodium</title><link>https://d8224bcf.backup-website.pages.dev/en/blog/2022-stel-de-versie-van-de-python-interpreter-in-voor-de-extensie-code-runner-in-vscodium/</link><pubDate>Sun, 03 Apr 2022 19:55:44 +0000</pubDate><guid>https://d8224bcf.backup-website.pages.dev/en/blog/2022-stel-de-versie-van-de-python-interpreter-in-voor-de-extensie-code-runner-in-vscodium/</guid><description>&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# File name: version_used.py&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# This prints the version of Python being used by the Code Runner extension in VSCodium&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Set by going to: File -&amp;gt; Preferences -&amp;gt; Settings -&amp;gt; Search Settings -&amp;gt; code-runner.executorMap -&amp;gt; Edit in settings.json&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# &amp;#34;python&amp;#34;: &amp;#34;/bin/python3.9 -u&amp;#34;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# To run this script press the little play button on the top right in the editor&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;import&lt;/span&gt; sys
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;print(sys&lt;span style="color:#f92672"&gt;.&lt;/span&gt;version)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Install Python 3.9 on Ubuntu Linux</title><link>https://d8224bcf.backup-website.pages.dev/en/blog/2022-installeer-python-3-9-op-ubuntu-linux/</link><pubDate>Sun, 03 Apr 2022 18:55:18 +0000</pubDate><guid>https://d8224bcf.backup-website.pages.dev/en/blog/2022-installeer-python-3-9-op-ubuntu-linux/</guid><description>&lt;p&gt;$ sudo apt install software-properties-common&lt;/p&gt;
&lt;p&gt;$ sudo add-apt-repository ppa:deadsnakes/ppa&lt;/p&gt;
&lt;p&gt;$ sudo apt update&lt;/p&gt;
&lt;p&gt;$ sudo apt install python3.9&lt;/p&gt;
&lt;p&gt;$ python3.9 &amp;ndash;version&lt;/p&gt;</description></item></channel></rss>