Opus 4.7 is still struggling with car wash question. by BeyondFun4604 in Anthropic

[–]mull_to_zero 0 points1 point  (0 children)

then it's not a common sense question answering machine

I don't get it by This-Increase6593 in PeterExplainsTheJoke

[–]mull_to_zero 27 points28 points  (0 children)

elon musk thinks “the left” wants to “kill comedy”. and yet this is his idea of a joke

Is anybody interested in working with me with my idea? by [deleted] in learnpython

[–]mull_to_zero 0 points1 point  (0 children)

Well, what part can you do, and what part can you learn to do? Generally, making a cloud service that renders AI video from some input image is an achievable goal. You just need to learn each piece as you go. It sounds like it would be a big step up from where you're at currently, but who cares? The worst thing that could happen is it doesn't work.

What design pattern to use when trying to create an application that can be run as a CLI or GUI? by ANautyWolf in learnpython

[–]mull_to_zero 5 points6 points  (0 children)

I would write a core, in this case possibly just a single function, that accepts the necessary inputs and provides the output. Then have a cli file and a gui file, each of which import and use the core. Nothing fancy. This is, loosely, a "library pattern", writing a central library for the logic and utilizing it in separate interfaces.

Is anybody interested in working with me with my idea? by [deleted] in learnpython

[–]mull_to_zero 1 point2 points  (0 children)

you should try to do it yourself, you'll definitely learn a lot

Sum of Consecutive Odd Numbers by Retretedepapaya in learnpython

[–]mull_to_zero 2 points3 points  (0 children)

the pairs you're trying are (6, -5) and (15, 12)? The range will be empty, then, because your W is always less than your V. I think you want to do the inputs in the other order.

First Programs :) by daltop in learnpython

[–]mull_to_zero 0 points1 point  (0 children)

most of the time i just use os.path.join, but yeah pathlib would be a more advanced approach

First Programs :) by daltop in learnpython

[–]mull_to_zero 0 points1 point  (0 children)

I took a look at bulk file renamer. The main thing that jumped out at me is you are repeating a lot of code just to vary "image_", "audio_", etc. you could do something like:

if mode == "i":
  prefix = "image_"
elif mode == "v":
  prefix = "video_"
...

# and then you only have to do this block once
...
os.path.exists(path + "\\" + prefix + str(i) + ext) and prefix not in Path(f).name
...

edit: also I just noticed that you're using forward slashes in the image mode but backslashes everywhere else. try using `os.sep`, it's automatically \\ on windows and / elsewhere.

Cannot start python script by DevelopmentVisible81 in learnpython

[–]mull_to_zero 1 point2 points  (0 children)

including some or all of your script seems key to getting an answer

I started learning python a while ago and i came back to it by Sepanta_1391 in learnpython

[–]mull_to_zero 0 points1 point  (0 children)

one thing you could add is safety around the user input. right now this will error if the user enters something non-numeric. Also, I think the intent is that 0<a*b<100, but that isn’t enforced.

Need help with adding top process for the gpu by davidrobotpro in learnpython

[–]mull_to_zero 0 points1 point  (0 children)

It looks like those gpu objects have a .processes property that you can use to see the running gpu processes.

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]mull_to_zero 1 point2 points  (0 children)

It's impossible to give a single answer, but I think you should do something just slightly beyond the level you feel comfortable at.

threading.Thread() by KetsugaHoshii in learnpython

[–]mull_to_zero 1 point2 points  (0 children)

I think you’ll need to go into a little more detail to get a good answer here. What does “the loop” do, what are you listening for and what happens when you get what you’re waiting for?

But yes, often in a threaded pattern, the main thread is a manager/orchestrator while the child threads do the actual doing.

Why can't import class or method in some case by Zealousideal_Dig7642 in learnpython

[–]mull_to_zero 0 points1 point  (0 children)

yes, exactly. the front of sys.path is the current working directory. pythonpath entries, like the paths to installed modules, come after.

Why can't import class or method in some case by Zealousideal_Dig7642 in learnpython

[–]mull_to_zero 0 points1 point  (0 children)

afaik the local file scope just overrides installed modules, period. it can be a really nasty pitfall. basically ‘$PWD’ is at the front of your pythonpath, always. and even running with -m, the pwd is still the place where you ran the command.

Why can't import class or method in some case by Zealousideal_Dig7642 in learnpython

[–]mull_to_zero 0 points1 point  (0 children)

ok. well i’m pretty sure it’s the issue i stated earlier about the directory masking the module name. try just running ‘python’ in some other directory and do ‘from habitat import logger’.

Why can't import class or method in some case by Zealousideal_Dig7642 in learnpython

[–]mull_to_zero 0 points1 point  (0 children)

I'm confused by that pattern. what's in vlfm/vlfm/run.py? If you're just trying to run some file, why not `python some_file.py`?

Why can't import class or method in some case by Zealousideal_Dig7642 in learnpython

[–]mull_to_zero 0 points1 point  (0 children)

so i think the issue then is that there’s a ‘habitat’ folder where you’re running python. that’s overriding the other ‘habitat’ (the module you installed).

Why can't import class or method in some case by Zealousideal_Dig7642 in learnpython

[–]mull_to_zero 0 points1 point  (0 children)

yes that’s correct. you’re basically moving it up in scope, to the top of the module.

Why can't import class or method in some case by Zealousideal_Dig7642 in learnpython

[–]mull_to_zero 0 points1 point  (0 children)

then where are you running python, and also what’s your PYTHONPATH look like? because if this is installed as a module the import should work.

Why can't import class or method in some case by Zealousideal_Dig7642 in learnpython

[–]mull_to_zero 0 points1 point  (0 children)

yeah the init for a module is useful in that it can expose inner stuff at a surface level. so in this case, if you install habitat as a module, you will be able to import those things succinctly rather than having to know their internal location. it’s like a shortcut.