I have a python app that I have moved recently from the Windows box I developed it on to a Linux (CentOS) server. Everything runs fine in PyCharm on my workstation I wrote the code on, however, upon zipping/tarring the containing folder, regardless of where I move it, I get the following error when attempting to execute the application:
python ..\CONTROLLER\SFTPController.py
Traceback (most recent call last):
File "..\CONTROLLER\SFTPController.py", line 3, in <module>
from SFTP import SFTPGet,SFTPPut
ImportError: No module named SFTP
The above will occur if I move the copy of the source directory anywhere other than where it was developed originally.
I've done a little research on this and it doesn't matter what my current working directory is. The result is always what you see above. My Python experience has been limited to single file one-off scripts normally, so this is something I have no experience with previous.
If it helps, here is my application structure:
Top level directory: Filestuff
Filestuff
|... __init__.py
|... .idea (PyCharm created directory)
|... CONTROLLER|
|... __init__.py
|... SFTPController.py
|... SFTP|
|... __init__.py
|... SFTPGet.py
|... SFTPPut.py
|... ZIP|
|... __init__.py
|... ZIPWork.py
As you can see, Filestuff is the top level. It contains init.py and the 3 other directories that contain their .py files as well as their init.py files. This to me looks like a standard Python package that should work if you import it to any system without changing the structure. I'm sure it's something stupid simple that I must have missed. I really appreciate any help in figuring this out!