2

trying to load python script from computer to google colab but is show me importError

enter image description here

Sandeep Agrawal
  • 133
  • 1
  • 7

2 Answers2

3

Change the file name abc.py for something else, like testo.py and it will work.

from google.colab import files

upload = files.upload()

check with !ls

testo.py

Try:

import testo

testo.myfunction()

hello world !

Explanation: abc is a built-in module and you should not use that name for your modules. Check this question for more info.

programandoconro
  • 1,704
  • 2
  • 11
  • 26
1

the abc module don't have my_function class/attribute/function/etc in the code this was example for reading the abc module go to python_home/Lib/abc.py and for reading the _abc module that written in C go to https://github.com/python/cpython/blob/master/Modules/_abc.c in github