Skip to content
Importing Python files
Profile icon
MartinRose

I have had problems importing my python files on repl.it but I can do it when I do it locally. I have been searching around to get an answer but all the methods have come up empty, maybe someone here can help. I have tried to import with these commands:
import TommyTheSegest
from TommyTheSegest import *
from TommyTheSegest import initiate

I named it that because I wanted to make sure that I did not collide with a command that it was trying to import from elsewhere, at least that was my intent. When I try those commands, I think my Linux tries to install an external command and I have no idea why. I get this error to be more exact:

"
Repl.it: Installing fresh packages

Collecting TommyThe Segest
Could not find a version that satisfies the requirement TommyTheSegest (from versions: )
No matching distributions found for TommyTheGreatest
You are using pip version 19.0.0, however version 19.2.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Repl.it: package installation failed!
"

I am familiar with some Linux and sees that the pip command has less to do with Pythong and more with the Linux itself. I tryed typing the command in the console just in case but of course that did not work. What am I doing wrong?

Thanks in advance
A frustrated beginner

You are viewing a single comment. View All
Profile icon
ArchieMaclean

Thank you for the great explanation of your problem!

You've just made one tiny error - the other file (TommyTheSegest) is a python file, so it should be called TommyTheSegest.py. Like this:

image

Python was looking for a python file and since it couldn't find it, it tried to download one using pip, causing the error.
Once you've renamed the file, the import error should be resolved - there are also a couple of errors that are in the file that are unrelated to this problem, but I'll let you work those out yourself.

Please mark this as the answer if it solved your problem :)

Profile icon
MartinRose

@ArchieMaclean
Thank you so much. I didn't notice that. Was driving me mad.

Profile icon
ArchieMaclean

@MartinRose
No problem :)

Profile icon
SCOTBUTZBACH

@ArchieMaclean
In the picture, I think the background is in dark mode.

Profile icon
ArchieMaclean

@SCOTBUTZBACH
It is, is that a problem?

Profile icon
SCOTBUTZBACH
Profile icon
ArchieMaclean