<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[Python Forum - All Forums]]></title>
		<link>https://python-forum.io/</link>
		<description><![CDATA[Python Forum - https://python-forum.io]]></description>
		<pubDate>Mon, 06 Apr 2026 03:31:28 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[New and highly efficient root-finding library is available for Python]]></title>
			<link>https://python-forum.io/thread-46250.html</link>
			<pubDate>Thu, 02 Apr 2026 16:51:36 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://python-forum.io/member.php?action=profile&uid=43798">JustARandomGeek</a>]]></dc:creator>
			<guid isPermaLink="false">https://python-forum.io/thread-46250.html</guid>
			<description><![CDATA[It finds the root of a single nonlinear equation f(x) = 0 within the specified interval [x1, x2]. <br />
It uses the Modified Anderson-Bjork method (Ganchovski &amp; Traykov, 2023). <br />
Works in Windows, Linux and Mac OS:<br />
<a href="https://github.com/Just-A-Random-Geek/ModAB-Root-Finding/tree/main/ModAB-Python" target="_blank" rel="noopener" class="mycode_url">https://github.com/Just-A-Random-Geek/Mo...dAB-Python</a><br />
<br />
Install it by: <pre class="brush: python" title="Python Code:">pip install pymodab</pre>It is extremely fast and reliable, outperforming the existing functions in SciPy by about five times in execution speed!!!<br />
<br />
Execution times  (ms per problem, 100 iterations)<br />
<br />
<pre class="brush: python" title="Python Code:">  Func|   bisect|   brentq|   brenth|   ridder|   chandr|    modAB|
----- | ------: | ------: | ------: | ------: | ------: | ------: |
   SUM|  1266.30|   797.21|   800.98|   921.14| 48639.60|   145.55|
   AVG|  13.7641|   8.6654|   8.7063|  10.0124| 528.6913|   1.5820|
MEDIAN|  13.8022|   4.5878|   4.3595|   5.6256| 306.4098|   1.2803|
   MIN|   1.4287|   1.7302|   1.6219|   1.3884|  72.9172|   0.6143|
   MAX|  21.8886|  36.7684|  50.2981|  54.4431|1542.8365|   4.3991|
FACTOR|   8.700x|   5.477x|   5.503x|   6.329x| 334.189x|   1.000x|</pre>Function evaluations<br />
<br />
<pre class="brush: python" title="Python Code:">  Func|   bisect|   brentq|   brenth|   ridder|   chandr|    modAB|
----- | ------: | ------: | ------: | ------: | ------: | ------: |
   SUM|     4411|     2548|     2512|     3158|     1873|     1758|
   AVG|       48|       28|       27|       34|       20|       19|
MEDIAN|       49|       12|       12|       16|       12|       12|
   MIN|        3|        4|        4|        4|        3|        3|
   MAX|       53|      102|      102|      202|       58|       56|
FACTOR|   2.509x|   1.449x|   1.429x|   1.796x|   1.065x|   1.000x|</pre>The usage is very simple:<br />
<br />
<pre class="brush: python" title="Python Code:">import math
from pymodab import find_root, get_evaluation_count

# Find the root of cos(x) - x = 0 in [0, 1]
root = find_root(lambda x: math.cos(x) - x, 0, 1, 1e-3, 1e-3, 10)
print(f"Root: {root}")  # 0.7390851332086904

# Get the number of function evaluations
print(f"Evaluations: {get_evaluation_count()}")
print(f"Error:       {math.cos(root) - root}")</pre>Enjoi!]]></description>
			<content:encoded><![CDATA[It finds the root of a single nonlinear equation f(x) = 0 within the specified interval [x1, x2]. <br />
It uses the Modified Anderson-Bjork method (Ganchovski &amp; Traykov, 2023). <br />
Works in Windows, Linux and Mac OS:<br />
<a href="https://github.com/Just-A-Random-Geek/ModAB-Root-Finding/tree/main/ModAB-Python" target="_blank" rel="noopener" class="mycode_url">https://github.com/Just-A-Random-Geek/Mo...dAB-Python</a><br />
<br />
Install it by: <pre class="brush: python" title="Python Code:">pip install pymodab</pre>It is extremely fast and reliable, outperforming the existing functions in SciPy by about five times in execution speed!!!<br />
<br />
Execution times  (ms per problem, 100 iterations)<br />
<br />
<pre class="brush: python" title="Python Code:">  Func|   bisect|   brentq|   brenth|   ridder|   chandr|    modAB|
----- | ------: | ------: | ------: | ------: | ------: | ------: |
   SUM|  1266.30|   797.21|   800.98|   921.14| 48639.60|   145.55|
   AVG|  13.7641|   8.6654|   8.7063|  10.0124| 528.6913|   1.5820|
MEDIAN|  13.8022|   4.5878|   4.3595|   5.6256| 306.4098|   1.2803|
   MIN|   1.4287|   1.7302|   1.6219|   1.3884|  72.9172|   0.6143|
   MAX|  21.8886|  36.7684|  50.2981|  54.4431|1542.8365|   4.3991|
FACTOR|   8.700x|   5.477x|   5.503x|   6.329x| 334.189x|   1.000x|</pre>Function evaluations<br />
<br />
<pre class="brush: python" title="Python Code:">  Func|   bisect|   brentq|   brenth|   ridder|   chandr|    modAB|
----- | ------: | ------: | ------: | ------: | ------: | ------: |
   SUM|     4411|     2548|     2512|     3158|     1873|     1758|
   AVG|       48|       28|       27|       34|       20|       19|
MEDIAN|       49|       12|       12|       16|       12|       12|
   MIN|        3|        4|        4|        4|        3|        3|
   MAX|       53|      102|      102|      202|       58|       56|
FACTOR|   2.509x|   1.449x|   1.429x|   1.796x|   1.065x|   1.000x|</pre>The usage is very simple:<br />
<br />
<pre class="brush: python" title="Python Code:">import math
from pymodab import find_root, get_evaluation_count

# Find the root of cos(x) - x = 0 in [0, 1]
root = find_root(lambda x: math.cos(x) - x, 0, 1, 1e-3, 1e-3, 10)
print(f"Root: {root}")  # 0.7390851332086904

# Get the number of function evaluations
print(f"Evaluations: {get_evaluation_count()}")
print(f"Error:       {math.cos(root) - root}")</pre>Enjoi!]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Thread Termination]]></title>
			<link>https://python-forum.io/thread-46249.html</link>
			<pubDate>Thu, 02 Apr 2026 09:54:24 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://python-forum.io/member.php?action=profile&uid=43015">Tuurbo46</a>]]></dc:creator>
			<guid isPermaLink="false">https://python-forum.io/thread-46249.html</guid>
			<description><![CDATA[Hello,<br />
<br />
This is my first multithreading Tkinter GUI and I have errors when closing.<br />
<br />
The GUI is running 4 thread routines, and they seem to be running ok. However, when I select the shutdown button that calls the terminate_threads() fucntion, the Tkinter GUI closes but I always get errors. Can you confirm if I am terminating the threads correctly?<br />
<br />
Also please advise if the starting and handling of the threads are correct?<br />
<br />
Multi thread code running at the bottom of the Tkinter mainloop:<br />
<br />
<pre class="brush: python" title="Python Code:">def do_every (interval, worker_func, iterations = 0): 
  
   if iterations != 1:
    threading.Timer (
      interval,
      do_every, [interval, worker_func, 0 if iterations == 0 else iterations-1]
    ).start ()

  worker_func ()


# call main_control every 10 seconds
do_every (10, main_control)  

# call write_to_csv every 5 seconds
do_every (5, write_to_csv)  

# call duration_timer every 1 seconds
do_every (1, duration_timer)

# call one_second_timer every 1 seconds
do_every (1, one_second_timer)  
  
root.mainloop()</pre>Terminate threads on closing of program:<br />
<br />
<pre class="brush: python" title="Python Code:">def terminate_threads():

   # terminate all threads
   root.destroy()
   sys.exit()
   root.quit()</pre>Many thanks,<br />
<br />
Tuurbo46]]></description>
			<content:encoded><![CDATA[Hello,<br />
<br />
This is my first multithreading Tkinter GUI and I have errors when closing.<br />
<br />
The GUI is running 4 thread routines, and they seem to be running ok. However, when I select the shutdown button that calls the terminate_threads() fucntion, the Tkinter GUI closes but I always get errors. Can you confirm if I am terminating the threads correctly?<br />
<br />
Also please advise if the starting and handling of the threads are correct?<br />
<br />
Multi thread code running at the bottom of the Tkinter mainloop:<br />
<br />
<pre class="brush: python" title="Python Code:">def do_every (interval, worker_func, iterations = 0): 
  
   if iterations != 1:
    threading.Timer (
      interval,
      do_every, [interval, worker_func, 0 if iterations == 0 else iterations-1]
    ).start ()

  worker_func ()


# call main_control every 10 seconds
do_every (10, main_control)  

# call write_to_csv every 5 seconds
do_every (5, write_to_csv)  

# call duration_timer every 1 seconds
do_every (1, duration_timer)

# call one_second_timer every 1 seconds
do_every (1, one_second_timer)  
  
root.mainloop()</pre>Terminate threads on closing of program:<br />
<br />
<pre class="brush: python" title="Python Code:">def terminate_threads():

   # terminate all threads
   root.destroy()
   sys.exit()
   root.quit()</pre>Many thanks,<br />
<br />
Tuurbo46]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Anthropic leak all there source code,not an April joke]]></title>
			<link>https://python-forum.io/thread-46248.html</link>
			<pubDate>Wed, 01 Apr 2026 10:42:04 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://python-forum.io/member.php?action=profile&uid=7">snippsat</a>]]></dc:creator>
			<guid isPermaLink="false">https://python-forum.io/thread-46248.html</guid>
			<description><![CDATA[Read more about <a href="https://fortune.com/2026/03/31/anthropic-source-code-claude-code-data-leak-second-security-lapse-days-after-accidentally-revealing-mythos/" target="_blank" rel="noopener" class="mycode_url">here</a>.<br />
Funny looking at some of the code as eg prevent user to use bad word in Prompt,<br />
good old Regex👀 is used(so i guess AI🫣 is not good for all).<br />
Here is the Function from <code class="icode">userPromptKeywords.ts</code> rewritten in Python.<br />
<pre class="brush: python" title="Python Code:">import re

NEGATIVE_PATTERN = re.compile(
    r"\b("
    r"wtf|wth|ffs|omfg|shit(ty|tiest)?|dumbass|horrible|awful|"
    r"piss(ed|ing)? off|piece of (shit|crap|junk)|what the (fuck|hell)|"
    r"fucking? (broken|useless|terrible|awful|horrible)|fuck you|"
    r"screw (this|you)|so frustrating|this sucks|damn it"
    r")\b"
)

def matches_negative_keyword(text: str) -&gt; bool:
    lower_input = text.lower()
    return bool(NEGATIVE_PATTERN.search(lower_input))</pre>Test.<br />
<pre class="brush: python" title="Python Code:">&gt;&gt;&gt; word = 'damn it'
&gt;&gt;&gt; matches_negative_keyword(word)
True
&gt;&gt;&gt; # Can bypass with a typo or other words usage
&gt;&gt;&gt; word = 'dammn it'
&gt;&gt;&gt; matches_negative_keyword(word)
False
&gt;&gt;&gt; word = 'screw you'
&gt;&gt;&gt; matches_negative_keyword(word)
True
&gt;&gt;&gt; word = 'screw all'
&gt;&gt;&gt; matches_negative_keyword(word)
False</pre>]]></description>
			<content:encoded><![CDATA[Read more about <a href="https://fortune.com/2026/03/31/anthropic-source-code-claude-code-data-leak-second-security-lapse-days-after-accidentally-revealing-mythos/" target="_blank" rel="noopener" class="mycode_url">here</a>.<br />
Funny looking at some of the code as eg prevent user to use bad word in Prompt,<br />
good old Regex👀 is used(so i guess AI🫣 is not good for all).<br />
Here is the Function from <code class="icode">userPromptKeywords.ts</code> rewritten in Python.<br />
<pre class="brush: python" title="Python Code:">import re

NEGATIVE_PATTERN = re.compile(
    r"\b("
    r"wtf|wth|ffs|omfg|shit(ty|tiest)?|dumbass|horrible|awful|"
    r"piss(ed|ing)? off|piece of (shit|crap|junk)|what the (fuck|hell)|"
    r"fucking? (broken|useless|terrible|awful|horrible)|fuck you|"
    r"screw (this|you)|so frustrating|this sucks|damn it"
    r")\b"
)

def matches_negative_keyword(text: str) -&gt; bool:
    lower_input = text.lower()
    return bool(NEGATIVE_PATTERN.search(lower_input))</pre>Test.<br />
<pre class="brush: python" title="Python Code:">&gt;&gt;&gt; word = 'damn it'
&gt;&gt;&gt; matches_negative_keyword(word)
True
&gt;&gt;&gt; # Can bypass with a typo or other words usage
&gt;&gt;&gt; word = 'dammn it'
&gt;&gt;&gt; matches_negative_keyword(word)
False
&gt;&gt;&gt; word = 'screw you'
&gt;&gt;&gt; matches_negative_keyword(word)
True
&gt;&gt;&gt; word = 'screw all'
&gt;&gt;&gt; matches_negative_keyword(word)
False</pre>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[How to install older version]]></title>
			<link>https://python-forum.io/thread-46247.html</link>
			<pubDate>Wed, 01 Apr 2026 00:21:47 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://python-forum.io/member.php?action=profile&uid=43794">DanV</a>]]></dc:creator>
			<guid isPermaLink="false">https://python-forum.io/thread-46247.html</guid>
			<description><![CDATA[I'm a newbie with the most basic question. I want Python installed on an old Win7 laptop. I downloaded version 3.8.15 and 7zip to unpack it. I now have a Python-3.8.15.tar file. (88.8MB) It looks like I still need to install. Win7 doesn't recognize .tar extension. Do I need to download something else to enable the install?]]></description>
			<content:encoded><![CDATA[I'm a newbie with the most basic question. I want Python installed on an old Win7 laptop. I downloaded version 3.8.15 and 7zip to unpack it. I now have a Python-3.8.15.tar file. (88.8MB) It looks like I still need to install. Win7 doesn't recognize .tar extension. Do I need to download something else to enable the install?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Tkinter: puzzlement with creating a canvas widget]]></title>
			<link>https://python-forum.io/thread-46246.html</link>
			<pubDate>Mon, 30 Mar 2026 19:26:31 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://python-forum.io/member.php?action=profile&uid=43751">meijeru</a>]]></dc:creator>
			<guid isPermaLink="false">https://python-forum.io/thread-46246.html</guid>
			<description><![CDATA[I have successfully created a widget of type Canvas, but when I want to use its attributes I get a NoneType error<br />
<pre class="brush: python" title="Python Code:">root = tk.Tk()
frame = tk.Frame(root)
frame.grid()
panel = tk.Canvas(frame, width=panel_width, height=panel_height, bg="silver").grid(row=0, column=0)
btn = tk.Button(frame, text="Quit", command=root.destroy).grid(row=1, column=0)</pre> <br />
The canvas is created, but the name is not recognized in the next statement:<br />
<pre class="brush: python" title="Python Code:">panel.create_line(0, 20, panel_width, 20, fill="red", width=2)</pre>I get an error: <br />
<span style="color: #C0392B;" class="mycode_color">AttributeError: 'NoneType' object has no attribute 'create_line'</span><br />
<br />
I must be doing something wrong... Thanks in advance for any help]]></description>
			<content:encoded><![CDATA[I have successfully created a widget of type Canvas, but when I want to use its attributes I get a NoneType error<br />
<pre class="brush: python" title="Python Code:">root = tk.Tk()
frame = tk.Frame(root)
frame.grid()
panel = tk.Canvas(frame, width=panel_width, height=panel_height, bg="silver").grid(row=0, column=0)
btn = tk.Button(frame, text="Quit", command=root.destroy).grid(row=1, column=0)</pre> <br />
The canvas is created, but the name is not recognized in the next statement:<br />
<pre class="brush: python" title="Python Code:">panel.create_line(0, 20, panel_width, 20, fill="red", width=2)</pre>I get an error: <br />
<span style="color: #C0392B;" class="mycode_color">AttributeError: 'NoneType' object has no attribute 'create_line'</span><br />
<br />
I must be doing something wrong... Thanks in advance for any help]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[Solved] Getting python's default 'printed' byte-string as string ?]]></title>
			<link>https://python-forum.io/thread-46245.html</link>
			<pubDate>Mon, 30 Mar 2026 12:06:13 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://python-forum.io/member.php?action=profile&uid=5951">MvGulik</a>]]></dc:creator>
			<guid isPermaLink="false">https://python-forum.io/thread-46245.html</guid>
			<description><![CDATA[Answer: str() or repr()  <img src="https://python-forum.io/images/smilies/blush.png" alt="Blush" title="Blush" class="smilie smilie_12" /> <br />
--- --- --- --- ---<br />
So if one uses <pre class="brush: python" title="Python Code:">print('bytestr:test-0', bytestr)</pre> on some byte string.<br />
You get this <pre><code class="codeblock output"><div class="title">Output:</div>bytestr:test-0 b'\x81\xff\xffscale\x00\x0f\x00\x00\x80@\x00\x89PNG...</code></pre> as output.<br />
<br />
There are of course plenty of decoding options.<br />
But ... what I like to get is '<span style="text-decoration: underline;" class="mycode_u">exactly</span>' that "<span style="font-weight: bold;" class="mycode_b">\x81\x...</span>" printed string in string form. (For direct further processing. Mainly debug related.)<br />
Is that possible?<br />
<br />
(<span style="font-style: italic;" class="mycode_i">Figure I could use some tmp file ... well maybe, not tried that yet. Copying it from the I/O terminal is not really workable of course</span>.)]]></description>
			<content:encoded><![CDATA[Answer: str() or repr()  <img src="https://python-forum.io/images/smilies/blush.png" alt="Blush" title="Blush" class="smilie smilie_12" /> <br />
--- --- --- --- ---<br />
So if one uses <pre class="brush: python" title="Python Code:">print('bytestr:test-0', bytestr)</pre> on some byte string.<br />
You get this <pre><code class="codeblock output"><div class="title">Output:</div>bytestr:test-0 b'\x81\xff\xffscale\x00\x0f\x00\x00\x80@\x00\x89PNG...</code></pre> as output.<br />
<br />
There are of course plenty of decoding options.<br />
But ... what I like to get is '<span style="text-decoration: underline;" class="mycode_u">exactly</span>' that "<span style="font-weight: bold;" class="mycode_b">\x81\x...</span>" printed string in string form. (For direct further processing. Mainly debug related.)<br />
Is that possible?<br />
<br />
(<span style="font-style: italic;" class="mycode_i">Figure I could use some tmp file ... well maybe, not tried that yet. Copying it from the I/O terminal is not really workable of course</span>.)]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Debugging with Flatline.py Python Debugger]]></title>
			<link>https://python-forum.io/thread-46243.html</link>
			<pubDate>Sat, 28 Mar 2026 22:21:58 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://python-forum.io/member.php?action=profile&uid=43788">tibberous</a>]]></dc:creator>
			<guid isPermaLink="false">https://python-forum.io/thread-46243.html</guid>
			<description><![CDATA[Hi all,<br />
<br />
I’ve been building an open-source Python project called Flatline and wanted to share a practical tutorial-style introduction for anyone dealing with apps that freeze, hang, or die before normal debugging gives you anything useful.<br />
<br />
Repository:<br />
<a href="https://github.com/tibberous/Flatline" target="_blank" rel="noopener" class="mycode_url">https://github.com/tibberous/Flatline</a><br />
<br />
Flatline is a Python process debugger/supervisor designed for situations like:<br />
<br />
GUI freezes<br />
hung child processes<br />
silent crashes<br />
startup failures<br />
shutdown races<br />
apps that stop responding before they emit a useful traceback<br />
<br />
According to the current project README, Flatline supervises a Python subprocess, monitors heartbeats, detects freezes, opens an interactive crash console, captures stack/variable snapshots, and writes stack_trace.log, variables.log, and error.log.<br />
<br />
What Flatline does<br />
<br />
Flatline runs your app under supervision instead of relying on the app to diagnose itself cleanly.<br />
<br />
The current README describes these core behaviors:<br />
<br />
launches a Python subprocess<br />
monitors heartbeats via TCP relay<br />
detects freezes when heartbeats go stale<br />
opens an interactive crash console on crash/freeze<br />
captures stack trace and variable dump<br />
writes log files automatically.<br />
<br />
It supports two main heartbeat modes:<br />
<br />
DB mode: beat events are stored in MariaDB and freeze detection uses DB timestamps<br />
Poll mode: a non-blocking proc.poll() thread tracks child liveness without requiring a database.<br />
Quick start<br />
<br />
The README’s simplest entry point is:<br />
<br />
python flatline.py app.py<br />
<br />
Flatline “always runs in supervisor mode,” so there is no separate debug mode to enable.<br />
<br />
Example command-line usage<br />
<br />
From the current README:<br />
<br />
python flatline.py<br />
python flatline.py script.py X Y<br />
python flatline.py --app script.py<br />
python flatline.py --config myapp.ini<br />
python flatline.py --version<br />
python flatline.py --help<br />
<br />
The bundled example.py also demonstrates launching a target script with Flatline and passing through extra arguments to the supervised app.<br />
<br />
Example configuration<br />
<br />
The bundled config.ini format in the README looks like this:<br />
<br />
[flatline]<br />
app = example.py<br />
freeze_threshold = 2.5<br />
poll_interval = 1.0<br />
poll_fail_limit = 3<br />
<br />
[database]<br />
enabled = false<br />
host = 127.0.0.1<br />
port = 3306<br />
user = root<br />
password =<br />
database = flatline<br />
<br />
That means you can start in simple poll mode, then move to database-backed heartbeat tracking later if you want more persistent beat logging.<br />
<br />
Adding heartbeats to your app<br />
<br />
The current README shows the intended pattern:<br />
<br />
from source.remote_client import RemoteClient<br />
flatline = RemoteClient()<br />
<br />
class MyWindow:<br />
    def __init__(self):<br />
        flatline.beat('INIT', 'MyWindow')<br />
<br />
    def resizeEvent(self, event):<br />
        flatline.beat('RESIZE', 'MyWindow')<br />
<br />
It also notes that beat() is rate-limited so identical reason/caller pairs inside 50ms are dropped.<br />
<br />
What happens when something goes wrong<br />
<br />
Flatline’s README describes the crash console keys as:<br />
<br />
1 stack trace<br />
2 variable dump<br />
3 graceful close<br />
4 SIGTERM<br />
5 force kill<br />
6 refresh<br />
7 shell command<br />
8 network connections<br />
9 network monitor<br />
R restart<br />
S status<br />
Q quit.<br />
<br />
The logs bundled with the project also show the parent-side watchdog/debugger behavior in practice: relay server startup, process watchdog startup, socket REPL on localhost:5050, child launch, and crash console opening when the child exits non-zero or becomes unhealthy.<br />
<br />
Demo app<br />
<br />
The current README says the bundled app.py demo includes:<br />
<br />
a left-panel code editor<br />
a right-panel black/green output console<br />
editable demo code<br />
redirected print() output<br />
an About dialog.<br />
<br />
That makes it easy to test:<br />
<br />
normal execution<br />
deliberate exceptions<br />
freeze handling<br />
child supervision behavior<br />
Why I built it<br />
<br />
I originally built Flatline while debugging a much larger Python desktop application that had freezes, startup failures, shutdown hangs, and hard-to-catch runtime faults. The goal was to keep the debugger useful even when the child process was not cooperating.<br />
<br />
Feedback I’d love<br />
<br />
I’d especially appreciate feedback on:<br />
<br />
whether the current CLI/config flow feels Pythonic<br />
whether the heartbeat model should stay this simple or grow more structured<br />
whether the crash-console workflow is useful outside desktop apps<br />
what kinds of failures you most want a tool like this to help with<br />
<br />
Repository again:<br />
<a href="https://github.com/tibberous/Flatline" target="_blank" rel="noopener" class="mycode_url">https://github.com/tibberous/Flatline</a><br /><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://python-forum.io/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=3639" target="_blank" title="">flatline.zip</a> (Size: 235.28 KB / Downloads: 0)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[Hi all,<br />
<br />
I’ve been building an open-source Python project called Flatline and wanted to share a practical tutorial-style introduction for anyone dealing with apps that freeze, hang, or die before normal debugging gives you anything useful.<br />
<br />
Repository:<br />
<a href="https://github.com/tibberous/Flatline" target="_blank" rel="noopener" class="mycode_url">https://github.com/tibberous/Flatline</a><br />
<br />
Flatline is a Python process debugger/supervisor designed for situations like:<br />
<br />
GUI freezes<br />
hung child processes<br />
silent crashes<br />
startup failures<br />
shutdown races<br />
apps that stop responding before they emit a useful traceback<br />
<br />
According to the current project README, Flatline supervises a Python subprocess, monitors heartbeats, detects freezes, opens an interactive crash console, captures stack/variable snapshots, and writes stack_trace.log, variables.log, and error.log.<br />
<br />
What Flatline does<br />
<br />
Flatline runs your app under supervision instead of relying on the app to diagnose itself cleanly.<br />
<br />
The current README describes these core behaviors:<br />
<br />
launches a Python subprocess<br />
monitors heartbeats via TCP relay<br />
detects freezes when heartbeats go stale<br />
opens an interactive crash console on crash/freeze<br />
captures stack trace and variable dump<br />
writes log files automatically.<br />
<br />
It supports two main heartbeat modes:<br />
<br />
DB mode: beat events are stored in MariaDB and freeze detection uses DB timestamps<br />
Poll mode: a non-blocking proc.poll() thread tracks child liveness without requiring a database.<br />
Quick start<br />
<br />
The README’s simplest entry point is:<br />
<br />
python flatline.py app.py<br />
<br />
Flatline “always runs in supervisor mode,” so there is no separate debug mode to enable.<br />
<br />
Example command-line usage<br />
<br />
From the current README:<br />
<br />
python flatline.py<br />
python flatline.py script.py X Y<br />
python flatline.py --app script.py<br />
python flatline.py --config myapp.ini<br />
python flatline.py --version<br />
python flatline.py --help<br />
<br />
The bundled example.py also demonstrates launching a target script with Flatline and passing through extra arguments to the supervised app.<br />
<br />
Example configuration<br />
<br />
The bundled config.ini format in the README looks like this:<br />
<br />
[flatline]<br />
app = example.py<br />
freeze_threshold = 2.5<br />
poll_interval = 1.0<br />
poll_fail_limit = 3<br />
<br />
[database]<br />
enabled = false<br />
host = 127.0.0.1<br />
port = 3306<br />
user = root<br />
password =<br />
database = flatline<br />
<br />
That means you can start in simple poll mode, then move to database-backed heartbeat tracking later if you want more persistent beat logging.<br />
<br />
Adding heartbeats to your app<br />
<br />
The current README shows the intended pattern:<br />
<br />
from source.remote_client import RemoteClient<br />
flatline = RemoteClient()<br />
<br />
class MyWindow:<br />
    def __init__(self):<br />
        flatline.beat('INIT', 'MyWindow')<br />
<br />
    def resizeEvent(self, event):<br />
        flatline.beat('RESIZE', 'MyWindow')<br />
<br />
It also notes that beat() is rate-limited so identical reason/caller pairs inside 50ms are dropped.<br />
<br />
What happens when something goes wrong<br />
<br />
Flatline’s README describes the crash console keys as:<br />
<br />
1 stack trace<br />
2 variable dump<br />
3 graceful close<br />
4 SIGTERM<br />
5 force kill<br />
6 refresh<br />
7 shell command<br />
8 network connections<br />
9 network monitor<br />
R restart<br />
S status<br />
Q quit.<br />
<br />
The logs bundled with the project also show the parent-side watchdog/debugger behavior in practice: relay server startup, process watchdog startup, socket REPL on localhost:5050, child launch, and crash console opening when the child exits non-zero or becomes unhealthy.<br />
<br />
Demo app<br />
<br />
The current README says the bundled app.py demo includes:<br />
<br />
a left-panel code editor<br />
a right-panel black/green output console<br />
editable demo code<br />
redirected print() output<br />
an About dialog.<br />
<br />
That makes it easy to test:<br />
<br />
normal execution<br />
deliberate exceptions<br />
freeze handling<br />
child supervision behavior<br />
Why I built it<br />
<br />
I originally built Flatline while debugging a much larger Python desktop application that had freezes, startup failures, shutdown hangs, and hard-to-catch runtime faults. The goal was to keep the debugger useful even when the child process was not cooperating.<br />
<br />
Feedback I’d love<br />
<br />
I’d especially appreciate feedback on:<br />
<br />
whether the current CLI/config flow feels Pythonic<br />
whether the heartbeat model should stay this simple or grow more structured<br />
whether the crash-console workflow is useful outside desktop apps<br />
what kinds of failures you most want a tool like this to help with<br />
<br />
Repository again:<br />
<a href="https://github.com/tibberous/Flatline" target="_blank" rel="noopener" class="mycode_url">https://github.com/tibberous/Flatline</a><br /><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://python-forum.io/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=3639" target="_blank" title="">flatline.zip</a> (Size: 235.28 KB / Downloads: 0)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Curious behavious of pre-filled 2-dimensional list]]></title>
			<link>https://python-forum.io/thread-46242.html</link>
			<pubDate>Sat, 28 Mar 2026 16:25:14 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://python-forum.io/member.php?action=profile&uid=43751">meijeru</a>]]></dc:creator>
			<guid isPermaLink="false">https://python-forum.io/thread-46242.html</guid>
			<description><![CDATA[When I reserve space for a 2-dimensional list using [...]*n, the behaviour is different from reserving the space by explicitly filling the list.<br />
Program fragments:<br />
<pre class="brush: python" title="Python Code:">&gt;&gt;&gt;a = [[0]*4]*4
&gt;&gt;&gt;a
   [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
&gt;&gt;&gt;for i in range(4):
... for j in range(4):
...  a[i][j] = i*4+j
&gt;&gt;&gt;a
   [[12, 13, 14, 15], [12, 13, 14, 15], [12, 13, 14, 15], [12, 13, 14, 15]] # not what I wanted
---------------------------------------------------------------------------
&gt;&gt;&gt;a = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
&gt;&gt;&gt;for i in range(4):
... for j in range(4):
...     a[i][j] = i*4+j
&gt;&gt;&gt;a
   [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15]] # this is what I wanted</pre>Is the behaviour of the first fragment documented somewhere, in other words have I missed some warning?]]></description>
			<content:encoded><![CDATA[When I reserve space for a 2-dimensional list using [...]*n, the behaviour is different from reserving the space by explicitly filling the list.<br />
Program fragments:<br />
<pre class="brush: python" title="Python Code:">&gt;&gt;&gt;a = [[0]*4]*4
&gt;&gt;&gt;a
   [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
&gt;&gt;&gt;for i in range(4):
... for j in range(4):
...  a[i][j] = i*4+j
&gt;&gt;&gt;a
   [[12, 13, 14, 15], [12, 13, 14, 15], [12, 13, 14, 15], [12, 13, 14, 15]] # not what I wanted
---------------------------------------------------------------------------
&gt;&gt;&gt;a = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
&gt;&gt;&gt;for i in range(4):
... for j in range(4):
...     a[i][j] = i*4+j
&gt;&gt;&gt;a
   [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15]] # this is what I wanted</pre>Is the behaviour of the first fragment documented somewhere, in other words have I missed some warning?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[SMTP email won't send. Program hangs.]]></title>
			<link>https://python-forum.io/thread-46240.html</link>
			<pubDate>Fri, 27 Mar 2026 13:04:47 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://python-forum.io/member.php?action=profile&uid=43779">LarryJ</a>]]></dc:creator>
			<guid isPermaLink="false">https://python-forum.io/thread-46240.html</guid>
			<description><![CDATA[Hi!<br />
<br />
I'm having problems connecting to and/or sending email through an SMTP server. I've tried everything Google can find, but I'm clearly not understanding something.<br />
<br />
When executing the program below, the code executes with no errors, but everything hangs at the end with a message saying the software unexpectedly lost connection with the server. No messages are sent. Here's the code.<br />
<br />
Thanks!<br />
<br />
Larry<br />
<br />
<pre class="brush: python" title="Python Code:"># Version 0.5
 
# import email libraries
import smtplib                  
from email.message import EmailMessage  
 
# Define variables 
email_to = 'them@email.com'    #This is obviously a fake address, but using the real thing doesn't work either. It is properly formatted as a string.
email_from = 'me@email.com'   # Same thing, fake, but the correct address doesn't work - also formatted as a string.
email_pw = 'password'              # Yup, another string.
 
# Read email body text file - this the text of the email I want to send. All data merges are already stored in this file. It is a pure text file.
with open('/Users/larryj/Desktop/temp.txt','r') as file:
    content=file.read()
     
#  Create a text/plain message
msg = EmailMessage()
msg['Subject'] = 'Thank you '
msg['From'] = email_from
msg['To'] = email_to    
msg.set_content(content)     # Content contains the data read from the text file above.
 
# setup the server
smtp_server = 'secure.emailsrvr.com'      # This is the correct address for Rackspace email
smtp_user = email_from                      # In this case the sender also owns the email account
smtp_password = email_pw
 
# Send the message
with smtplib.SMTP(smtp_server, 465) as server:  #This is the correct port for SMTP messages on Rackspace email
    server.starttls()                                            # Upgrades the connection to a secure encrypted SSL/TLS connection
    server.login(smtp_user, smtp_password)
    server.send_message(msg)</pre>]]></description>
			<content:encoded><![CDATA[Hi!<br />
<br />
I'm having problems connecting to and/or sending email through an SMTP server. I've tried everything Google can find, but I'm clearly not understanding something.<br />
<br />
When executing the program below, the code executes with no errors, but everything hangs at the end with a message saying the software unexpectedly lost connection with the server. No messages are sent. Here's the code.<br />
<br />
Thanks!<br />
<br />
Larry<br />
<br />
<pre class="brush: python" title="Python Code:"># Version 0.5
 
# import email libraries
import smtplib                  
from email.message import EmailMessage  
 
# Define variables 
email_to = 'them@email.com'    #This is obviously a fake address, but using the real thing doesn't work either. It is properly formatted as a string.
email_from = 'me@email.com'   # Same thing, fake, but the correct address doesn't work - also formatted as a string.
email_pw = 'password'              # Yup, another string.
 
# Read email body text file - this the text of the email I want to send. All data merges are already stored in this file. It is a pure text file.
with open('/Users/larryj/Desktop/temp.txt','r') as file:
    content=file.read()
     
#  Create a text/plain message
msg = EmailMessage()
msg['Subject'] = 'Thank you '
msg['From'] = email_from
msg['To'] = email_to    
msg.set_content(content)     # Content contains the data read from the text file above.
 
# setup the server
smtp_server = 'secure.emailsrvr.com'      # This is the correct address for Rackspace email
smtp_user = email_from                      # In this case the sender also owns the email account
smtp_password = email_pw
 
# Send the message
with smtplib.SMTP(smtp_server, 465) as server:  #This is the correct port for SMTP messages on Rackspace email
    server.starttls()                                            # Upgrades the connection to a secure encrypted SSL/TLS connection
    server.login(smtp_user, smtp_password)
    server.send_message(msg)</pre>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[SMTP email won't send. Server seems to hang.]]></title>
			<link>https://python-forum.io/thread-46239.html</link>
			<pubDate>Thu, 26 Mar 2026 22:26:33 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://python-forum.io/member.php?action=profile&uid=43779">LarryJ</a>]]></dc:creator>
			<guid isPermaLink="false">https://python-forum.io/thread-46239.html</guid>
			<description><![CDATA[Hi!<br />
<br />
I'm having problems connecting to and/or sending email through an SMTP server. I've tried everything Google can find, but I'm clearly not understanding something.<br />
<br />
When executing the program below, the code executes with no errors, but everything hangs at the end with a message saying the software unexpectedly lost connection with the server. No messages were sent. Here's the code.<br />
<br />
Thanks! <br />
<br />
Larry<br />
<br />
= = =<br />
<br />
<pre class="brush: python" title="Python Code:"># Version 0.5

# import email libraries
import smtplib 			        
from email.message import EmailMessage  

# Define variables 
email_to = 'them@email.com'    #This is obviously a fake address, but using the real thing doesn't work either. It is properly formatted as a string.
email_from = 'me@email.com'   # Same thing, fake, but the correct address doesn't work - also formatted as a string.
email_pw = 'password'              # Yup, another string.

# Read email body text file - this the text of the email I want to send. All data merges are already stored in this file. It is a pure text file.
with open('/Users/larryj/Desktop/temp.txt','r') as file:
    content=file.read()
    
#  Create a text/plain message
msg = EmailMessage()
msg['Subject'] = 'Thank you '
msg['From'] = email_from
msg['To'] = email_to    
msg.set_content(content)     # Content contains the data read from the text file above.

# setup the server
smtp_server = 'secure.emailsrvr.com'      # This is the correct address for Rackspace email
smtp_user = email_from                       # In this case the sender also owns the email account
smtp_password = email_pw

# Send the message - the dashes are ACTUALLY spaces, which this forum removes. They are spaces in the script.
with smtplib.SMTP(smtp_server, 465) as server:  #This is the correct port for SMTP messages on Rackspace email
    server.starttls()           # Upgrades the connection to a secure encrypted SSL/TLS connection
    server.login(smtp_user, smtp_password)
    server.send_message(msg)</pre>]]></description>
			<content:encoded><![CDATA[Hi!<br />
<br />
I'm having problems connecting to and/or sending email through an SMTP server. I've tried everything Google can find, but I'm clearly not understanding something.<br />
<br />
When executing the program below, the code executes with no errors, but everything hangs at the end with a message saying the software unexpectedly lost connection with the server. No messages were sent. Here's the code.<br />
<br />
Thanks! <br />
<br />
Larry<br />
<br />
= = =<br />
<br />
<pre class="brush: python" title="Python Code:"># Version 0.5

# import email libraries
import smtplib 			        
from email.message import EmailMessage  

# Define variables 
email_to = 'them@email.com'    #This is obviously a fake address, but using the real thing doesn't work either. It is properly formatted as a string.
email_from = 'me@email.com'   # Same thing, fake, but the correct address doesn't work - also formatted as a string.
email_pw = 'password'              # Yup, another string.

# Read email body text file - this the text of the email I want to send. All data merges are already stored in this file. It is a pure text file.
with open('/Users/larryj/Desktop/temp.txt','r') as file:
    content=file.read()
    
#  Create a text/plain message
msg = EmailMessage()
msg['Subject'] = 'Thank you '
msg['From'] = email_from
msg['To'] = email_to    
msg.set_content(content)     # Content contains the data read from the text file above.

# setup the server
smtp_server = 'secure.emailsrvr.com'      # This is the correct address for Rackspace email
smtp_user = email_from                       # In this case the sender also owns the email account
smtp_password = email_pw

# Send the message - the dashes are ACTUALLY spaces, which this forum removes. They are spaces in the script.
with smtplib.SMTP(smtp_server, 465) as server:  #This is the correct port for SMTP messages on Rackspace email
    server.starttls()           # Upgrades the connection to a secure encrypted SSL/TLS connection
    server.login(smtp_user, smtp_password)
    server.send_message(msg)</pre>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[smtplib : name of attachment wrongly set to default]]></title>
			<link>https://python-forum.io/thread-46236.html</link>
			<pubDate>Wed, 25 Mar 2026 18:05:08 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://python-forum.io/member.php?action=profile&uid=22990">arbiel</a>]]></dc:creator>
			<guid isPermaLink="false">https://python-forum.io/thread-46236.html</guid>
			<description><![CDATA[Hi<br />
<br />
I wrote a python script to create and send pdf files with "smtplib". I'm creating these files from a template html file with "beautiful soap".  I convert them to pdf with "xhtml2pdf".<br />
<br />
In the resulting e-mail the name of the attachment is not always correctly set. It is sometime set to "default", instead of the file name.<br />
<br />
I ran several tests with various names (hereunder pj0 and pj1). Runing pj0 gets a correct attachment name. Running pj1 gets "default". I have not been able to find what is wrong.<br />
<br />
The code to attach the files and set the attachment name is as follows :<br />
<br />
<pre class="brush: python" title="Python Code:">def smtp () :
	msg = MIMEMultipart()
	
# Compléter l'entête
	msg['Subject'] = ''
	msg['From'] = ''
	msg['To'] = ''
	texte_message =''
	msg.attach(MIMEText(gbl.objets['texte_message'], 'plain'))
	
# Insérer la pièce jointe
	part = MIMEBase('application', 'pdf')
	html_template = ''
	p_jointe = btfs(html_template, 'html.parser')
# I ran several test, commenting the appropriate lines
	pj0 = '/home/arbiel/Téléchargements/ANNEXES 1 A 5.pdf'
	pj1 = '/home/arbiel/Téléchargements/Quittance N°132 (123 €).pdf'

#	with open(pj0, "rb") as f:
#		part.set_payload(f.read())
#	encoders.encode_base64(part)
#	part.add_header(
#		'Content-Disposition',
#		f'attachment; filename="{pj0.split("/")[-1]}"',
#	)   
#	msg.attach(part)


#	convert p_jointe to pdf into pj1
	with open(pj1, "rb") as f:
		part.set_payload(f.read())
	encoders.encode_base64(part)
	part.add_header(
		'Content-Disposition',
		f'attachment; filename="{pj1.split("/")[-1]}',
	)   
	msg.attach(part)
	
# contacter le serveur
	mailServer = smtplib.SMTP('outgoing_server','outgoing_port')
	s = mailServer.login('sender_email', send_password')
	
# envoyer le courriel
	mailServer.send_message(msg)
	mailServer.close()
	</pre>]]></description>
			<content:encoded><![CDATA[Hi<br />
<br />
I wrote a python script to create and send pdf files with "smtplib". I'm creating these files from a template html file with "beautiful soap".  I convert them to pdf with "xhtml2pdf".<br />
<br />
In the resulting e-mail the name of the attachment is not always correctly set. It is sometime set to "default", instead of the file name.<br />
<br />
I ran several tests with various names (hereunder pj0 and pj1). Runing pj0 gets a correct attachment name. Running pj1 gets "default". I have not been able to find what is wrong.<br />
<br />
The code to attach the files and set the attachment name is as follows :<br />
<br />
<pre class="brush: python" title="Python Code:">def smtp () :
	msg = MIMEMultipart()
	
# Compléter l'entête
	msg['Subject'] = ''
	msg['From'] = ''
	msg['To'] = ''
	texte_message =''
	msg.attach(MIMEText(gbl.objets['texte_message'], 'plain'))
	
# Insérer la pièce jointe
	part = MIMEBase('application', 'pdf')
	html_template = ''
	p_jointe = btfs(html_template, 'html.parser')
# I ran several test, commenting the appropriate lines
	pj0 = '/home/arbiel/Téléchargements/ANNEXES 1 A 5.pdf'
	pj1 = '/home/arbiel/Téléchargements/Quittance N°132 (123 €).pdf'

#	with open(pj0, "rb") as f:
#		part.set_payload(f.read())
#	encoders.encode_base64(part)
#	part.add_header(
#		'Content-Disposition',
#		f'attachment; filename="{pj0.split("/")[-1]}"',
#	)   
#	msg.attach(part)


#	convert p_jointe to pdf into pj1
	with open(pj1, "rb") as f:
		part.set_payload(f.read())
	encoders.encode_base64(part)
	part.add_header(
		'Content-Disposition',
		f'attachment; filename="{pj1.split("/")[-1]}',
	)   
	msg.attach(part)
	
# contacter le serveur
	mailServer = smtplib.SMTP('outgoing_server','outgoing_port')
	s = mailServer.login('sender_email', send_password')
	
# envoyer le courriel
	mailServer.send_message(msg)
	mailServer.close()
	</pre>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Metasploit Graph and Append Array Difficulties]]></title>
			<link>https://python-forum.io/thread-46238.html</link>
			<pubDate>Thu, 26 Mar 2026 14:28:20 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://python-forum.io/member.php?action=profile&uid=43015">Tuurbo46</a>]]></dc:creator>
			<guid isPermaLink="false">https://python-forum.io/thread-46238.html</guid>
			<description><![CDATA[Hello,<br />
<br />
So I an creating a graph to display ‘temp’ against ‘time’ reading data from a live temp module. I have created a brief example in notepad++ to confirm it works. I would like to display the temp curve over 60 minutes and append ‘channel_1_temp[]’ and ‘time_minutes_temp[]’ from the start of the test - so essentially the graph grows over time. Below are my notepad++ and the actually example from the live temp module.<br />
<br />
The problem I am having with the ‘temp module example’, is the arrays don’t grow in size. They just stay at two elements. This is odd because the notepad++ example grew in size? Also looking at the below output, the ‘channel_1_temp [ 1 22]’ has a leading space at the start that seems to grow when left running?<br />
<br />
I'm sure I am missing something simple but I cannot see what I am doing wrong.  Or I have completely the wrong concept for what I am trying to do :-)<br />
<br />
Many thanks,<br />
<br />
Tuurbo46<br />
<br />
Notepad++ example:<br />
<br />
<pre class="brush: python" title="Python Code:">import numpy as np
import matplotlib.pyplot as plt

time_minutes = np.array([10, 20, 30, 40, 50]) # Minutes

temp_c = np.array([18, 20, 25, 25, 26])       # Celsius 

time_minutes = np.append(time_minutes, "60")  # add a time to the end of array
temp_c = np.append(temp_c, "30")              # add a temp to the end of array
  
plt.ylabel("C")
plt.xlabel("Minutes")

plt.plot(temp_c, time_minutes)
plt.show()</pre>Temp module example called every 1 minute:<br />
<br />
<pre class="brush: python" title="Python Code:">def temperature_graph():
    
    global time_minutes_temp
    global channel_1_temp
    global temp_chl_1
    global count
    
    count =+ 1 
        
    time_minutes_temp = np.array([1]) # Minutes
    
    channel_1_temp = np.array([1])    # Centigrade
    
    #---- Append time array by 1 minute ----
    time_minutes_temp = np.append(time_minutes_temp, [count]) 
 
    #---- Convert global temp float value to an int ----
    temp_chl_1_int = temp_chl_1   
    temp_chl_1_int = int(temp_chl_1_int)
    
    #---- Append temp array with latest temp value
    channel_1_temp = np.append(channel_1_temp, [temp_chl_1_int]) 
    
    print('time_minutes_temp', time_minutes_temp)
    
    print('channel_1_temp', channel_1_temp)
    
     
    plt.ylabel("C")
    plt.xlabel("Minutes")

    plt.plot(channel_1_temp, time_minutes_temp)
    plt.show()</pre>Temp module output:<br />
<br />
<pre class="brush: python" title="Python Code:">time_minutes_temp [1 1]

channel_1_temp [ 1 22]

time_minutes_temp [1 1]

channel_1_temp [ 1 22]</pre>]]></description>
			<content:encoded><![CDATA[Hello,<br />
<br />
So I an creating a graph to display ‘temp’ against ‘time’ reading data from a live temp module. I have created a brief example in notepad++ to confirm it works. I would like to display the temp curve over 60 minutes and append ‘channel_1_temp[]’ and ‘time_minutes_temp[]’ from the start of the test - so essentially the graph grows over time. Below are my notepad++ and the actually example from the live temp module.<br />
<br />
The problem I am having with the ‘temp module example’, is the arrays don’t grow in size. They just stay at two elements. This is odd because the notepad++ example grew in size? Also looking at the below output, the ‘channel_1_temp [ 1 22]’ has a leading space at the start that seems to grow when left running?<br />
<br />
I'm sure I am missing something simple but I cannot see what I am doing wrong.  Or I have completely the wrong concept for what I am trying to do :-)<br />
<br />
Many thanks,<br />
<br />
Tuurbo46<br />
<br />
Notepad++ example:<br />
<br />
<pre class="brush: python" title="Python Code:">import numpy as np
import matplotlib.pyplot as plt

time_minutes = np.array([10, 20, 30, 40, 50]) # Minutes

temp_c = np.array([18, 20, 25, 25, 26])       # Celsius 

time_minutes = np.append(time_minutes, "60")  # add a time to the end of array
temp_c = np.append(temp_c, "30")              # add a temp to the end of array
  
plt.ylabel("C")
plt.xlabel("Minutes")

plt.plot(temp_c, time_minutes)
plt.show()</pre>Temp module example called every 1 minute:<br />
<br />
<pre class="brush: python" title="Python Code:">def temperature_graph():
    
    global time_minutes_temp
    global channel_1_temp
    global temp_chl_1
    global count
    
    count =+ 1 
        
    time_minutes_temp = np.array([1]) # Minutes
    
    channel_1_temp = np.array([1])    # Centigrade
    
    #---- Append time array by 1 minute ----
    time_minutes_temp = np.append(time_minutes_temp, [count]) 
 
    #---- Convert global temp float value to an int ----
    temp_chl_1_int = temp_chl_1   
    temp_chl_1_int = int(temp_chl_1_int)
    
    #---- Append temp array with latest temp value
    channel_1_temp = np.append(channel_1_temp, [temp_chl_1_int]) 
    
    print('time_minutes_temp', time_minutes_temp)
    
    print('channel_1_temp', channel_1_temp)
    
     
    plt.ylabel("C")
    plt.xlabel("Minutes")

    plt.plot(channel_1_temp, time_minutes_temp)
    plt.show()</pre>Temp module output:<br />
<br />
<pre class="brush: python" title="Python Code:">time_minutes_temp [1 1]

channel_1_temp [ 1 22]

time_minutes_temp [1 1]

channel_1_temp [ 1 22]</pre>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[How to find the '\n' character]]></title>
			<link>https://python-forum.io/thread-46237.html</link>
			<pubDate>Thu, 26 Mar 2026 00:21:08 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://python-forum.io/member.php?action=profile&uid=43779">LarryJ</a>]]></dc:creator>
			<guid isPermaLink="false">https://python-forum.io/thread-46237.html</guid>
			<description><![CDATA[I have a text string, which is extracted from a list: 'first_name\nlast_name\nemail_address'<br />
<br />
I want to find the position of the '\n' character so I can slice the string and assign each section to its own variable: first_name, last_name, email_address. <br />
I figured that if I could find the position of '\n' I could slice the appropriate section. EXCEPT... what should work:<br />
<br />
pattern = r'\'<br />
text.find(pattern)  continually returns -1, meaning that it can't find the new line character, even though that sneaky puppy is hiding in plain sight.<br />
<br />
What's the best/easiest way to separate these three fields into three separate variables?<br />
<br />
Thanks,<br />
<br />
Larry]]></description>
			<content:encoded><![CDATA[I have a text string, which is extracted from a list: 'first_name\nlast_name\nemail_address'<br />
<br />
I want to find the position of the '\n' character so I can slice the string and assign each section to its own variable: first_name, last_name, email_address. <br />
I figured that if I could find the position of '\n' I could slice the appropriate section. EXCEPT... what should work:<br />
<br />
pattern = r'\'<br />
text.find(pattern)  continually returns -1, meaning that it can't find the new line character, even though that sneaky puppy is hiding in plain sight.<br />
<br />
What's the best/easiest way to separate these three fields into three separate variables?<br />
<br />
Thanks,<br />
<br />
Larry]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Need help positioning Entry() fields]]></title>
			<link>https://python-forum.io/thread-46235.html</link>
			<pubDate>Tue, 24 Mar 2026 23:57:52 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://python-forum.io/member.php?action=profile&uid=43779">LarryJ</a>]]></dc:creator>
			<guid isPermaLink="false">https://python-forum.io/thread-46235.html</guid>
			<description><![CDATA[I'm having problems positioning Entry() input fields. I can use Place() to precisely position the field name text (see screen shot), but I can't figure out how to position the Entry() fields to capture input. Place() doesn't seem to work, and Grid() does not have a way to support different column combinations. For example, some have lines with two fields (first &amp; last name, address1 &amp; 2), two with one (email, company) and one with four (city, state, zip, country).  I don't have room to have each field have its own line. <br />
<br />
Note, the gray bars indicate where I want fields located, however these bars are only temporary to help me find placement. <br />
<br />
All suggestions are welcome. <br />
<br />
Thanks,<br />
<br />
Larry<br /><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://python-forum.io/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=3637" target="_blank" title="">Screenshot 2026-03-24 at 7.29.37 PM copy.jpg</a> (Size: 63.46 KB / Downloads: 6)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[I'm having problems positioning Entry() input fields. I can use Place() to precisely position the field name text (see screen shot), but I can't figure out how to position the Entry() fields to capture input. Place() doesn't seem to work, and Grid() does not have a way to support different column combinations. For example, some have lines with two fields (first &amp; last name, address1 &amp; 2), two with one (email, company) and one with four (city, state, zip, country).  I don't have room to have each field have its own line. <br />
<br />
Note, the gray bars indicate where I want fields located, however these bars are only temporary to help me find placement. <br />
<br />
All suggestions are welcome. <br />
<br />
Thanks,<br />
<br />
Larry<br /><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://python-forum.io/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=3637" target="_blank" title="">Screenshot 2026-03-24 at 7.29.37 PM copy.jpg</a> (Size: 63.46 KB / Downloads: 6)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Unable to install pygame]]></title>
			<link>https://python-forum.io/thread-46233.html</link>
			<pubDate>Mon, 23 Mar 2026 02:08:24 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://python-forum.io/member.php?action=profile&uid=43775">never_too_old</a>]]></dc:creator>
			<guid isPermaLink="false">https://python-forum.io/thread-46233.html</guid>
			<description><![CDATA[I have been unable to install pygame and have attempted every fix I can find online without success. I have include error message.  Has anyone else encountered this issue.<br />
<br />
Microsoft Windows [Version 10.0.26200.8037]<br />
&copy; Microsoft Corporation. All rights reserved.<br />
<br />
C:\Users\andre&gt;pip install pygame<br />
Collecting pygame<br />
  Using cached pygame-2.6.1.tar.gz (14.8 MB)<br />
  Installing build dependencies ... done<br />
  Getting requirements to build wheel ... error<br />
  error: subprocess-exited-with-error<br />
<br />
  × Getting requirements to build wheel did not run successfully.<br />
  │ exit code: 1<br />
  ╰─&gt; [123 lines of output]<br />
      Skipping Cython compilation<br />
<br />
<br />
      WARNING, No "Setup" File Exists, Running "buildconfig/config.py"<br />
      Using WINDOWS configuration...<br />
<br />
Hoping someone can offer a suggestion or fix  <img src="https://python-forum.io/images/smilies/smile.png" alt="Smile" title="Smile" class="smilie smilie_1" />]]></description>
			<content:encoded><![CDATA[I have been unable to install pygame and have attempted every fix I can find online without success. I have include error message.  Has anyone else encountered this issue.<br />
<br />
Microsoft Windows [Version 10.0.26200.8037]<br />
&copy; Microsoft Corporation. All rights reserved.<br />
<br />
C:\Users\andre&gt;pip install pygame<br />
Collecting pygame<br />
  Using cached pygame-2.6.1.tar.gz (14.8 MB)<br />
  Installing build dependencies ... done<br />
  Getting requirements to build wheel ... error<br />
  error: subprocess-exited-with-error<br />
<br />
  × Getting requirements to build wheel did not run successfully.<br />
  │ exit code: 1<br />
  ╰─&gt; [123 lines of output]<br />
      Skipping Cython compilation<br />
<br />
<br />
      WARNING, No "Setup" File Exists, Running "buildconfig/config.py"<br />
      Using WINDOWS configuration...<br />
<br />
Hoping someone can offer a suggestion or fix  <img src="https://python-forum.io/images/smilies/smile.png" alt="Smile" title="Smile" class="smilie smilie_1" />]]></content:encoded>
		</item>
	</channel>
</rss>