OS: macOS python 3.10 버전을 사용하고 있고, sqlalchemy 2.0.19, pymysql 1.1.0 등등 최신 패키지 사용중입니다. from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker DATABASE_URL = "mysql+pymysql://root:todos@127.0.0.1/todos" engine = create_engine(DATABASE_URL, echo=True) SessionFactory = sessionmaker(autocommit=False, autoflush=False, bind=engine) connection.py 는 위와 같이 동일하게 작성했고, session.scalar(select(1)); 실행시 아래와 같은 오류가 발생하여 더 이상 진행을 할 수가 없습니다. Traceback (most recent call last): File "/Users/someone/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/232.8660.197/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevconsole.py", line 364, in runcode coro = func() File "<input>", line 1, in <module> File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2296, in scalar return self._execute_internal( File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2131, in _execute_internal conn = self._connection_for_bind(bind) File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1998, in _connection_for_bind return trans._connection_for_bind(engine, execution_options) File "<string>", line 2, in _connection_for_bind File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go ret_value = fn(self, *arg, **kw) File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1123, in _connection_for_bind conn = bind.connect() File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 3264, in connect return self._connection_cls(self) File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 147, in __init__ Connection._handle_dbapi_exception_noconnection( File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2426, in _handle_dbapi_exception_noconnection raise sqlalchemy_exception.with_traceback(exc_info[2]) from e File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 145, in __init__ self._dbapi_connection = engine.raw_connection() File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 3288, in raw_connection return self.pool.connect() File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 452, in connect return _ConnectionFairy._checkout(self) File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 1267, in _checkout fairy = _ConnectionRecord.checkout(pool) File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 716, in checkout rec = pool._do_get() File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/pool/impl.py", line 169, in _do_get with util.safe_reraise(): File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py", line 147, in __exit__ raise exc_value.with_traceback(exc_tb) File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/pool/impl.py", line 167, in _do_get return self._create_connection() File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 393, in _create_connection return _ConnectionRecord(self) File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 678, in __init__ self.__connect() File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 902, in __connect with util.safe_reraise(): File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py", line 147, in __exit__ raise exc_value.with_traceback(exc_tb) File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 898, in __connect self.dbapi_connection = connection = pool._invoke_creator(self) File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/engine/create.py", line 637, in connect return dialect.connect(*cargs, **cparams) File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 615, in connect return self.loaded_dbapi.connect(*cargs, **cparams) File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/pymysql/connections.py", line 358, in __init__ self.connect() File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/pymysql/connections.py", line 664, in connect self._request_authentication() File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/pymysql/connections.py", line 976, in _request_authentication auth_packet = _auth.caching_sha2_password_auth(self, auth_packet) File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/pymysql/_auth.py", line 267, in caching_sha2_password_auth pkt = _roundtrip(conn, data) File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/pymysql/_auth.py", line 120, in _roundtrip pkt = conn._read_packet() File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/pymysql/connections.py", line 772, in _read_packet packet.raise_for_error() File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error err.raise_mysql_exception(self._data) File "/Users/someone/.pyenv/versions/fastapi-env/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception raise errorclass(errno, errval) sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (1045, "Access denied for user 'root'@'localhost' (using password: YES)") (Background on this error at: https://sqlalche.me/e/20/e3q8) Check the PassWord Hashing Method: If the MySQL server is using caching_sha2_password but the client (like PyMySQL) doesn't support it, it can give rise to such issues. You can switch the MySQL user's password hashing method to mysql_native_password . 이런 글도 있어서 따라하고 새로 비밀번호를 todos 로 넣어줬는데도 마찬가지네요. 더 참고할만한 내용이 있을까요?
안녕하세요 강사님. 질문이 있어서 남기게 되었습니다. 첫 번째 질문: 네이버 view탭 검색 결과 크롤링 2를 완료한 이후 아래 코드 실행 후 손흥민을 검색했는데 검색결과가 30개가 아닌 7개가 출력되었습니다. 이러한 이슈 때문인지 네이버 view탭 검색 결과 크롤링 3 강의가 정상적으로 진행되지 않습니다. import requests from bs4 import BeautifulSoup # beautiful soup 라이브러리 import base_url = "https://search.naver.com/search.naver?where=nexearch&sm=top_hty&fbm=0&ie=utf8&query=" keyword = input("검색어를 입력하세요 : ") url = base_url + keyword print(url) headers = { "User-Agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36" } # dictionary req = requests.get(url, headers = headers) # GET 방식으로 naver에 요청 html = req.text # 요청을 하여 html을 받아옴 soup = BeautifulSoup(html, "html.parser") # html을 html.parser로 분석(클래스를 통한 객체 생성) total_area = soup.select(".total_area") timeline_area = soup.select(".timeline_area") if total_area: areas = total_area elif timeline_area: areas = timeline_area else: print("class 확인 요망") for area in areas: title = area.select_one(".api_txt_lines.total_tit") name = area.select_one(".sub_txt.sub_name") print(name.text) print(title.text) print(title["href"]) print() print(len(areas)) 두 번째 질문: 네이버 view탭 검색 결과 크롤링 3을 진행하면서 아래 코드처럼 작성하고 손흥민을 검색했을 때 NoneType 오류가 발생합니다. 첫 번째 질문의 이슈로 인해 그런 것인가요? .total_wrap.api_ani_send 클래스가 브라우저 상에서는 30개가 잘 나오는데 제대로 안 받아와진 것 같은 느낌이 듭니다. 도와주시면 감사하겠습니다 ㅠㅠ Traceback (most recent call last): File "C:\python_web_crawling\01_4_naver.py", line 30, in <module> print(title.text) ^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'text' 아래는 코드입니다. import requests from bs4 import BeautifulSoup # beautiful soup 라이브러리 import base_url = "https://search.naver.com/search.naver?where=nexearch&sm=top_hty&fbm=0&ie=utf8&query=" keyword = input("검색어를 입력하세요 : ") url = base_url + keyword print(url) headers = { "User-Agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36" } # dictionary req = requests.get(url, headers = headers) # GET 방식으로 naver에 요청 html = req.text # 요청을 하여 html을 받아옴 soup = BeautifulSoup(html, "html.parser") # html을 html.parser로 분석(클래스를 통한 객체 생성) items = soup.select(".total_wrap.api_ani_send") for area in items: # ad = area.select_one(".link_ad") # if ad: # print("광고입니다.") # continue title = area.select_one(".api_txt_lines.total_tit") name = area.select_one(".sub_txt.sub_name") print(title.text) print(name.text) # print(title["href"]) print() #print(len(items))
Next.js로 Google Cloud Platform에 App Engine 서비스 배포를 진행하고 있습니다. 문제는 production ( 실 서비스 )와 development ( 개발용 )으로 나누어서 .env.development, .env.production의 두개의 환경변수를 가지고있습니다. 배포 시 실서비스 에서는 .env.production을 사용하도록 개발용 에서는 .env.development를 사용하도록 설정하려는데 이것저것 만져보아도 production만 사용하는 문제가 발생해버리네요. 현재 프로젝트구조와 설정코드는 이렇습니다. project ├── local └── Dockerfile └── docker-compose.yml ├── resource └── .next └── ... (Next.js 빌드 파일) └── node_modules └── package.json └── dev_app.yaml └── prd_app.yaml └── .env.development └── .env.production └── next.config.js └── ... (기타 Next.js 프로젝트 파일) 여기서 package.json의 script설정은 다음과 같습니다. { dev: "next dev", start: "next start", lint: "next lint", deploy: "npm run build && gcloud app deploy --project='production' -q --appyaml=prd_app.yaml", deploy:dev: "npm run build:dev && gcloud app deploy --project='development' -q --appyaml=dev_app.yaml", build: "dotenv -e .env.production next build", build:dev: "dotenv -e .env.development next build" } next.config.js는 특별히 건드리지 않았습니다. dev_app.yaml, prd_app.yaml파일은 서비스명만 각각 설정해 주었습니다. runtime: nodejs20 # or another supported version service: development 질문 1. 현재 app engine 업로드된 용량, 로직을 보니 빌드파일이 아닌 프로젝트 그대로 들어가는 것 같습니다. 빌드는 환경변수파일도 정상적으로 분기되는데 앱엔진에서 해당문제가 발생하는 것으로보아 혹시 Next.js에서 빌드된 파일로 app engine에 배포할 수 있는지 궁금합니다. 질문 2. 빌드파일만 올릴수 없다 라고 하더라도 프로젝트 그대로 올리면서 환경변수를 분기할 방법이 있는지 궁금합니다. 정말 문서건 블로그건 구글서칭, 깃허브검색, GPT 모두 끈질기게 시도해봤지만 능력부족 탓인지 성공하지 못했습니다.. 능력자분들께서 도움주시면 잊지않겠습니다!!
1. 강의 중에 있는 1번 함수명의 인자와 232번 줄 함수명의 인자가 맞지 않아 에러가 발생하는 것 같습니다. 강의 몇번을 보았는데 위 이미지 처럼 강의 코드가 저기 까지 입니다. 맞는 코딩을 알려 주세요 add_new_buddy_group 함수는 주석 처리 하는게 맞을 것 같은데 강의에는 주석처리가 안되어 있습니다. 이 부분 확인 바랍니다.
selenium 이랑 chromedriver_autoinstaller 도 다 인스톨되어있는데 왜 저렇게 노란줄이 나오는걸까요? reportMissingImports [부울 또는 문자열, 선택 사항]: 가져온 Python 파일 또는 유형 스텁 파일이 없는 가져오기에 대한 진단을 생성하거나 억제합니다. 이 설정의 기본값은 입니다 "error". 라는 오류라고 합니다....
안녕하세요. 많이 배우고 있습니다. 과정중에 인스타 검색 부분에서 변경이 되어 있습니다. 그래서 그런지 에러가 걸리더라구요. 확인 부탁 드립니다. 첨부 이미지 1번을 클릭해야 2번 검색창이 열리는데 1번 검색이미지 클릭을 할수가 없습니다. iframe 때문인지 제 능력 밖입니다. 조언 부탁 드려요.
제목처럼 react typescript vite설치를 하려고 터미널에 yarn create vite를 입력하여 설치를 했습니다. 아래 이미지와 같이 typescript를 선택 후, 설치를 완료했는데... 아래 이미지들처럼 설치 하자마자 빨간줄들이 난무하고있습니다ㅜㅜ 아래 이미지는 package.json 파일입니다. 어떻게 해결할 수 있을까요?
안녕하세요! 강사님 강의를 끝까지 다 수강하였습니다. 너무 도움이 많이 되었습니다. 감사합니다. 부동산 매물 강의에 대한 공지를 보고 메일로 문의 드렸는데 아직 피드백이 오지 않아 이렇게 질문글로 문의를 드리게 되었습니다! 메일 문의 한 번만 확인 부탁드립니다. 감사합니다!
WARNING:root:Can not find chromedriver for currently installed chrome version. WARNING:selenium.webdriver.common.selenium_manager:Error getting version of chromedriver 115. Retrying with chromedriver 114 (attempt 1/5) DevTools listening on ws://127.0.0.1:63812/devtools/browser/632301c3-72fa-4031-8651-e5118822fe97 내용은 이러합니다 ㅜㅜ
이번에 처음으로 앱 개발 공부를 해보려고 react native를 열심히 실행해 봤습니다. 중간에 계속 에러가 나고 막히는 부분이 있었지만 겨우 마지막에 npm run android부분까지 왔습니다. 그런데 실행을 할려고 하면 계속 C:\Users\aladi\MyApp\NewApp>npx react-native run-android info Starting JS server... info 💡 Tip: Make sure that you have set up your development environment correctly, by running react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor FAILURE: Build completed with 2 failures. 1: Task failed with an exception. ----------- * Where: Build file 'C:\Users\aladi\MyApp\NewApp\android\app\build.gradle' line: 2 * What went wrong: A problem occurred evaluating project ':app'. > Could not find implementation class 'com.facebook.react.ReactPlugin' for plugin 'com.facebook.react' specified in jar:file:/C:/Users/aladi/.gradle/caches/jars-9/e787d8a8f912d81d210d8e27e6fa5ed3/react-native-gradle-plugin.jar!/META-INF/gradle-plugins/com.facebook.react.properties. * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. ============================================================================== 2: Task failed with an exception. ----------- * What went wrong: A problem occurred configuring project ':app'. > compileSdkVersion is not specified. Please add it to build.gradle * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. ============================================================================== * Get more help at https://help.gradle.org BUILD FAILED in 12s error Failed to install the app. Command failed with exit code 1: gradlew.bat tasks FAILURE: Build completed with 2 failures. 1: Task failed with an exception. ----------- * Where: Build file 'C:\Users\aladi\MyApp\NewApp\android\app\build.gradle' line: 2 * What went wrong: A problem occurred evaluating project ':app'. > Could not find implementation class 'com.facebook.react.ReactPlugin' for plugin 'com.facebook.react' specified in jar:file:/C:/Users/aladi/.gradle/caches/jars-9/e787d8a8f912d81d210d8e27e6fa5ed3/react-native-gradle-plugin.jar!/META-INF/gradle-plugins/com.facebook.react.properties. * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. ============================================================================== 2: Task failed with an exception. ----------- * What went wrong: A problem occurred configuring project ':app'. > compileSdkVersion is not specified. Please add it to build.gradle * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. ============================================================================== * Get more help at https://help.gradle.org BUILD FAILED in 12s > Task :gradle-plugin:compileKotlin UP-TO-DATE > Task :gradle-plugin:compileJava NO-SOURCE > Task :gradle-plugin:pluginDescriptors UP-TO-DATE > Task :gradle-plugin:processResources UP-TO-DATE > Task :gradle-plugin:classes UP-TO-DATE > Task :gradle-plugin:jar UP-TO-DATE > Task :gradle-plugin:inspectClassesForKotlinIC UP-TO-DATE 5 actionable tasks: 5 up-to-date. 이런 에러가 뜨더라구요 정말 이쪽부분은 하나도 모르는 코린이라 아무리 구글링해보고 혼자 머리 굴려봐도 해결이 되지 않습니다.. 에뮬레이터까지는 뜨는데 react native화면은 뜨지 않고 저렇게 에러 메세지만 나옵니다. 어떻게 해야될까요.. 제발 도와주세요ㅜ
이런 식으로 코드를 사용중입니다 from PyQt6.QtWidgets import * from PyQt6.QtCore import * class thread (Qthread): def __init__(self): super().__init__() def run(self): while True: mainbot_window.fun1() class UI (QWidget): def __init__(self): super().__init__() self.inits() self.T1 = thread() self.T1.start() def inits(self): print("각종 변수 설정") def fun1(self): print("run code") def main(args=None): global mainbot_window app = QApplication(sys.argv) mainbot_window = UI() mainbot_window.show() try: app.exec() except KeyboardInterrupt: pass if __name__ == '__main__': main() 여기서 global 변수를 사용하지 않고 싶습니다. 글로벌 변수를 사용하지 않고 Thread 에서 Qwidget 의 함수를 사용할 방법이 있을까요? 시도한것 thread 에서 pyqtsignal.emit 을 사용해서 시도해봤는데 ui가 검은 화면으로 뜬체 작동하지않습니다. Qthread 대신 Qtimer 를 사용 =>작동은 잘되나 ui를 표시하는데 약간의 딜레이가 생깁니다. 그래서 되도록이면 Thread를 사용하고싶습니다.
안녕하세요 3강 콘다 가상환경에서 비주얼 스튜디오 터미널에서 conda activate myST해도 터미널에 계속 PS로 표시되며 가상환경으로 들어가지 않습니다. cmd에서는 같은 명령어를 입력하면 들어가지는데 비주얼 스튜디오 터미널에서는 들어가지지 않는 것 같습니다. 뭐가 문제일까요?
from selenium import webdriver from selenium.webdriver.chrome.options import Options options = Options() options.add_experimental_option("detach", True) driver = webdriver.Chrome(options=options) url = "https://naver.com" driver.get(url) 위 처럼 작성을 했는데 계속 꺼집니다. 현재 최신 버전이며, 구글링해서 찾아봐도 원인을 모르겠네요 ㅠ 짐작이 가는거는 버전이 달라서인데 현재 제 크롬은 최선 버전으로 115.0.5790.102 입니다. 그래서 https://googlechromelabs.github.io/chrome-for-testing/ 이 사이트에서 win64로 받았는데 시도했는데 현재 안되는 상태입니다
따라하며 배우는 노드, 리액트 시리즈 - 레딧 사이트 만들기(NextJS)(Pages Router)
에러 종류: 위와 같은 환경에서 error: password authentication failed for user "postgres" 로 추정되는 에러 발생 아마 서버 연결시 인증 문제로 보입니다. 작동 절차: docker-compose up 입력, server 파일로 이동, npm run dev 실행. 에러 발생 +1) POSTGRES_HOST_AUTH_METHOD: trust로 설정하고 서버 새로 만들어도 동일한 에러가 발생하여 무슨 문제일지 잘 모르겠네요.. 도움 주시면 감사하겠습니다. +2) 아래에 터미널의 전체 에러 코드 남깁니다. C:\Users\tukim\Desktop\reddit-clone-app\server>npm run dev > server@1.0.0 dev > nodemon --exec ts-node ./src/server.ts [nodemon] 3.0.1 [nodemon] to restart at any time, enter rs [nodemon] watching path(s): . [nodemon] watching extensions: ts,json [nodemon] starting ts-node ./src/server.ts server running at https://localhost:4000 error: ����� "postgres"�� password ������ �����߽��ϴ� at Parser.parseErrorMessage (C:\Users\tukim\Desktop\reddit-clone-app\server\node_modules\pg-protocol\src\parser.ts:369:69) at Parser.handlePacket (C:\Users\tukim\Desktop\reddit-clone-app\server\node_modules\pg-protocol\src\parser.ts:188:21) at Parser.parse (C:\Users\tukim\Desktop\reddit-clone-app\server\node_modules\pg-protocol\src\parser.ts:103:30) at Socket.<anonymous> (C:\Users\tukim\Desktop\reddit-clone-app\server\node_modules\pg-protocol\src\index.ts:7:48) at Socket.emit (node:events:513:28) at Socket.emit (node:domain:489:12) at addChunk (node:internal/streams/readable:324:12) at readableAddChunk (node:internal/streams/readable:297:9) at Socket.Readable.push (node:internal/streams/readable:234:10) at TCP.onStreamRead (node:internal/stream_base_commons:190:23) { length: 107, severity: 'ġ��������', code: '28P01', detail: undefined, hint: undefined, position: undefined, internalPosition: undefined, internalQuery: undefined, where: undefined, schema: undefined, table: undefined, column: undefined, dataType: undefined, constraint: undefined, file: 'auth.c', line: '329', routine: 'auth_failed' }
빈 배열을 선언해서 빈 배열에 (axios 통신을 통해 전달받은) result.data를 대입해서 사용하는 것이 아니라 useState를 사용하는 이유는 무엇인가요? 제가 이해한 것은 서버에 새로운 데이터가 업로드되면 그때마다 바로바로 업로드 된 데이터를 화면에 보여주기 위함인 것 같은데(예를 들어 상품이 3개로 보이다가 관리자가 상품을 한 개 추가하면 새로고침을 안해도 4개로 보임), 올바르게 이해한 것이 맞을까요?