ImportError: when importing from a local script library

71 Views Asked by At

Does importing from a local script lib work in qpython3?

I have a script I created in the Qpython projects3 directory of qpython.

projects3/MPU6502/

I have my main code here in this directory.

main.py

I have a local subdirectory,

projects3/MPU6502/tiny6502lib/

In this sub directory I have the source code,

RAM_8bit_Memory.py

From my main.py source code I load the library,

#-*-coding:utf8;-*-
#qpy:3
#qpy:console
# import 6502 library module
from tiny6502lib.RAM_8bit_Memory import *

when I execute the library import I get the ERRORL: "ImportError: No module named tiny6502lib.RAM_8bit_Memory"

Is importing local script libraries broken in qpython3?

org.qpython.py/projects/MPU6502/main.py

org.qpython.py/projects/MPU6502/tiny6502lib/RAM_8bit_Memory.py

This code works perfectly on all other flavors of python3 (windows) and pythonista on ipad.

How do I get this import to work? Or does it not work at all?

thank you,

1

There are 1 best solutions below

1
On

Just try to insert the following code before importing tiny6502lib.RAM_8bit_Memory

import sys sys.path.append("/sdcard/qpython/projects3/MPU6502") ?