+ 1

Getting error while running a basic Django file

error code RecursionError: maximum recursion depth exceeded while calling a python project

26th Apr 2020, 4:18 PM
Anish Pandey
Anish Pandey - avatar
22 Respostas
+ 4
You should investigate to see where the recursion reach the maximum depth... or where you've an unexpected recursion if you doesn't think having explicitly made one ^^
26th Apr 2020, 4:33 PM
visph
visph - avatar
+ 4
Could you show us at least your main url.py?
27th Apr 2020, 2:09 AM
visph
visph - avatar
+ 4
I am also learning from thre I also got same error but I couldn't fix it so I re wrote whole code again then made it work . Thies is his github page where u can find that code .Just compare it with ur code . https://github.com/navinreddy20/JUMP_LINK__&&__Python__&&__JUMP_LINK-
28th Apr 2020, 3:56 AM
Vijay(v-staršŸŒŸ)
Vijay(v-staršŸŒŸ) - avatar
+ 3
I think you probably want to do too much things as same time... Your hello world doesn't looks as simple as you said: begin with a brand new project, and don't try to include an app, but just use the main app ^^
27th Apr 2020, 2:31 AM
visph
visph - avatar
+ 2
recursivity is not "normal" loop, but when you do kind of loop by calling function from that function... Eventually not directly: def foo(n=0): print("foo",n) bar(n+1) def bar(n): print("bar") foo(n+1) foo() this will be an infinite recursion (will not work in code playground, but with a local interpreter you will see the log, and could stop before reaching the maximum depth (theorically, you will not have the time to do so) by pressing CTRL-C or will stop after reaching the maximum recursion depth... until you provide base cases with return statement.
26th Apr 2020, 4:56 PM
visph
visph - avatar
+ 2
There are few probabilities to get a relevant answer without providing your code, as simple it would be... (anyway, if you show us your code, I cannot promise that anybody will found the good explanation, but the probabilities will grow drasticaly ^^)
26th Apr 2020, 5:15 PM
visph
visph - avatar
+ 2
Your unexpected recursion is here... in your 'calc' app url.py ;P inside calc you're trying to import itself (include("calc.urls"))...
27th Apr 2020, 2:24 AM
visph
visph - avatar
+ 2
Okay thank you but I was following a tutorial from Youtube by "TELUSKO DJANGO FOR BEGINNERS" where he guided to this but I got a totally different error. So do I change the channel to learn. It was on his 4 video of the tutorial.
27th Apr 2020, 2:36 AM
Anish Pandey
Anish Pandey - avatar
+ 2
It's to you to see: I give you my advice... to better help you we would need to dive in your project files and your tuto: that's difficult to share all here, even more if you didn't know what and how to do (your two url.py for example are necessarly incomplete, even if that was enough to find your recursion: you've at least some import statements that you doesn't have copy-pasted :P)
27th Apr 2020, 2:41 AM
visph
visph - avatar
+ 2
Start by the official Django documentation tutorial, step by step to correctly understand how a django project is structured: https://docs.djangoproject.com/en/3.0/intro/tutorial01/ (don't try to reuse a project you're already created... begin a brand new one to be sure to start with a clean project ^^)
27th Apr 2020, 2:54 AM
visph
visph - avatar
+ 1
Thank you for helping. I am beginer so I am very less familiar with technical terms. And in the 'helloworld' project where I didn't used any function like while,loop, recursion so why I got error like "RecursionError"
26th Apr 2020, 5:12 PM
Anish Pandey
Anish Pandey - avatar
0
I didn't run any loop I was trying to print "helloworld" working in visual studio with Django framework in python I was not getting my server so I ran again in with cmd with the cmd 'python manage.py runserver' and then I got an error As stated above RecursionError and value I see is 982 in RecursionError
26th Apr 2020, 4:47 PM
Anish Pandey
Anish Pandey - avatar
0
(test) C:\Users\ADMIN3\Anish\Projects\firstproject>python manage.py runserver Watching for file changes with StatReloader Performing system checks... Exception in thread django-main-thread: Traceback (most recent call last): File "c:\users\admin3\anish\lib\threading.py", line 932, in _bootstrap_inner self.run() File "c:\users\admin3\anish\lib\threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "C:\Users\ADMIN3\Envs\test\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper fn(*args, **kwargs) File "C:\Users\ADMIN3\Envs\test\lib\site-packages\django\core\management\commands\runserver.py", line 117, in inner_run self.check(display_num_errors=True) File "C:\Users\ADMIN3\Envs\test\lib\site-packages\django\core\management\base.py", line 392, in check all_issues = self._run_checks( File "C:\Users\ADMIN3\Envs\test\lib\site-packages\django\core\management\base.py", line 382, in _run_checks return checks.run_checks(**kwargs) File "C:\Users\ADMIN3\Envs\test\lib\site-packages\django\core\checks\registry.py", line 72, in run_checks new_errors = check(app_configs=app_configs) File "C:\Users\ADMIN3\Envs\test\lib\site-packages\django\core\checks\urls.py", line 40, in check_url_namespaces_unique all_namespaces = _load_all_namespaces(resolver) File "C:\Users\ADMIN3\Envs\test\lib\site-packages\django\core\checks\urls.py", line 67, in _load_all_namespaces namespaces.extend(_load_all_namespaces(pattern, current)) File "C:\Users\ADMIN3\Envs\test\lib\site-packages\django\core\checks\urls.py", line 67, in _load_all_namespaces namespaces.extend(_load_all_namespaces(pattern, current)) File "C:\Users\ADMIN3\Envs\test\lib\site-packages\django\core\checks\urls.py", line 67, in _load_all_namespaces namespaces.extend(_load_all_namespaces(pattern, current)) [Previous line repeated 986 more times] File "C:\Users\ADMIN3\Envs\test\lib\site-packages\django\core\checks\urls.py", line 58, in _load_all_namespaces
27th Apr 2020, 2:01 AM
Anish Pandey
Anish Pandey - avatar
0
File "C:\Users\ADMIN3\Envs\test\lib\site-packages\django\core\checks\urls.py", line 60, in <listcomp> if getattr(url, 'namespace', None) is not None RecursionError: maximum recursion depth exceeded while calling a Python object
27th Apr 2020, 2:01 AM
Anish Pandey
Anish Pandey - avatar
0
Above is the error I am getting while running the server.
27th Apr 2020, 2:02 AM
Anish Pandey
Anish Pandey - avatar
0
I am also getting the below error, (test) C:\Users\ADMIN3\Anish\Projects\firstproject> File "C:\Users\ADMIN3\Envs\test\lib\site-packages\django\core\checks\urls.py", line 60, in <listcomp> The syntax of the command is incorrect. (test) C:\Users\ADMIN3\Anish\Projects\firstproject> if getattr(url, 'namespace', None) is not None 'namespace' was unexpected at this time. (test) C:\Users\ADMIN3\Anish\Projects\firstproject>RecursionError: maximum recursion depth exceeded while calling a Python object
27th Apr 2020, 2:10 AM
Anish Pandey
Anish Pandey - avatar
0
Below is the code for main url.py urlpatterns = [ path('', include('calc.urls')), path('admin/', admin.site.urls) ] And this is the code for url.py for calc, urlpatterns = [ path('', include('calc.urls')), path('admin/', admin.site.urls) ]
27th Apr 2020, 2:13 AM
Anish Pandey
Anish Pandey - avatar
0
so how can I solve
27th Apr 2020, 2:25 AM
Anish Pandey
Anish Pandey - avatar
0
Thank you but now this is what I am getting, (test) C:\Users\ADMIN3\Anish\Projects\firstproject> if getattr(url, 'namespace', None) is not None 'namespace' was unexpected at this time. (test) C:\Users\ADMIN3\Anish\Projects\firstproject>RecursionError: maximum recursion depth exceeded while calling a Python object if getattr(url, 'namespace', None) is not None 'RecursionError:' is not recognized as an internal or external command, operable program or batch file. (test) C:\Users\ADMIN3\Anish\Projects\firstproject>'namespace' was unexpected at this time.
27th Apr 2020, 2:28 AM
Anish Pandey
Anish Pandey - avatar
0
How can I remove this error, File "c:/Users/ADMIN3/Anish/Projects/firstproject/calc/urls.py", line 4, in <module> from . import views ImportError: attempted relative import with no known parent package
27th Apr 2020, 2:50 AM
Anish Pandey
Anish Pandey - avatar