#๐Ÿ”’ Pycharm users only please

85 messages ยท Page 1 of 1 (latest)

chrome crescent
#

I need to add a txt file to get with open ('common.txt', 'r') as f: and idk how to place a file in the directory I am new to both coding and pycharm so please be nice ๐Ÿ™‚

river nestBOT
#

@chrome crescent

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.

chrome crescent
#

I need to add a txt file to get with open ('common.txt', 'r') as f: and idk how to place a file in the directory I am new to both coding and pycharm so please be nice ๐Ÿ™‚

polar lintel
#

so let me just quickly explain what pycharm is

#

python files are like word documents

#

you can open word files in microsoft word

#

but you can also open it, in say, libreoffice

#

or google docs

#

does that make sense?

#

the same thing applies to python files, you can open them in pycharm, or vscode, or sublime text

chrome crescent
#

a little I mean I am still new to both but I try to copy from videos and learn step by step what each code do or for what it written for

polar lintel
#

but that does not change the functionality of the code

#

the word document is still going to contain the same text whether you open it in word, or google sheets, or libreoffice

#

does that make sense so far?

chrome crescent
#

a little

polar lintel
#

essentially, your question is not related to pycharm

#

this would make sense as a question even if someone uses vscode

#

i just wanted to quickly clarify that first

#

how are you running your python code file in pycharm? with the "play" button?

chrome crescent
#

so why I get this error? with open ('common.txt', 'r') as f:
~~~~~^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'common.txt'

polar lintel
#

do you understand what this error means?

#

FileNotFoundError: [Errno 2] No such file or directory: 'common.txt'

chrome crescent
#

not really could you explain it for me?

polar lintel
#

There is "No such file or directory: 'common.txt'"

chrome crescent
#

so how do I fix it?

polar lintel
#

make common.txt

chrome crescent
#

I need the common.txt to be here? (in ss)

polar lintel
chrome crescent
#

oh and how do I find out?

polar lintel
#

how are you running the file?

chrome crescent
#

the script? sorry I am a little slow ๐Ÿ˜ญ

polar lintel
#

it can be a mouse click

#

what button did you press

chrome crescent
#

I don't really remember but I just wrote it

polar lintel
chrome crescent
#

no, in the python thing in pycharm

polar lintel
#

can you take a screenshot?

chrome crescent
#

I accidently deleted it wait a sec

polar lintel
#

are you there?

chrome crescent
#

yeah sorry I rewrote the script now I just need to open the txt file and that it will show in the side bar so the error won't appear I think?

polar lintel
#

try running it

#

does it give you an error

chrome crescent
#

now I get two different errors the first one is this "line 19
if length > 8:
^^"

the second is this "IndentationError: expected an indented block after 'with' statement on line 17"

polar lintel
#

do you mind if i ask what video are you following along to?

chrome crescent
#

I will send the link

#

Today we build a simple tool that helps us to evaluate the strength of our passwords.

โ—พโ—พโ—พโ—พโ—พโ—พโ—พโ—พโ—พโ—พโ—พโ—พโ—พโ—พโ—พโ—พโ—พ
๐Ÿ“š Programming Books & Merch ๐Ÿ“š
๐Ÿ The Python Bible Book: https://www.neuralnine.com/books/
๐Ÿ’ป The Algorithm Bible Book: https://www.neuralnine.com/books/
๐Ÿ‘• Programming Merch: https://www.neuralnin...

โ–ถ Play video
#

(I just use it to learn nothing else)

polar lintel
#

uh

chrome crescent
#

it not good video right?

polar lintel
#

do you want to try one of the resources recommended here?

#

!learn

river nestBOT
#
Go-to beginner resources

Here are the top free resources we recommend for people who are new to programming:

For a full, curated list of educational resources we recommend, please see our resources page!

polar lintel
#

i think it would be better for you to understand the basic syntax first before heading into a project like that

#

in python, indentation matters

if x > 5:
    print("x is more than 5")
#

this is part of the fundamentals that is quite important for you to get right

chrome crescent
#

I tried learning python on my own and it wasn't the greatest experience and dropped it after a week and I am scared it would happen again since I am serious about it ๐Ÿ™

polar lintel
# river nest

I can personally vouch for CS50P in this list of reccos

#

do you want to give it a try first?

polar lintel
chrome crescent
polar lintel
#

i typically dont ask learners to use pycharm

#

its venv-first paradigm is very good for professional use

#

but i can imagine it being quite confusing to start off with it

chrome crescent
#

then what do you recommend for beginners?

#

and how do I take the CS50P course?

polar lintel
chrome crescent
#

and where do I click?

polar lintel
#

if you click on Visual Studio Code, it brings you to a codespace where you can write code and run it online

polar lintel
chrome crescent
#

what now?

polar lintel
#

you can create a new python file and start writing code

chrome crescent
#

but I want to learn how to code

polar lintel
#

you will want to follow the instructions here

chrome crescent
polar lintel
#

delirium

#

please take a look at these and follow along

#

you will need to read text to learn how to code

river nestBOT
#
Python help channel closed for inactivity

This help channel has been closed. 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.