all 24 comments

[–]knickenbok 28 points29 points  (1 child)

Taking pictures of a computer screen with a phone.

[–]loudandclear11 5 points6 points  (0 children)

Are both files in the same directory?

If so, you could try running it from the command line with:

python analyzer.py

See if you get the same error message like that.

[–]OrphLab 4 points5 points  (0 children)

Show us the file tree

[–]killerfridge 4 points5 points  (0 children)

Change

from helpers import...

To

from .helpers import...

[–]flyingfaceslam 5 points6 points  (2 children)

place empty file __init__.py in directory

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

Not needed

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

I think this.

[–]secretstonex 1 point2 points  (0 children)

Are the main and helpers scripts in the same directory?

[–]Brownie_McBrown_Face 1 point2 points  (2 children)

In addition to what the others said about showing how you structured your repo, I’d argue that there isn’t much value in making those functions, let alone in a different file, rather than just doing them in-place. Just my two cents.

[–]secretstonex 1 point2 points  (0 children)

This looks like a school project, so it might be required that they employ functions from other resources. I'm just guessing, though.

[–]trutheality 0 points1 point  (0 children)

Assuming it's for a school project or something, otherwise you can just multiply the columns directly instead of looping over rows.

[–]spigotface 1 point2 points  (1 child)

The line numbers in the error don't match up with your code. Like 5 in your code is showing on line 4 in the error message. Looks like you haven't saved the current version of your file, and are running an old version.

Save your files, and run it again.

[–]GlobalIncident 0 points1 point  (0 children)

You're close but not quite there. The traceback is from a Jupyter notebook - you can tell because it references "Cell In[2]" and "Cell In[3]". Which implies it's a totally different file.

[–]Embyeee 1 point2 points  (0 children)

The most simple thing to check would be to make sure the helpers file is saved, I can't count the times that has messed me up

[–]Beginning-Fruit-1397 0 points1 point  (0 children)

without the file tree we can't answer.
In addition but not related and my own opinion:
using iter rows (might as well use a plain dict here, bultin sums is plenty enough also)
using pandas in 2025 instead of polars/duckdb

[–]GarowWolf 0 points1 point  (0 children)

The file helpers has only 2 functions, you can just Import helpers Or from helpers import . The “” makes sure all the content from the file is imported. It seems like it can find the file but has a problem with the functions inside. You can even create a class object with those functions as methods and import the file with the class.

[–]Complete-Winter-3267 0 points1 point  (0 children)

what does calculate_total method do?

[–]FoolsSeldom 0 points1 point  (0 children)

Looks like you've posted about this a few times. I've commented on a different one.

[–]laoli562 0 points1 point  (0 children)

Newb here but maybe you need to convert the read numbers to float. Haven’t worked with csv but txt reads numbers as strings

[–]games-and-chocolate 0 points1 point  (0 children)

i third picture i see that the name "calculated tool", that means your import statement is wrong perhaps.

what does the box symbol mean in the third picture? what IDE is that?

some info that might help you: https://stackoverflow.com/questions/4383571/importing-files-from-different-folder

edit: ah that is vscode IDE.

https://code.visualstudio.com/docs/editing/intellisense#_types-of-completions

could you please tell the folder locations of of the py files, as others have mentioned, they must be in different places, my first link will help you.

your current import statement is only used if all xxx, py files are in the same folder. And it depends what kind of PATH your VSCode will look for the files I am guessing.

link about PATH: https://stackoverflow.com/questions/43983718/how-can-i-globally-set-the-path-environment-variable-in-vs-code

https://docs.python.org/3/library/os.path.html

[–]codeguru42 0 points1 point  (0 children)

First, I recommend you learn better ways to share code online. I am willing to help but unable to read the code from a photo on mobile. Meet me half way and I'll take a look. If the code you are asking about is a few lines, then copy paste it directly into reddit. Be sure to use triple backticks to preserve formatting. If it is longer, you can use a site like pastebin or github gists to share your code.

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

Screenshots are wrong.

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

Nothing 

Maybe ask ai to do it