Just to report it. (from newbie, keviv22)
Never and never, for your own good, name folders or files with spaces or characters like "-" or "_". If you do this, you may encounter several problems. like mine, letβs say, although your import command is correct, you cannot successfully import the necessary files that are available inside such named folders.
Invalid folder names:
- Generic Classes Folder
- Generic_Classes_Folder
Valid folder names for above:
- GenericClassesFolder or Genericclassesfolder or genericClassesFolder (or something like this without spaces or special characters among words)
What mistake I made:
consider the file structure.
Parent . __init__.py . Setup .. __init__.py .. Generic-Class-Folder ... __init__.py ... targetClass.py . Check .. __init__.py .. testFile.py
What did I want to do?
- from testFile.py, I wanted to import the targetClass.py file into the Generic-Class-Folder file to use a function named "functionExecute" in the file "targetClass.py"
Which team did I make?
- from 'testFile.py', wrote a command, from the core import function Core.Generic-Class-Folder.targetClassExecute
- Errors received, such as "Syntax: invalid syntax"
I tried a lot of queries and looked at a lot of questions about the stack and could not decide what went wrong. I cross-checked my files several times, I used the __init__.py file, inserted the environment path and was very worried that something went wrong ...
And after a long, long time, I realized this while talking with my friend. I'm a little dumb to use such naming conventions. I should never use a space or special characters to specify a name for any folder or file. So this is what I wanted to convey. Have a good day!
(sorry for the huge post over this ... just let my frustrations go ... :) Thanks!)
Vivek22 Jan 27 '17 at 12:04 on 2017-01-27 12:04
source share