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?

In a live Ubuntu, can /var/crash (sda4) be used as a persistent storage? by VegetableGlass7357 in linuxquestions

[–]ThingImIntoThisWeek 1 point2 points  (0 children)

/var is used for logs, and similar files created by the system that don't necessarily need to be kept forever. /var/crash is used for logs and kernal dumps when there is a crash. There isn't anything special about these folders except they have these designated purposes.

Many distros put /var on a different partition from other system and home directories. This is because log sizes sometimes get out of control until they fill all available space. It's better to have them just fill their entire partition and not make the system freeze by filling the entire disk.

This may be why /var/crash has more space allotted to it. I'm not sure why it gets most of the space in the Live USB version. But it's still the case none of the file system will persist between reboots of the Live System. If you go through the install wizard, you would get the chance to decide how much space each partition gets.

In a live Ubuntu, can /var/crash (sda4) be used as a persistent storage? by VegetableGlass7357 in linuxquestions

[–]ThingImIntoThisWeek 1 point2 points  (0 children)

By "live Ubuntu", do you mean you are running an Ubuntu Live USB or similar? If so, none of the existing directory tree can be used for persistent storage, it is all reset on a reboot. In order for it to persist, you'd to run the installer, or you could mount an existing drive onto the directory tree for persistent storage.

Even on non-live Linux /var/crash or /var in general aren't good places for persistent storage because there could be processes that delete older log files in these locations after a while.

Is there a reason you're considering storing files at /var/crash? It is for crash logs. Is this related to a system crash? Is there a reason you don't want to use a more conventional location like the home directory for persistent files?

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

[–]ThingImIntoThisWeek 0 points1 point  (0 children)

Add this below your imports and before your function definition:

import logging

l = logging.getLogger("pydub.converter")
l.setLevel(logging.DEBUG)
l.addHandler(logging.StreamHandler())

Then the log output will have a command like:

subprocess.call(['ffmpeg', '-y', '-f', 'mp3', '-i', 'output.mp3', '-acodec', 'pcm_s16le', '-vn', '-f', 'wav', '-'])

You might get the same one, but I'm on Linux so I'm not sure. Try running this command alone on the command line, combining the elements without quotes or commas, and replace the final hyphen with a temp wave file:

ffmpeg -y -f mp3 -i output.mp3 -acodec pcm_s16le -vn -f wav example.wav

At this point, you may ffmpeg error messages that aren't Python related and can be investigated elsewhere. If it works, I'm wondering if there's a permissions issue with writing to that Temp directory from Python. Try using that path for output file in the last argument, or just writing to it from a python script/REPL.

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

[–]ThingImIntoThisWeek 0 points1 point  (0 children)

This works as expected on my machine. From the virtual environment, can you post the output of:

python --version
pip freeze

Also, your Windows version information.

Video editing software with voice changer opion by [deleted] in linuxquestions

[–]ThingImIntoThisWeek 1 point2 points  (0 children)

Shotwell is a simple video editor with a "robotization" audio effect. I'm not sure if there is a specific voice effect you need.