AI장고 프로젝트를 liveshare를 통해 팀원들과 함께 작성
타이타닉 머신러닝 프로젝트를 거의 완성했다.
내일 디테일만 살짝 만지면 프로젝트를 마무리할 수 있을 것 같다!!
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\ksh40\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\ksh40\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run
autoreload.raise_last_exception()
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception
raise _exception[1]
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\core\management\__init__.py", line 398, in execute
autoreload.check_errors(django.setup)()
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\apps\config.py", line 193, in create
import_module(entry)
File "C:\Users\ksh40\AppData\Local\Programs\Python\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'imagekit'
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
utility.execute()
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\core\management\__init__.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\core\management\base.py", line 402, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\core\management\commands\runserver.py", line 74, in execute
super().execute(*args, **options)
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\core\management\base.py", line 448, in execute
output = self.handle(*args, **options)
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\core\management\commands\runserver.py", line 111, in handle
self.run(**options)
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\core\management\commands\runserver.py", line 118, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\utils\autoreload.py", line 680, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\utils\autoreload.py", line 661, in start_django
reloader.run(django_main_thread)
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\utils\autoreload.py", line 344, in run
self.run_loop()
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\utils\autoreload.py", line 350, in run_loop
next(ticker)
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\utils\autoreload.py", line 390, in tick
for filepath, mtime in self.snapshot_files():
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\utils\autoreload.py", line 411, in snapshot_files
for file in self.watched_files():
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\utils\autoreload.py", line 304, in watched_files
yield from iter_all_python_module_files()
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\utils\autoreload.py", line 120, in iter_all_python_module_files
return iter_modules_and_files(modules, frozenset(_error_files))
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\utils\autoreload.py", line 160, in iter_modules_and_files
if not path.exists():
File "C:\Users\ksh40\AppData\Local\Programs\Python\Python38\lib\pathlib.py", line 1391, in exists
self.stat()
File "C:\Users\ksh40\AppData\Local\Programs\Python\Python38\lib\pathlib.py", line 1197, in stat
return self._accessor.stat(self)
OSError: [WinError 123] 파일 이름, 디렉터리 이름 또는 볼륨 레이블 구문이 잘못되었습니다: '<frozen importlib._bootstrap>'
(venv)
처음에는 파일 이름, 디렉터리 이름 등이 잘못되었다길래 이에대한 코드를 찾아보고 고쳐보려 했으나 해결되지 않았다.
OSError: [WinError 123] 파일 이름, 디렉터리 이름 또는 볼륨 레이블 구문이 잘못되었습니다: 'frozen importlib._bootstrap'를 검색해본 후 어떻게 해결해야할 지 알게되었다.
그냥 데이터베이스를 다 지웠다가 다시 깔면 되는거였다.. 너무 허무하지만ㅋㅋㅋ해결하는데 생각보다 오래 걸리지 않았고 새로 알게된 사실이 있으니 뿌듯하다!
장고를 실행할 때 오류가 나는 경우 데이터베이스를 삭제하고 다시 설치하면 실행되는 경우가 꽤 많은 것 같다.
Internal Server Error: /
Traceback (most recent call last):
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\core\handlers\exception.py", line 55, in inner
response = get_response(request)
File "C:\Users\ksh40\Desktop\Django_MachineLearning\venv\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\ksh40\Desktop\Django_MachineLearning_error\tweet\views.py", line 30, in home
result_gender, result_age = gad.photo(tweet.upload_img)
TypeError: cannot unpack non-iterable NoneType object
[21/Oct/2022 09:44:30] "POST / HTTP/1.1" 500 70756
TypeError: cannot unpack non-iterable NoneType object를 구글에 검색해보니 unpack이라는 것이 괄호로 감싸져야하는 뭔가가 감싸져있지 않거나 괄호가 하나 빠져있는 경우가 많다고 하길래 코드를 싹 훑어봤는데 잘못된 부분이 없어보였다ㅠㅠ변수도 이것저것 바꿔보고 하면서 3~4시간동안 고민해봤으나..해결을 하지 못해 튜터님께 달려갔당..ㅎㅎ
너무 허무한 결과!! return값이 작성되어있지 않아서 오류가 났다고 하셨다..ㅋㅋㅋ이런 기초적인것을 오ㅐ 못찾아쓸까...??
for faceBox in faceBoxes:
face=frame[max(0,faceBox[1]-padding):
min(faceBox[3]+padding,frame.shape[0]-1),max(0,faceBox[0]-padding)
:min(faceBox[2]+padding, frame.shape[1]-1)]
blob=cv2.dnn.blobFromImage(face, 1.0, (227,227), MODEL_MEAN_VALUES, swapRB=False)
genderNet.setInput(blob)
genderPreds=genderNet.forward()
gender=genderList[genderPreds[0].argmax()]
print(f'Gender: {gender}')
ageNet.setInput(blob)
agePreds=ageNet.forward()
age=ageList[agePreds[0].argmax()]
print(f'Age: {age[1:-1]} years')
cv2.putText(resultImg, f'{gender}, {age}', (faceBox[0], faceBox[1]-10), cv2.FONT_HERSHEY_SIMPLEX, 0.8, (0,255,255), 2, cv2.LINE_AA)
# cv2.imshow("Detecting age and gender", resultImg)
# result_gender.append(gender)
# result_age.append(age)
return gender, age
꺼진불도 다시보자~!!
오류창에 같은 오류가 나는듯 해도 오류는 굉장히 다양하다는것을 또다시 몸소 깨닫게 되었다..ㅎㅎ(튜터님께서도 가르쳐주시면서 매번 새로운 오류를 보신다는데 괜히 그런게 아니었다~!!)