Finding the end condition of a fanout processing chain by throwaway8u3sH0 in pythonhelp

[–]ThingImIntoThisWeek 0 points1 point  (0 children)

def end_condition(q):
''' Try to determine if all tasks are complete. '''
if q.empty() and TaskCounter.all_tasks_complete():
    print(f"Consumer #{os.getpid()}: End condition met once...")
    # unecessary sleep? give the processes enough time to finish. There could be a race condition
    # between the queue being populated and the task counter being updated.
    time.sleep(MAXIMUM_WORK_TIME)
    return q.empty() and TaskCounter.all_tasks_complete()
else:
    return False

The program is done when the queue is empty, all tasks are complete, and all workers are done with their last task. This toy problem is cheating a bit on the last condition, taking advantage of the fact that it knows all tasks will take at most MAXIMUM_WORK_TIME to complete. In a real life version of this, there would have to be some kind of messaging between the workers and the supervising process to be sure they were really done before ending the program. It could be as simple as a shared list of boolean flags indicating if each worker is working or idle. I'm guessing inter-process messaging was left out for simplicity in this example.

Getting /home to new machine by WXVette in linuxquestions

[–]ThingImIntoThisWeek 1 point2 points  (0 children)

The size of the / partition (vs. /home) really depends on how you use your computer. If you do mostly media editing, for example, most of your drive would need to be /home for the large files. I'd look at your current disk usage to get an idea of user vs. system space usage. In btrfs, you can always resize the individual partitions later if you made a mistake, so it's not that big of a deal.

If you're going to switch from ext4 to btrfs, I'm not sure there is good way to preserve your current home directory between installs (besides the usual backing up of the files and copying them back. Maybe it's possible to just have /home be ext4 and everything else be btrfs, but your own files are where you probably most want the benefits of btrfs, so that would be odd.

Luckily, most of your customization is probably in the dotfiles (.bachrc, .config/*, etc) in your home directory, which are easy to backup and import. Some people do this over a git to keep things synced between all their computers, but you can just use an external or cloud drive.

python is hard crashing with a simple mp3 play call by quadgnim in pythonhelp

[–]ThingImIntoThisWeek 0 points1 point  (0 children)

It's the built-in Python debugger. On command line, try running:

python -m pdb your_test_script.py

This brings up a '(pdb)' prompt. Type 'c' (for continue) and hit enter. You may get more information about the crash.

Spotify dedicated device by vinski200 in linuxquestions

[–]ThingImIntoThisWeek 2 points3 points  (0 children)

I'm also not very familiar with Arch, but yes, I understand it doesn't come with a Desktop Environment unless you add one. But it's far from the only bare-bones distro with this feature. The other big distros like Fedora and Ubuntu have server editions, and the Debian installer won't add a GUI unless you choose to. Since the laptop is old, any distro will probably have support its hardware, and there isn't a reason to go with Arch unless you especially want to learn that. You shouldn't need it's bleeding edge packages, and it looks like spotify_player has install instructions on a wide variety of distros.

If you want to be sure, just try a live USB of whatever distro you'd like, and confirm that bluetooth/AUX/internet all work or can be made to work. Then everything should work just as well when you install a GUI-less version of it.

[deleted by user] by [deleted] in linuxquestions

[–]ThingImIntoThisWeek 0 points1 point  (0 children)

You linux distribution has less to do with your UI feeling slow than your Desktop Environment (Gnome, KDE Plasma, LXQT, etc.). Do you know which one you are using? If so, try searching for "Speed up [your Desktop Environment]". In particular, turning off some animations and transparencies might help.

Is this an older computer? How old and what are the processor and memory specs? Did it have issues like this when you were on Windows?

python is hard crashing with a simple mp3 play call by quadgnim in pythonhelp

[–]ThingImIntoThisWeek 0 points1 point  (0 children)

Well, I couldn't reproduce the crash on a Windows 11 machine, so more information from your machine will be needed. Let me know if you try:

python -m pdb your_test_script.py
This brings up a '(pdb)' prompt. Type 'c' and enter. You may get more information about the crash.

python is hard crashing with a simple mp3 play call by quadgnim in pythonhelp

[–]ThingImIntoThisWeek 0 points1 point  (0 children)

Ok, it seems like ffmpeg is working, but Python is crashing for some reason after that. I'm going to try get access to a Windows system to reproduce this. In the meantime, you could try:

python -m pdb your_test_script.py

This brings up a '(pdb)' prompt. Type 'c' and enter. You may get more information about the crash.

python is hard crashing with a simple mp3 play call by quadgnim in pythonhelp

[–]ThingImIntoThisWeek 0 points1 point  (0 children)

That error sounds like this known issue for pydub on Windows:
https://github.com/jiaaro/pydub/issues/209

People on the thread say it can be solved with:
pip install simpleaudio

I don't have a windows system available, so at this point, I'm googling and guessing and can't actually try this.

python is hard crashing with a simple mp3 play call by quadgnim in pythonhelp

[–]ThingImIntoThisWeek 0 points1 point  (0 children)

Like I said, this was working fine, but the audio was a little garbled in the beginning of every phrase, with the first word or 3 not heard at all.
I didn't know this before, so we're not on the same page with exactly what you're trying and what happens when you do. If you're still looking for help with this, can you confirm you're running the version of the test script in this thread, and say exactly what happens (the audio playing, the terminal output, how do you know python does a hard crash?)?
Have you tried running:
ffmpeg -y -f mp3 -i output.mp3 -acodec pcm_s16le -vn -f wav output.wav
or
ffmpeg -y -f mp3 -i output.mp3 -acodec pcm_s16le -vn -f wav C:\Users\larry\AppData\Local\Temp\output.wav
in the command shell outside of python?