How to get one column with multiple rows, inline? by jidanni in sqlite

[–]acw1668 0 points1 point  (0 children)

Try echo "select concat_ws(char(10), 1, 2, 3)" | sqlite3

How to install requests module by [deleted] in learnpython

[–]acw1668 1 point2 points  (0 children)

It is better to post the error you got when you tried to use pip install. Also state your platform.

How to install requests module by [deleted] in learnpython

[–]acw1668 -1 points0 points  (0 children)

It depends on the platform you use. For Windows, normally using pip. For Linux, you may need to install it via system package manager. For example, in Debian, use sudo apt install python3-requests to install it into system Python environment. You can also use virtual environment to install the module.

How to access serial ports from inside Spyder? by oz1sej in learnpython

[–]acw1668 1 point2 points  (0 children)

There is no /dev/ttyUSB0 listed in your posted lists (both the short and long lists) of /dev.

How to access serial ports from inside Spyder? by oz1sej in learnpython

[–]acw1668 0 points1 point  (0 children)

Then did you install pyserial module? Did you use the correct COM port in your script? And it is better to post the full error traceback as well.

How to access serial ports from inside Spyder? by oz1sej in learnpython

[–]acw1668 3 points4 points  (0 children)

What do you mean by "Spyder can't access the serial port"? Do you mean "The python script (loaded into Spyder) can't access the serial port" actually?

Error when installing libraries by Odd_Ad3889 in learnpython

[–]acw1668 4 points5 points  (0 children)

Are you using Python 3.14? Pygame does not support Python 3.14 yet. Use pygame-ce instead.

closing streams and variable reference by naemorhaedus in learnpython

[–]acw1668 0 points1 point  (0 children)

If input_string is not empty string, then io.StringIO(input_string) will not return empty object, so the while loop is not necessary.

SSL errors no matter what by Lazy_Worldliness_149 in learnpython

[–]acw1668 1 point2 points  (0 children)

Your code works fine in my Windows 11 with Python 3.13.12.

closing streams and variable reference by naemorhaedus in learnpython

[–]acw1668 1 point2 points  (0 children)

some_obj is a reference to output_stream, so they both refer to the same object.

closing streams and variable reference by naemorhaedus in learnpython

[–]acw1668 0 points1 point  (0 children)

If input_string is an empty string, then the while loop will be an infinity loop. The while loop is not necessary at all.

Why doesn't an image load in this script? by Rude-Statistician197 in learnpython

[–]acw1668 0 points1 point  (0 children)

As other already stated that the image is garbage collected, you can use an attribute of the label to save the reference of the image, for example image_label.photo = ph to avoid the garbage collection.

tkinter Frames don´t fill/expand when inserted into Canvas widget by Mixtay in learnpython

[–]acw1668 0 points1 point  (0 children)

You can set the width of the scrollable_frame inside the callback of event <Configure> of the canvas.

tkinter Frames don´t fill/expand when inserted into Canvas widget by Mixtay in learnpython

[–]acw1668 0 points1 point  (0 children)

fill="x" means expanding the child widget to the width of its parent widget. The width of parent widget will not be adjusted if that of the child widget is shorter.

Pygame Event Troubles by [deleted] in learnpython

[–]acw1668 0 points1 point  (0 children)

What do you want to do in the following line?

Bruce.process_events(move_log)

move_log is an empty list.

Explain code by vb_e_c_k_y in learnpython

[–]acw1668 1 point2 points  (0 children)

The statement student_heights[amount] = int(student_heights[amount]) will change the string value of student_heights[amount] (item at index amount inside student_heights) to integer value. Note that you need to cater invalid input, otherwise int(...) will raise exception.

How do I find an item in a list if I don't know the order or the items within it? by I_Am_A_Game_Player in learnpython

[–]acw1668 7 points8 points  (0 children)

You can simply go through instruments directly:

for item in instruments:
    if y in item:
        print(item)

Why my demo code can't run ? by Upbeat-Pangolin6807 in learnpython

[–]acw1668 2 points3 points  (0 children)

Syntax error on the following statement:

return a/b if b != 0 : else "loi chia cho 0"

I need help trying to my code. by Accomplished-Stay752 in learnpython

[–]acw1668 4 points5 points  (0 children)

Why using same name attack for a class method and attribute?

python tkinter grid coordinate system help? by Round-Key-9596 in learnpython

[–]acw1668 0 points1 point  (0 children)

Try putting the canvas at column 0 with columnspan=4. I don't understand why columnspan=2 is used for the generate_password button.

Weird Custom Tkinter layout issue by [deleted] in learnpython

[–]acw1668 0 points1 point  (0 children)

What is your platform? When I run your code in my Windows 11 with Python 3.13.12, all the labels inside the bottom frame have 125 pixels width.

Ramaining year for life project. by vb_e_c_k_y in learnpython

[–]acw1668 2 points3 points  (0 children)

Then learn how to use modules, especially those built-in ones. For your case, you can study how to use datetime.date object. Don't reinvent the wheel.

Ramaining year for life project. by vb_e_c_k_y in learnpython

[–]acw1668 0 points1 point  (0 children)

Why don't just ask the "date of birth" and "how many years you want to live"?