inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

173만명의 커뮤니티!! 함께 토론해봐요.

py manage.py runserver 오류

미해결

cmd에서 파이썬 관련 명령어 입력시 python이라는 문구만 출력되고 실행이 되지않습니다. 왜이러는건가요??

  • django
  • cmd
  • python
현. 댓글 0 좋아요 0 조회수 315

csv 파일로 저장까지 되는데 한칸에 한글자씩 나옵니다

미해결

[신규 개정판] 이것이 진짜 크롤링이다 - 기본편

현재 m1맥북 사용중인데 csv 파일로 저장할경우 셀 한칸에 한글자씩 입력이되고 데이터가 neme, price, link 가 아닌 name price link name price link 이렇게 아래로 데이터가 저장됩니다. 어떻게 해야할까요?

  • 웹-크롤링
  • python
kshssi 댓글 2 좋아요 1 조회수 478

개복님 말씀대루 다했는데 도중에 앱이 꺼져용

미해결

1:1채팅 만들기(Android + Kotlin + Firebase)

- 개복님 수업 잘듣고 있습니다. 이번에 최신버전 설치해서 말씀하신거 따라 하구 있는데 , 오류가 뜨는건 아닌데 앱을 구동시키니 팅겨버리네요. ㅠ 로그캣에서 에러난 곳을 살펴보니 auth=firebase.auth 여기서 오류가 난거 같습니다. 말씀하신거 중에서는 apply plugin: 'com.google.gms.google-services' 한개 못했는데, 최신버전에는 plugin { id' '} 이렇게 되있는 곳에 ' com.google.gms.google-services ' 집어넣으려고 하니 오류가 떠서 못집어넣었어요. 제가 잘못생각하는 건가용 .. 개복님이 보기에 한심해보이겠지만 ㅠㅠ 도와주세용 관련 문의는 1:1 문의하기를 이용해주세요.

  • android
  • kotlin
  • firebase
댓글 1 좋아요 0 조회수 435

안녕하세요. 말씀하신 import 추가했는데 오류가 또 뜨네요 ㅠ

미해결

1:1채팅 만들기(Android + Kotlin + Firebase)

- 버전은 4.0.1입니다 . 처음에는 최신버전으로 하다가 바꿔서 4.12 로 했구. 방금 4.0.1로 했는데 똑같이 뜨네요 ㅠ 인프런 질문 검색해보니 다른분도 똑같이 질문했던데 답변이 안달렸더라구여. 밑에 사진은 그분거 입니다. 선생님 강의 들으면서 공부하고 있었는데 여기서 막히네요 ㅠ

  • android
  • firebase
  • kotlin
댓글 2 좋아요 0 조회수 505

안녕하세욤 강의 잘보고 있습니다

미해결

1:1채팅 만들기(Android + Kotlin + Firebase)

- 붙여 넣기 하는 와중에 auth 마지막 부분이 오류가 발생해요. 어떻게 할수 있을까요?? 강의 잘보고 있습니다. 꾸벅 는 1:1 문의하기를 이용해주세요.

  • firebase
  • android
  • kotlin
댓글 2 좋아요 0 조회수 337

이미지 이름 오류

미해결

[왕초보편] 앱 8개를 만들면서 배우는 안드로이드 코틀린(Android Kotlin)

drawable 폴더에 splash 이미지 파일이 있는데 왜 이미지뷰에서 스플래쉬이미지가 적용이 안될까요?

  • splash
  • android
  • kotlin
  • firebase
김영민 댓글 6 좋아요 0 조회수 526

파이어베이스 익명로그인 강의 09:01 부분 문의

미해결

[왕초보편] 앱 8개를 만들면서 배우는 안드로이드 코틀린(Android Kotlin)

해당 부분 에서 FirebaseAuth, Firebase는 자동으로 import가 되는데 Firebase.auth 부분에서 뒤에 auth가 자동 import가 뜨질 않고 Unresolved reference:auth 에러가 계속 발생합니다. 한 번만 확인해주시면 감사하겠습니다. // LoginActivity package com.fitdback.userinterface import android.support.v7.app.AppCompatActivity import android.os.Bundle import android.util.Log import android.widget.Button import android.widget.Toast import com.fitdback.pointdetection.R import com.google.firebase.auth.FirebaseAuth import com.google.firebase.ktx.Firebase class LoginTestActivity : AppCompatActivity() { private lateinit var auth: FirebaseAuth override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_login_test) // Initialize Firebase Auth auth = Firebase.auth val btnAnonymousLogin = findViewById<Button>(R.id.btnAnonymousLogin) btnAnonymousLogin.setOnClickListener { auth.signInAnonymously() .addOnCompleteListener(this) { task -> if (task.isSuccessful) { // Sign in success, update UI with the signed-in user's information Log.d("LoginTestActivity", "signInAnonymously:success") val user = auth.currentUser // updateUI(user) } else { // If sign in fails, display a message to the user. Log.w("LoginTesetActivity", "signInAnonymously:failure", task.exception) Toast.makeText( baseContext, "Authentication failed.", Toast.LENGTH_SHORT ).show() // updateUI(null) } } } } } // build.gradle(app) apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'com.google.gms.google-services' android { compileSdkVersion buildConfig.compileSdk defaultConfig { applicationId 'com.fitdback.userinterface' minSdkVersion buildConfig.minSdk targetSdkVersion buildConfig.targetSdk versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" externalNativeBuild { cmake { arguments '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=gnustl_static' cppFlags "-std=c++11","-frtti", "-fexceptions" } } ndk { abiFilters 'armeabi-v7a' } } // externalNativeBuild { // cmake { // path "CMakeLists.txt" // } // } lintOptions { abortOnError false } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } aaptOptions { noCompress "tflite" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } sourceSets { main { jniLibs.srcDirs = ['libs'] } } } repositories { maven { url 'https://google.bintray.com/tensorflow' } flatDir { dirs 'libs' } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation project(':openCVLibrary341') implementation deps.kotlin.stdlib.jdk // implementation(name:'tensorflow-lite', ext:'aar') implementation deps.android.support.appcompatV7 implementation deps.android.support.constraintLayout implementation deps.android.support.design implementation deps.android.support.annotations implementation deps.android.support.supportV13 implementation deps.timber implementation 'org.tensorflow:tensorflow-lite:0.0.0-nightly' implementation 'org.tensorflow:tensorflow-lite-gpu:0.0.0-nightly' // Import the Firebase BoM implementation platform('com.google.firebase:firebase-bom:29.2.1') // Declare the dependency for the Firebase Authentication library // When using the BoM, you don't specify versions in Firebase library dependencies implementation 'com.google.firebase:firebase-auth-ktx' testImplementation deps.junit androidTestImplementation(deps.android.test.espresso, { exclude group: 'com.android.support', module: 'support-annotations' }) }

  • android
  • firebase
  • kotlin
동해물과백두산이마르고닳도록 댓글 4 좋아요 0 조회수 1131

왜 저한테는 답변 안해주시는거죠;;

미해결

[개정판] 파이썬 머신러닝 완벽 가이드

https://www.inflearn.com/questions/499562 이 글에 저만 빼고 답변해주시는데 이유가 뭘까요.

  • 머신러닝 배워볼래요?
  • 통계
  • python
aaaaa 댓글 2 좋아요 0 조회수 341

RPN conv 연산 질문

미해결

[개정판] 딥러닝 컴퓨터 비전 완벽 가이드

안녕하세요. 먼저 기본적인 질문 드리는 것 같아서 죄송합니다.. 6:39에서 40x50x512 와 1x1x9이 연산핸서 어떻게 40x50x9가 나오는건가요? 채널이 어떻게 줄었는지 이해가 안갑니다.. 미리 감사드립니다.

  • 머신러닝 배워볼래요?
  • 컴퓨터-비전
  • 딥러닝
  • tensorflow
  • keras
  • python
HAHA 댓글 1 좋아요 0 조회수 289

파일입출력 영상

미해결

파이썬 무료 강의 (기본편) - 6시간 뒤면 나도 개발자

- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 파일입출력 영상 코드대로 썼는데 계속 오류가 떠요 다른 질문에 답변하신거 보니까 버전이 달라서 그렇다고 하셨는데 제거는 최신버전이거든요... 3.몇이상 인데 만약에 버전이 다른거면 뭐라고 입력해야 하나요

  • python
유지원 댓글 1 좋아요 0 조회수 222

메일발송이 되지 않습니다 ㅠㅠ // form.save()에 대하여 질문입니다.

미해결

파이썬/장고 웹서비스 개발 완벽 가이드 with 리액트

안녕하세요? 1.이전에는 됐는데, 왜 다시할때는 안되는건지 모르겠네요 ㅠㅠ 11분경에 보내시는 메일이 발송이 되지 않습니다. 다음과 같이 1이 출력되면 메일이 발송성공한 것으로 알고 있는데, 기다려 보아도 메일이 오지를 않네요 강의 후반부에 회원가입과 동시에 메일을 보내는 부분도 메일이 발송되지가 않습니다 ㅠㅠ 2. 14분경에 views.py에서 signup함수 내부에 form.save()를 signed_user = form.save()로 바꿔주시는데, form.save()라는 함수가 값들을 실질적으로 db에 저장하는 것으로 알고 잇습니다. 그러면 signed_user = form.save()로 받아주는 부분은 해당 데이터를 db에 저장하는 동시에 저장된 그 유저 인스턴스(데이터 한행)를 변수에 담는 것인가요? 좋은 강의 감사합니다

  • python
  • docker
  • django
  • react
김영빈 댓글 3 좋아요 0 조회수 537

19강 3:34초처럼 나오질 않네요 디버그창에

미해결

작정하고 장고! Django로 Pinterest 따라만들기 : 바닥부터 배포까지

run-edit configurations 왼쪽 상단+ 눌러서 python 체크- 스크립트 패스 프래그매틱 -venv-scripts 파라미터 runserver 한다음 매니지파이 우클릭 디버깅(무당벌레) 누르면 원래 python manage.py runserver 한것처럼 127:0:0:1:8000 이런거 터미널 창에 안뜨는데. 사이트는 들어가지긴 해요 여기서 빈칸에 test 입력한다음 post 누르면 3:34초 처럼 디버그 창에 아무것도 안뜨네요 ㅠㅠ 그리고 디버깅 실행 눌르면 무담벌레 점 잠깐 찍혔다가 사라지네요

  • docker
  • django
  • python
coding corgi 댓글 0 좋아요 0 조회수 304

크롤링 중 list index out of range 에러 도움 부탁드립니다

미해결

제가 작성한 코드는 아닙니다 크롤링 하는 와중에 list index of range 에러가 나오는데 해결법을 못 찾아서 질문드립니다.. from urllib.request import urlopen from bs4 import BeautifulSoup from xml.dom.pulldom import END_DOCUMENT import pandas as pd import requests from bs4 import BeautifulSoup from datetime import datetime import re from tqdm import tqdm from tqdm.contrib.concurrent import process_map import math from time import sleep from multiprocessing.dummy import Pool import multiprocessing as mp from multiprocessing.pool import MaybeEncodingError start_date = "y1=2019&m1=09&d1=25" end_date = "y2=2019&m2=09&d2=30" url = "https://find.mk.co.kr/new/search.php?pageNum={}&cat=&cat1=&media_eco=&pageSize=10&sub=all&dispFlag=OFF&page=news&s_kwd=%BB%EF%BC%BA%C0%FC%C0%DA&s_page=news&go_page=&ord=1&ord1=1&ord2=0&s_keyword=%BB%EF%BC%BA%C0%FC%C0%DA&period=p_direct&s_i_keyword=%BB%EF%BC%BA%C0%FC%C0%DA&s_author=&{}&{}&ord=1&area=ttbd" def get_list(idx) : #idx = 검색했을때 page 번호 req = requests.get(url.format(idx, start_date, end_date)) #한글깨져서 인코딩 soup = BeautifulSoup(req.content.decode('euc-kr','replace'), 'html.parser') div_list = soup.find_all('div', {'class' : 'sub_list'}) art_list = [i.find('span', {'class': 'art_tit'}) for i in div_list] #db에 저장할거 title, href, body, date df = pd.DataFrame(columns = {'title','href', 'date','body'}) for article in art_list: append_flag = True title = str(article.find("a").contents[0]) href = str(article.find("a")["href"]) body_text = None date = None try: req = requests.get(href, timeout=2) except requests.exceptions.Timeout as errd: print("Timeout Error : ", errd) except requests.exceptions.ConnectionError as errc: print("Error Connecting : ", errc) except requests.exceptions.HTTPError as errb: print("Http Error : ", errb) # Any Error except upper exception except requests.exceptions.RequestException as erra: print("AnyException : ", erra) try: soup = BeautifulSoup(req.content.decode('euc-kr','replace'), 'html.parser') except: print("parser error") date_text = soup.find('li', {'class' : 'lasttime'}) if not date_text : date_text = soup.find('li', {'class' : 'lasttime1'}) if date_text : match = re.search(r'\d{4}.\d{2}.\d{2}', date_text.string) if match : date = datetime.strptime(match.group(), '%Y.%m.%d').date() else : print("match none") else : append_flag = False #print("mssing date text") art_text = soup.find('div', {'class' : 'art_txt'}) if not art_text : art_text = soup.find('div', {'class' : 'article_body'}) if not art_text : art_text = soup.find('div', {'class' : 'view_txt'}) if art_text : body_text = art_text.get_text() else : append_flag = False #print("mssing body text") #print("link : " + href) if append_flag : temp = pd.DataFrame({'title' : [ title ], 'href' : [ href ], 'date' : [ date ], 'body' : [body_text]}) df = df.append(temp) return df def get_count() : req = requests.get(url.format(1, start_date, end_date)) #한글깨져서 인코딩 soup = BeautifulSoup(req.content.decode('euc-kr','replace'), 'html.parser') count_text = soup.find('span', {'class' : 'class_tit'}).get_text().replace(",","") art_count = re.search("\d+",count_text) "y1=2019&m1=03&d1=15" print(start_date[3:7]+"년 "+start_date[11:13]+"월 "+start_date[17:]+"일 부터 " +end_date[3:7]+"년 "+end_date[11:13]+"월 "+end_date[17:]+"일 까지 총 " +art_count.group(0)+"개의 기사") return art_count.group(0) if __name__ == "__main__": count = get_count() tasks_count = math.ceil(float(count)/20) + 1 #tasks = range(1,10) tasks = range(1,tasks_count) result_list = process_map(get_list, tasks,max_workers=4) df = pd.concat(result_list) #df = pd.concat(parmap.map(get_list, tasks, pm_pbar = True, pm_processes = 4)) print(df) file_name = start_date[5:7]+start_date[11:13]+start_date[17:]+"_"+end_date[5:7]+end_date[11:13]+end_date[17:] df.to_csv(file_name+'.csv', index = False, encoding='utf-8-sig') ------------------------------------------------------------------------------------------------------------------------------------------------------ 코드는 이렇구요 _RemoteTraceback Traceback (most recent call last) _RemoteTraceback : """ Traceback (most recent call last): File "/home/ubuntu/anaconda3/envs/python3/lib/python3.6/concurrent/futures/process.py", line 175, in _process_worker r = call_item.fn(*call_item.args, **call_item.kwargs) File "/home/ubuntu/anaconda3/envs/python3/lib/python3.6/concurrent/futures/process.py", line 153, in _process_chunk return [fn(*args) for args in chunk] File "/home/ubuntu/anaconda3/envs/python3/lib/python3.6/concurrent/futures/process.py", line 153, in <listcomp> return [fn(*args) for args in chunk] File "<ipython-input-7-167ab35f9166>", line 22, in get_list title = str(article.find("a").contents[0]) IndexError: list index out of range """ The above exception was the direct cause of the following exception: IndexError Traceback (most recent call last) <ipython-input-7-167ab35f9166> in <module> () 96 #tasks = range(1,10) 97 tasks = range ( 1 , tasks_count ) ---> 98 result_list = process_map ( get_list , tasks , max_workers = 4 ) 99 df = pd . concat ( result_list ) 100 #df = pd.concat(parmap.map(get_list, tasks, pm_pbar = True, pm_processes = 4)) /home/ubuntu/anaconda3/envs/python3/lib/python3.6/site-packages/tqdm/contrib/concurrent.py in process_map (fn, *iterables, **tqdm_kwargs) 128 tqdm_kwargs = tqdm_kwargs . copy ( ) 129 tqdm_kwargs [ "lock_name" ] = "mp_lock" --> 130 return _executor_map ( ProcessPoolExecutor , fn , * iterables , ** tqdm_kwargs ) /home/ubuntu/anaconda3/envs/python3/lib/python3.6/site-packages/tqdm/contrib/concurrent.py in _executor_map (PoolExecutor, fn, *iterables, **tqdm_kwargs) 74 map_args . update ( chunksize = chunksize ) 75 with PoolExecutor ( ** pool_kwargs ) as ex : ---> 76 return list ( tqdm_class ( ex . map ( fn , * iterables , ** map_args ) , ** kwargs ) ) 77 78 /home/ubuntu/anaconda3/envs/python3/lib/python3.6/site-packages/tqdm/notebook.py in __iter__ (self) 255 def __iter__ ( self ) : 256 try : --> 257 for obj in super ( tqdm_notebook , self ) . __iter__ ( ) : 258 # return super(tqdm...) will not catch exception 259 yield obj /home/ubuntu/anaconda3/envs/python3/lib/python3.6/site-packages/tqdm/std.py in __iter__ (self) 1183 1184 try : -> 1185 for obj in iterable : 1186 yield obj 1187 # Update and possibly print the progressbar. /home/ubuntu/anaconda3/envs/python3/lib/python3.6/concurrent/futures/process.py in _chain_from_iterable_of_lists (iterable) 364 careful not to keep references to yielded objects . 365 """ --> 366 for element in iterable : 367 element . reverse ( ) 368 while element : /home/ubuntu/anaconda3/envs/python3/lib/python3.6/concurrent/futures/_base.py in result_iterator () 584 # Careful not to keep a reference to the popped future 585 if timeout is None : --> 586 yield fs . pop ( ) . result ( ) 587 else : 588 yield fs . pop ( ) . result ( end_time - time . monotonic ( ) ) /home/ubuntu/anaconda3/envs/python3/lib/python3.6/concurrent/futures/_base.py in result (self, timeout) 430 raise CancelledError ( ) 431 elif self . _state == FINISHED : --> 432 return self . __get_result ( ) 433 else : 434 raise TimeoutError ( ) /home/ubuntu/anaconda3/envs/python3/lib/python3.6/concurrent/futures/_base.py in __get_result (self) 382 def __get_result ( self ) : 383 if self . _exception : --> 384 raise self . _exception 385 else : 386 return self . _result --------------------------------------------------------------------------------------------------------------------- 이렇게 에러가 뜹니다 title = str(article.find("a").contents[0]) 이 부분에서 contents가 존재하지 않는데 인덱스로 접근하려고 해서 오류가 난 것 같은데 contents가 무조건 존재 하는게 아니라면 존재하지 않는 경우의 예외처리를 추가하려면 어떻게 해야될까요? 어느 위치에 뭐라고 작성해야 할지 몰라서 막막해서 질문드립니다

  • python
  • crawling
Co Di 댓글 0 좋아요 0 조회수 633

질문이욤

미해결

[신규 개정판] 이것이 진짜 크롤링이다 - 기본편

- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. import requests from bs4 import BeautifulSoup import openpyxl fpath = r'C:\Users\Lenovo\Desktop\content\참가자_data.xlsx' wb = openpyxl.load_workbook(fpath) ws=wb.active #현재 활성화된 시트 선택 codes = ["000660","035720","005930"] row=2 for code in codes: url=f"https://finance.naver.com/item/sise.naver?code={code}" response = requests.get(url) html=response.text soup=BeautifulSoup(html,'html.parser') price=soup.select_one("#_nowVal").text price=price.replace(',','') print(price) ws=[f'B{row}']=int(price) row=row+1 wb.save(fpath) cannot assign to f-string expression 이런 에러가 뜨면서 작동이 안됩니다 ㅜㅜ

  • 웹-크롤링
  • python
댓글 1 좋아요 1 조회수 305

질문이요 ㅠㅠ

미해결

[신규 개정판] 이것이 진짜 크롤링이다 - 기본편

- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 안녕하세요 강의 잘 듣고있습니다 다름이 아니라 엑셀부분을 코드 짜고 실행하면 엑셀 파일은 만들어지는데 안에 데이터셀이 텅 비어있습니다...ㅠㅠ

  • 웹-크롤링
  • python
댓글 1 좋아요 1 조회수 187

중첩함수 질문 수정

미해결

프로그래밍 시작하기 : 파이썬 입문 (Inflearn Original)

- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. def nested_func(num): #1 def func_in_func(num): #2 print(num) #3 print("In func") #4 func_in_func(num + 100) #5 nested_func(100) #6 수업 중 중첩함수에 관한 내용에서 #6를 먼저 받고 #1로 돌아가 num에 100이 입력된다는 것은 이해했습니다. 그런데 그다음에 #2로 가서 num에 100이 입력되지 않고 바로#4로 간다는 부분이 잘 와닿지 않습니다. 왜그렇게 되는건가요?

  • python
가나다라 댓글 4 좋아요 0 조회수 302

데이터 타입에 관련된 질문입니다.

미해결

[파이토치] 실전 인공지능으로 이어지는 딥러닝 - 기초부터 논문 구현까지

안녕하세요 호형님의 강의를 기본베이스로 듣고, 인터넷에서 이것저것 보면서 1D CNN을 제가 가진 데이터셋 분류에 적용하고있는 학생입니다. CustomDataSet을 만들고 DataLoader구현 후, 훈련과 검증, 테스트를 거치는 코드를 작성하였는데요. 훈련과 검증단계에서는 문제없이 진행되나 다른 섹션을 만들어 테스트코드를 돌리는중 type에러가 발생하였습니다. 왜 같은 dataset과 dataloader인데 test셋에서만 이런 문제가 나타나는건지 알고싶습니다. # 강의질문이 아니라 문제가 된다면 지우겠습니다ㅠㅠ

  • python
  • pytorch
  • 인공신경망
  • 딥러닝
  • pytorch
  • python
  • 머신러닝 배워볼래요?
정지원 댓글 1 좋아요 0 조회수 293

logout시 오류페이지가 뜹니다

미해결

작정하고 장고! Django로 Pinterest 따라만들기 : 바닥부터 배포까지

- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. logout버튼을 누르면 404오류가 뜨면서 디버그를 false로 변경하라는 오류메시지가 뜨길래 settings.py에서 아래처럼 설정을 하였습니다. DEBUG = False ALLOWED_HOSTS = ['localhost','127.0.0.1'] 그리고 다시 로그아웃을 하니 지금은 아래와 같은 오류가 뜨고요 ㅠ 어떻게 해야될까요?

  • python
  • django
  • docker
Hady 댓글 3 좋아요 0 조회수 600

UnboundLocal Error: local variable referenced before assignmnet

해결됨

우리를 위한 프로그래밍 : 파이썬 중급 (Inflearn Original)

- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. c = 30 # global variable(전역 변수) def func_v3(a): print(a) print(c) c = 40 # local variable(지역 변수) # 위 코드를 실행했을 때, UnboundLocal Error가 발생하지만, c = 30 def func_v3(a): c = 40 # local variable(지역 변수) print(a) print(c) func_v3(10) 10 40 # 말씀하신 대로 이렇게 작성하면 Error가 발생하지 않고, 10과 40으로 출력된다는 건 이해했습니다. # 전역 변수보다 지역 변수를 우선시한다는 것 그런데 c = 40 을 print(c) 아래에 두었을 때와 위에 두었을 때, 이 위치가 파이썬 인터프리터가 바라보는 인식의 차이를 모르겠습니다. 이 내용을 구글링도 하고, [stackoverflow](https://stackoverflow.com/questions/10851906/python-3-unboundlocalerror-local-variable-referenced-before-assignment) 에도 들어가서 확인했지만, 이에 대한 확실한 설명은 없었습니다. 다들 이 문제에 대한 해결책으로 global 을 작성하면 되지만, 이는 나중에 디버깅을 힘들게 만들기 때문에 추천하지 않는다는 내용만 확인했습니다. 이에 대해 알려주시면 감사하겠습니다.

  • python
  • django
김제하 댓글 1 좋아요 0 조회수 817

If Ture에서 조건은?

미해결

프로그래밍 시작하기 : 파이썬 입문 (Inflearn Original)

안녕하세요, if True : print('Good') 에서, Ture를 판단하는게 무엇인가요? 조건이 어떤건지 모르겠습니다. 참인지 거짓인지 판단하려면 대상(object)이 있어야 하지 않나요??

  • python
jaeho.park2 댓글 2 좋아요 2 조회수 268

인기 태그

인프런 TOP Writers

주간 인기글