I am trying to import a function defined in another module.

The code is this:

name = 'Jim'
sex = 'm'
coach = 'Dwight'
import importlib
sentence = 'Hi, there, ' + name + '. My name is ' + coach + '. I will be
your coach today.'
importlib.import_module ('humprint', 'Macintosh
HD/Users/dwightgoldwindex/Documents/Active Information/ACL/Testing
Code/Simulate typing.py')

The response and error message I receive is this:

Traceback (most recent call last):
File "Intro.py", line 7, in <module>
importlib.import_module ('humprint', 'Macintosh
HD/Users/dwightgoldwindex/Documents/Active Information/ACL/Testing
Code/Simulate typing.py')
File 
"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/_
_init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2249, in _gcd_import
File "<frozen importlib._bootstrap>", line 2199, in _sanity_check
SystemError: Parent module 'Macintosh
HD/Users/dwightgoldwindex/Documents/Active Information/ACL/Testing
Code/Simulate typing.py' not loaded, cannot perform relative import

How can I change my code to have the import work properly?


Thank you.

BIG SMILE...

Always, Dwight


www.3forliving.key.to (video playlist on YouTube)
www.couragebooks.key.to (all my books on Amazon)



-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to