ImportError: No module named multipli

Y

yahya Kacem

Hi, i have this 2 files:

file named multipli:

#!/usr/bin/python3.2
#-* - coding : utf-8 -*
def table(nb, max):
i = 0
while i < max:
print(i + 1, " * ", nb, "= ", (i + 1) * nb)

and file naled test:

#!/usr/bin/python3.2
# -* - coding : utf-8 -*
import os
import sys
from multipli import table
table(3, 20)
os.system("pause")

when i run this:

python3 test

I get this error:
Traceback (most recent call last):
File "test", line 5, in <module>
from multipli import table
ImportError: No module named multipli
both files are in the same directory.
any help thanks in advance.
 
K

Kwpolska

Hi, i have this 2 files:

file named multipli:

#!/usr/bin/python3.2
#-* - coding : utf-8 -*
def table(nb, max):
i = 0
while i < max:
print(i + 1, " * ", nb, "= ", (i + 1) * nb)

and file naled test:

#!/usr/bin/python3.2
# -* - coding : utf-8 -*
import os
import sys
from multipli import table
table(3, 20)
os.system("pause")

when i run this:

python3 test

I get this error:
Traceback (most recent call last):
File "test", line 5, in <module>
from multipli import table
ImportError: No module named multipli
both files are in the same directory.
any help thanks in advance.

make them test.py and multipli.py.
 
Y

yahya Kacem

Hi, i have this 2 files:



file named multipli:



#!/usr/bin/python3.2

#-* - coding : utf-8 -*

def table(nb, max):

i = 0

while i < max:

print(i + 1, " * ", nb, "= ", (i + 1) * nb)



and file naled test:



#!/usr/bin/python3.2

# -* - coding : utf-8 -*

import os

import sys

from multipli import table

table(3, 20)

os.system("pause")



when i run this:



python3 test



I get this error:

Traceback (most recent call last):

File "test", line 5, in <module>

from multipli import table

ImportError: No module named multipli

both files are in the same directory.

any help thanks in advance.

Thanks that did it.
 
C

Chris Angelico

Before or after fixing the infinite loop? :)

Before. Then you run it, see it spew text to the console, and hit Ctrl-C.

Programming is iterative: once you fix one problem, you find the next.
Programming is also recursive: in fixing one problem, you sometimes
have to deal with others that it depends on. Programming is
functional, too: you take a list of problems, apply the "Code"
function to them, and keep the list of return values, which will be
hopefully-working code. And programming is object-oriented... whatever
you do, someone will object to it.

ChrisA
 
Y

yahya Kacem

Hi, i have this 2 files:



file named multipli:



#!/usr/bin/python3.2

#-* - coding : utf-8 -*

def table(nb, max):

i = 0

while i < max:

print(i + 1, " * ", nb, "= ", (i + 1) * nb)



and file naled test:



#!/usr/bin/python3.2

# -* - coding : utf-8 -*

import os

import sys

from multipli import table

table(3, 20)

os.system("pause")



when i run this:



python3 test



I get this error:

Traceback (most recent call last):

File "test", line 5, in <module>

from multipli import table

ImportError: No module named multipli

both files are in the same directory.

any help thanks in advance.

Hi, after fixing the infinite loop, there was a missing line in my first post inside the while loop I accidentally deleted this line:
i += 1;
Sorry for that.
adding the .py to the file name (the one to import) did fix the problem, thanks for the help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top