#๐Ÿ”’ ModuleNotFound problem

114 messages ยท Page 1 of 1 (latest)

daring girder
#

in my script i put import random and also import time but when i try to run it there are 2 errors from them. I dont know what to do

narrow fjordBOT
#

@daring girder

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

fleet prawn
#

!traceback looks like this

narrow fjordBOT
#
Traceback

Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.

A full traceback could look like:

Traceback (most recent call last):
  File "my_file.py", line 5, in <module>
    add_three("6")
  File "my_file.py", line 2, in add_three
    a = num + 3
        ~~~~^~~
TypeError: can only concatenate str (not "int") to str

If the traceback is long, use our pastebin.

daring girder
#

what do i put in the terminal

fleet prawn
#

If you run your script, you see those error messages

#

Can you copy and paste them here please?

versed otter
daring girder
#

i cant send traceback

#

tool ong

#

too long

fleet prawn
#

!paste

narrow fjordBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

fleet prawn
#

Use the pastebin ๐Ÿ‘†

daring girder
fleet prawn
#

Odd

daring girder
fleet prawn
#

How did you run your script?

daring girder
#

on vscode

#

?

fleet prawn
#

Exact steps please

#

Command?

#

DEBUG button?

daring girder
#

when im gonna run it

#

i press python debug thing

#

also when it dosent work it sends this

#

@fleet prawn

fleet prawn
versed otter
#

I dont think ive ever seen this runpy or debugpy

daring girder
#

the code isnt finished

#

but i can send u the first lines

fleet prawn
#

Including vscode

#

Paste it here btw

daring girder
#

its not a code problem

#

i also runned it with simple scripts

fleet prawn
#

Send screenshot with the error anyways

daring girder
#

with what error

fleet prawn
daring girder
#

the weird thing is that a different code gives the same error

#
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import random
import time```
#

it starts with this

fleet prawn
#

Or

#

Try typing py main.py

#

In your terminal

#

And hit enter

daring girder
#

C:\Users\danci\AppData\Local\Programs\Python\Python312\python.exe: can't open file 'C:\Users\danci\main.py': [Errno 2] No such file or directory

fleet prawn
#

What is your scripts name?

fleet prawn
daring girder
#

also

#

"c:\Users\danci\AppData\Local\Programs\Python\Python312\Lib\random.py" is overriding the stdlib module "random"

fleet prawn
daring girder
# fleet prawn Then `py code_run.py`

C:\Users\danci\AppData\Local\Programs\Python\Python312\python.exe: can't open file 'C:\Users\danci\code_run.py': [Errno 2] No such file or directory

fleet prawn
#

Omg

#

Type ls

#

And hit enter

daring girder
#

Rรฉpertoireย : C:\Users\danci

Mode LastWriteTime Length Name


d----- 21/04/2024 23:04 .cache
d----- 22/04/2024 10:07 .vscode
d-r--- 16/12/2023 04:05 Contacts
d----- 26/07/2023 16:37 Documents
d-r--- 22/04/2024 10:05 Downloads
d-r--- 16/12/2023 04:05 Favorites
d-r--- 16/12/2023 04:05 Links
d-r--- 21/01/2024 20:26 Music
dar--l 23/04/2024 10:41 OneDrive
d-r--- 16/12/2023 04:05 Saved Games
d-r--- 16/12/2023 04:05 Searches
d-r--- 16/12/2023 04:05 Videos
-a---- 01/03/2024 09:17 126 .gitconfig

fleet prawn
#

It's not even in the right folder

#

Then I can't help

daring girder
#

?

#

what do i do

fleet prawn
#

Share a screenshot

daring girder
#

of?

fleet prawn
#

Your screen of vscode

daring girder
#

of what tho

fleet prawn
#

Of what you're trying to run

#

Can't help if you can't share enough info

daring girder
fleet prawn
#

Entire screen pls

daring girder
#

the first thing is the code i sent u

versed otter
daring girder
#

oh

#

@versed otter

#

This?

versed otter
# daring girder

Maybe thats the problem. Your theme is so bright, its attracting bugs ๐Ÿคช

daring girder
#

Omg bro

versed otter
#

And what happens if you save the file, then hit play in top right corner?

versed otter
daring girder
#

Run python file?

#

BRO I NEVER HAD PYTHON INSTALLED FROM THE MICROSOFT STORE

#

IS THAT THE PROBLEM?

#

@versed otter

versed otter
#

Yes. The ms store python doesnt work properly

daring girder
#

I did install form python org

#

I fixed it

#

@versed otter

#

@fleet prawn

#

How do i know its really working tho

#

what do i put in terminal

versed otter
#

Eeuhm.
print("Hello World")?

#

or.
import time
print(time.now())

#

I think thats a thing in any case

daring girder
#

no

#

@versed otter

versed otter
#

no?

daring girder
#

it dont work

#

Okay so

#

Import random seems to work now

#

Butt

#

it says overriding the stdlib module random

versed otter
#

okay

daring girder
fleet prawn
versed otter
#

Can you do shift contorl P
Then type: python select interpreter and show a screenshot of the options after you click that?

narrow fjordBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.