Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
When searching for a child node in django admin, would like it to also display the parent org
The image below shows a django admin search page where the parent is authors and the child nodes are books. Currently, when searching for a book in the search box it will only display the book. I would like to also display the parent org when searching. That way if two books had the same name we could what author they were under and determine which is which. -
Handling multiple post request with fetch api in django
I want to fetch the values of the form data after submission through fetch API. I am able to do that with one form on a webpage. But I don't know how to do it with multiple forms on a single webpage. Please enlighten me regarding the same. views.py def home(request): context={} context2={} if 'submit' in request.method=="POST": options_value=request.POST.get('options_value') value=request.POST.get('value') print(options_value,value) result2=[("AD", "abc", "False"),("AD", "abc", "False")] context={ 'options_value':options_value, 'value':value, 'UserIds' : str(result2), } return JsonResponse(context, safe=False) if "save" in request.method=="POST": phone_no=request.POST.get('phone_no') context2={ 'phone_no':phone_no } return JsonResponse(context2, safe=False) return render(request, 'index.html', context) Just let me know what would be the format of fetch API for the above 2 Post requests. P.S - "submit" and "save" are the name given to the submit buttons of 2 different forms. -
django form.is_valid is failing & not saving the form
my account model automatically creates when user creates a new user account & only user value is added to that model, rest remains empty! i am trying to make the user update or add more info in their account model but the is.valid() is failing in views & not saving the form. what went wrong & how to fix it? #model.py class profile(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) bio = models.TextField(blank=True, null=True, max_length=100) profile_img = models.ImageField( upload_to="profile_images", default="default.jpg") location = models.CharField(max_length=100, blank=True) def __str__(self): return self.user.username #form.py class accountForm(ModelForm): class Meta: model = profile fields = "__all__" widgets = { # 'fields': forms.TextInput(attrs={'class': "form-control"}), 'profile_img': forms.FileInput(attrs={'class': 'form-control', 'id': 'inputGroupFile04'}), 'bio': forms.Textarea(attrs={'class': 'form-control'}), 'location': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Location'}), } #views.py def account(request): Profile = profile.objects.get(user=request.user) form = accountForm(instance=Profile) if request.method == "POST": form = accountForm(request.POST, instance=Profile) if form.is_valid(): form.save() return redirect("sign_in") context = {"form": form} return render(request, "account.html", context) -
Paid Promotion on an event in a Django Rest Framework App
Let's say i have a model Called Activity class Activity(models.Model): activity_name = models.CharField(max_length=50) Now suppose i am a user of this app and i am creating an activity/event.Once creation of an activity is done then i want to promote it for let's say 3days for 200USD. Now i need strong quality suggessions on how am i going to manage this promotion in django and in which models.please suggest me the database design for that Bearing in mind that promoted activities should appear in top of homepage..So how do i measure which activity would come first if there is a bunch of promoted activities? and also how am i going to automatically measure whether a promoted activity promotion period has expired? -
Patch don't work with the path I usually use with pytest
I have this file in a django project, 'project/src/connector.py' (manage.py is in src -> src/manage.py) from shared_tools import rest class Foo: def __init__(self): self.connector = rest.Restful() def make_call(self): self.connector.make_request() And this test: class FooTest(TestCase): @patch('connector.rest.Restful.make_request', autospec=True) def test_it(mock_request): assert mock_request.called is True Normally I worked with pytest, and I think I always did it in this way, is there something wrong with my code or it's becasuse it's different with django? -
Why do I get this error "No product matches the given query."?
When i add product to my home function in views.py I got this error : No product matches the given query. image Why do I get this error? views: class productviewset(viewsets.ModelViewSet): queryset=product.objects.all() serializer_class = productSerializer def create(self, request): serialized = productSerializer(data=request.data, many=True) if serialized.is_valid(): serialized.save() return Response(serialized.data, status=status.HTTP_201_CREATED) return Response(serialized._errors, status=status.HTTP_400_BAD_REQUEST) @action (detail=False , methods=['post']) def delete(self,request): product.objects.all().delete() return Response('success') def home(request ): p=get_object_or_404(product,pk=1) return render(request,'home.html',{'p':p}) def foods(request): return render(request,'foods.html',{'p':category.objects.all()}) models: class category(models.Model): name=models.CharField(max_length=255, db_index=True) def __str__(self): return self.name class product(models.Model): category = models.ForeignKey(category, related_name='products',on_delete=models.CASCADE) image=models.CharField(max_length=500) description=models.CharField(max_length=500) price=models.CharField(max_length=50) buy=models.CharField(max_length=100) urls: from django.urls import include, path from rest_framework import routers from quick.views import productviewset from quick import views from django.contrib import admin urlpatterns = [ path('api/', include(router.urls)), path('',views.home), path('foods',views.foods), path('admin/',admin.site.urls), ] -
Retrieving a pre-specified range of objects in django
I am creating a blog application, and I want to create a function that gives me access to a specific object(blog in this case) and render it on the view. I also want help with creating another function that will create access to a range of blog posts, say 0-3. Here is my index.html <div class="row g-5"> {% for post in posts %} <div class="post-entry-1 col-lg-4 box mx-1"> <a href="single-post.html"><img src="{{post.image.url}}" class="post_img"></a> <div> <div class="post-meta"><span class="date">Culture</span> <span class="mx-1">&bullet;</span> <span>{{post.created_at}}</span></div> <h2><a href="">{{post.title}}</a></h2> </div> <p class="mb-4 d-block">{{post.body|truncatewords:75}}</p> <div class="d-flex align-items-center author"> <div class="photo"><img src="{% static 'assets/img/person-1.jpg' %}" alt="" class="img-fluid"></div> <div class="name"> <h3 class="m-0 p-0">OlePundit</h3> </div> </div> </div> {% endfor %} It could also be a for or a while loop. I don't know how to edit the for loop on the index.html in order to access a specified range My view def index(request): posts = Post.objects.all() return render(request, 'index.html', {'posts':posts}) -
Manually caching a view in Django
I'm using Django 4.0 and I have some few pages that takes a bit to load since they have to load lots of stuff from the database. These pages are static, they never change, and I don't want the users to wait, so I want to cache them as soon as the server goes up. Unfortunately I'm not finding a way to do so (I tried the @cache_page decorator, but it only caches the page after the first visit). How could I accomplish this? Thank you. -
Overlap Check in Tuple django
i am trying to find the overlap , can anyone help me list_tuple = [(100, 350,"d"), (125, 145,"a"),(200,400,"o")] sorted_by_both = sorted(list_tuple, key=lambda element: (element[0], element[1]) ) i am trying to build the code to find the numbers that overlapping and how many times overlapping happening. output 3 overlap is happening. -
Been trying this for a while now. What else should I try?
getting this error when trying to run django-admin ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\Python310\Lib\site-packages\pip\init.py' Consider using the --user option or check the permissions. -
How to set the custom UserModel field value upon creation of the user in Django?
I have a custom UserModel which has a CharField named as pbc_id. I want it to be set as something like below: pbc_id = "PBC-" + str(user.pk) In other words, I want to attach the newly created user's primary key value at the end of the string "PBC-" and then assign this value to the pbc_id field. I have kind of done it, but it only work when I create a superuser using the terminal. But when I create a normal user using Django Administration Interface, it does not work and pbc-id gets empty value. My User model is below class User(AbstractBaseUser, PermissionsMixin): username = models.CharField(max_length=254, null=True, blank=True) email = models.EmailField(max_length=254, unique=True) first_name = models.CharField(max_length=254, null=True, blank=True) last_name = models.CharField(max_length=254, null=True, blank=True) pbc_id = models.CharField(max_length=254, null=True, blank=True) is_staff = models.BooleanField(default=False) is_superuser = models.BooleanField(default=False) is_active = models.BooleanField(default=True) is_candidate = models.BooleanField(default=False) is_voter = models.BooleanField(default=False) votes = models.IntegerField(default=0) last_login = models.DateTimeField(null=True, blank=True) date_joined = models.DateTimeField(auto_now_add=True) USERNAME_FIELD = 'email' EMAIL_FIELD = 'email' REQUIRED_FIELDS = [] objects = UserManager() def get_absolute_url(self): return "/users/%i/" % (self.pk) My UserManager class is below: class UserManager(BaseUserManager): def _create_user(self, email, password, is_staff, is_superuser, is_candidate, is_voter, **extra_fields): if not email: raise ValueError('Users must have an email address') now = timezone.now() email … -
Unable to Post comments to blog post with Django
I am creating a blog for a project and I am having problem getting my comments to post to the back end. My code is as follows: models.py from django.contrib.auth.models import User from products.models import Category class Post(models.Model): """Model to create blog posts""" author = models.ForeignKey(User, on_delete=models.SET_NULL, null=True) category = models.ForeignKey(Category, on_delete=models.SET_NULL, null=True) title = models.CharField(max_length=250) body = models.TextField(blank=True, null=True) image = models.ImageField(blank=True, null=True) created_on = models.DateTimeField(auto_now_add=True) class Meta: ordering = ['-created_on'] def __str__(self): return self.title class Comment(models.Model): """Model to handle user comments""" author = models.ForeignKey(User, on_delete=models.CASCADE) post = models.ForeignKey(Post, related_name='comments', on_delete=models.CASCADE) body = models.TextField() created = models.DateTimeField(auto_now_add=True) class Meta: ordering = ['-created'] def __str__(self): return self.body[0:50] forms.py from .models import Post, Comment class PostForm(ModelForm): """ Form to allow site owner to create a new blog post """ class Meta: model = Post fields = ['category', 'title', 'body', 'image'] class CommentForm(ModelForm): """Form to handle user comments""" class Meta: model = Comment fields = ('body',) views.py def add_comment(request): """Method to add comments to a blog post""" post = get_object_or_404(Post, post_id) comments = post.comments.all() new_comment = None if request.method == 'POST': comment_form = CommentForm(data=request.POST) if comment_form.is_valid(): new_comment = comment_form.save(commit=False) new_comment.post = post new_comment.save() else: comment_form = CommentForm() template = 'blog/post_detail.html' context = … -
Django rosetta problem with changing translations
I am using django-rosetta for translations in my django project and have problem with changing translations using rosetta admin page. On the development environment everything works great. Problem appears on production server where django is run with gunicorn and it's probably related to cache settings in Django. So lets say i have a html file with translated string "Hello" displayed. Word "Hello" is translated to "Witaj", so when i open page in my local language i'll get displayed "Witaj". Then I change this translation to "Cześć" ("Witaj" -> "Cześć") and hit "Save and translate next block" button. Then there is an interesting part. When i reload this page on my local language settings i'll get displayed randomly one of "Witaj" or "Cześć". I've been reading about it and found something like that in rosetta docs Please make sure that a proper CACHES backend is configured in your Django settings if your Django app is being served in a multi-process environment, or the different server processes, serving subsequent requests, won’t find the storage data left by previous requests. and then TL;DR: if you run Django with gunicorn, mod-wsgi or other multi-process environment, the Django-default CACHES LocMemCache backend won’t suffice: use memcache … -
How do i create Model on Django
Create a Django model for People, Address, Doctor, Product, and Bio within any of your app. Use an appropriate database relationship, and create a relationship for the following models: People - Address People - Doctor People - Bio I'm pretty new to Django how do i go about this questions -
Referencing Attribute from Separate Class/Model
Using Django and PostgreSQL. I'm building a media streaming website. Where I have a Video class/model referencing back to a Broadcaster class/model. I'm attempting to grab an attribute (name) from the Broadcaster class and reference it as either the default value or directly from the ForeignKey relationship. Whenever I try to access/reference the attribute I get "<django.db.models.fields.related.ForeignKey>" Picture of ForeignKey Jargon when referencing Video model/class attribute broadcaster_name. (default=Broadcaster.name) BUT only when using broadcaster_name located in the Video class/model. Instead of the attribute reference of 'video.broadcaster.name', which is the goal. Below is my Python/Django code: ''' class Broadcaster(models.Model): member = models.OneToOneField(Member, on_delete=models.CASCADE, null=True) name = models.CharField(max_length=50, unique=True, null=True) def __str__(self): return str(self.name) def get_name(self): return f'{self.name}' ''' ''' class Video(models.Model): broadcaster = models.ForeignKey(Broadcaster, on_delete=models.CASCADE, null=True) broadcaster_name = models.CharField(max_length=50, default=Broadcaster.name) ''' I've tried several different approaches with no avail... Below is my HTML/Django code: ''' {% for video in media_list %} <div class="card"> <img class="cover_img" src="{{ video.cover_img_url }}" alt="Cover Image"> <p></p> <h2>{{ video.title }}</h2> {# Works #} <h2>{{ video.broadcaster }}</h2> {# Doesn't Work #} <h2>{{ video.broadcaster.get_name }}</h2> {# Doesn't Work #} <h2>{{ video.broadcaster.name }}</h2> {# Doesn't Work #} <h2>{{ video.broadcaster_name }}</h2> {# Returns Object/ForeignKey Jargon #} </div> {% endfor %} ''' Similar … -
respond on post request to the third side, csrf token
I have two servers on Django, each server has its client. I need to send the request from one server to the second. I do it like this: def post(self, request, serial_number): if settings.DEBUG: setattr(request, '_dont_enforce_csrf_checks', True) charger_id = Charger.objects.get(serial_number=serial_number) form = WiFiConfigForm(request.POST) ip = charger_id.public_ip_address if form.is_valid(): data = {"wifi_ssid": request.POST.get('wifi_ssid'), "wifi_pass": request.POST.get('wifi_pass')} url = "http://127.0.0.1" + ":" + PORT + "/wifi_config/" + str(serial_number) + "/" client = requests.session() client.get(url) csrf_token = client.cookies['csrftoken'] payload = { 'csrfmiddlewaretoken': csrf_token } # response = requests.post(url, data=payload) # I tried this variant as well response = client.post(url, data=payload) print("response:", response) else: return Response("Form is not valid", status=status.HTTP_200_OK) return Response({"response": "response", "ip": ip, "serial_number": serial_number}, status=status.HTTP_200_OK) The problem is in csrf tokens, I don't know how to deal with them. The error is KeyError: "name='csrftoken', domain=None, path=None" -
reset form to initial data in invalid_form and display error in Django
I have a profile form that shows email, user name and first name. user only allowed to change first name field and the others are read only, if user change HTML value in email and username then submit it, it returns error but fill the fields with invalid value entered. I tried create a new instance of form and render it but it no longer shows the error. The thing I want is to reset invalid data then display the error. forms.py class UserEditForm(forms.ModelForm): email = forms.EmailField( label='Account email (can not be changed)', max_length=200, widget=forms.TextInput( attrs={'class': 'form-control mb-3', 'placeholder': 'email', 'id': 'form-email', 'readonly': 'readonly'})) user_name = forms.CharField( label='Username', min_length=4, max_length=50, widget=forms.TextInput( attrs={'class': 'form-control mb-3', 'placeholder': 'Username', 'id': 'form-username', 'readonly': 'readonly'})) first_name = forms.CharField( label='First name', min_length=4, max_length=50, widget=forms.TextInput( attrs={'class': 'form-control mb-3', 'placeholder': 'Firstname', 'id': 'form-firstname'})) class Meta: model = UserBase fields = ('email', 'user_name', 'first_name',) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['user_name'].required = True self.fields['email'].required = True def clean_user_name(self): username = self.cleaned_data['user_name'] if username != self.instance.user_name: raise forms.ValidationError('Sorry, you can not change your username') return username def clean_email(self): email = self.cleaned_data['email'] if email != self.instance.email: raise forms.ValidationError('Sorry, you can not change your email') return email views.py class ChangeUserDetail(SuccessMessageMixin, LoginRequiredMixin, FormView): … -
Testing Updateview in Django won't update an object
I'm writing tests for my views and I'm stuck with the UpdateView and the POST request. For this simple test I try just to change first_name but assertion fails. What am I doing wrong? The test: class TestEmployeesUpdateView(TestCase): def setUp(self): self.test_user = User.objects.create_user( username='test_user', email= 'testuser@test.com', password='Testing12345') self.test_employee = Employee.objects.create( first_name='Bob', last_name='Smith', user=self.test_user, position='SM', birthday=date(year=1995, month=3, day=20), hire_date=date(year=2019, month=2, day=15), address='...', ) self.client = Client() def test_updateview_post(self): self.client.force_login(user=self.test_user) response = self.client.post(reverse('employees:employee-update', kwargs={'pk': self.test_employee.pk}), {'frist_name': 'John'}) self.test_employee.refresh_from_db() self.assertEqual(self.test_employee.first_name, 'John') The view: class EmployeesUpdateView(LoginRequiredMixin, UpdateView): model = Employee template_name = 'employees/employee_details.html' form_class = EmployeeUpdateForm And the error: FAIL: test_updateview_post (employees.tests.test_views.TestEmployeesUpdateView) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/main/dev/project1/employees/tests/test_views.py", line 63, in test_updateview_post self.assertEqual(self.test_employee.first_name, 'John') AssertionError: 'Bob' != 'John' - Bob + John -
how can i customize auto generated django form?
i've created a form on django app with its builtin forms class. here is my forms.py file. # import form class from django from dataclasses import field from django import forms from .models import #MYMODEL# class myForm(forms.ModelForm): class Meta: model = #MYMODEL# fields = "__all__" and my view function in views.py def index(request): context = {} form = myForm(request.POST or None, request.FILES or None) if form.is_valid(): form.save() context['form'] = form return render(request, "index.html", context) and finally the page (index.html) that shows the form <form method="POST" enctype="multipart/form-data"> {% csrf_token %} {{ form.as_p }} <input type="submit" value="Kaydet"> </form> So, what i need to do is to set custom input types like text or select box since the auto-generated form includes only text inputs. -
Uboundlocal error in django on my polls app on views. Py
From django. Shortcuts import get_object_or_404, render From django.http import HttpResponse def detail(request, question_id): Question = get_object_or_404(Question, pk=Question_id) return render(request, 'polls/detail.html', {'question':question } ) Full code: In my view.py -
Django custom login form validation with AJAX
I am not that experienced writing Python/Back-end, but trying to improve. In development/localserver I am trying to validate a user's email and password in my login form... right now almost 100% of things work, for example, alert messages for mandatory inputs; however, from the Utils.py file if user "elif not object_user.allow_private_access:" validation is not working and, most importantly, validation is not checking user's password (also commented out in Utils.py). The "post" part in Views.py might have to be updated. I have included my custom Login form from Forms.py, Views.py (for Login page) and Utils.py (which does the validation and sends error messages to the front-end) and Urls.py. I did not add my AJAX because that is working well. Forms.py class UserLoginForm(forms.ModelForm): helper = FormHelper() helper.add_input(Submit('login_form_submit', numeratio_static_textLanguage['global_input_alert_maxCharacters_32'], css_class='global_component-button')) class Meta: model = CustomUser fields = ['email', 'password'] widgets = { 'email': forms.EmailInput(attrs={ 'maxlength': '256', 'style': 'text-transform: lowercase', 'id': 'input-email', 'class': 'global_component-input box'} ), 'password': forms.PasswordInput(attrs={ 'type': 'password', 'maxlength': '128', 'id': 'input-password', 'class': 'global_component-input box'} ) } def __init__(self, *args, **kwargs): super(UserLoginForm, self).__init__(*args, **kwargs) self.helper.form_action = '' self.helper.form_method = 'post' self.helper.form_id = 'login_form' self.helper.form_class = 'login_form' Views.py @csrf_exempt @anonymous_required(redirect_url='page__home') @require_http_methods(["GET", "POST"]) def view_userLogin(request, *args, **kwargs): template_name = '../frontend/templates/frontend/templates.user/template.page_login.html' form_class = UserLoginForm if … -
can't run a Django function from html template using ajax
I'm trying to run a Django function after a click event from user using Ajax inside a JS code in Django template HTML file. javascript block kml_layer.addListener('click', (kmlEvent) => { setMapOnAll(null); var clickedPoint = kmlEvent.latLng; newPoint.postMessage(clickedPoint.lat() + "," + clickedPoint.lng()) console.log("layer id is " + "{{ single_layer.id }}"); runKmOnSource("{{ single_layer.id }}", kmlEvent); //Here is where I called the ajax jquery function }); Ajax call function runKmOnSource(theID,kmlEvent,){ console.log("started ajax") $(document).ready(function () { $.ajax({ type: "POST", url: "{% url 'get_km_from_source' %}", data: { csrfmiddlewaretoken: '{{ csrf_token }}', layer_id: theID, the_element_string_id: kmlEvent.featureData.id, clicked_lat: kmlEvent.latLng.lat, clicked_lng: kmlEvent.latLng.lng }, /* Passing the text data */ success: function (response) { console.log("ajax success"); kmOnSource.postMessage(response) } }); }); } urls.py path('get_km_from_source/', get_km_from_source, name='get_km_from_source'), and finally Django/python view def get_km_from_source(request): """ A function that takes data from the ajax function parsing it then ending back the result """ print("xxxxxxxxxxxxxxxxsssssssssss started kmonsource") #This line to test if function executed layer_id = request.POST['layer_id'] the_element_string_id = request.POST['the_element_string_id'] clicked_lat = request.POST['clicked_lat'] clicked_lng = request.POST['clicked_lng'] layer_object = models.MapLayers.objects.get(id=layer_id) print(f"layer object is {layer_object}") water_element_object = None nearest_cord = None first_cord = None last_cord = None for water_element in layer_object.waterelement_set.all(): if water_element.id_string == the_element_string_id: water_element_object = water_element break for single_cord in water_element_object.cordsforwaterelement_set.all(): if nearest_cord is None: … -
How to use foreign keys in django?
I can't seem to be able to use foreign key in django. I have a rental spaces network website that offers books. I've created a "Rental" model and a "Book" model and I've created a foreignkey for book model to be attached to a rental space. In admin panel everything works as it should, but I can't get it to show on website. I want to have several books in rental space 1 and none in rental space 2. I don't know how to manage it in views.py my models : class Rental (models.Model): rental_name=models.CharField(max_length=50) rental_number=models.IntegerField(default=0) rental_adress=models.CharField(max_length=100, default='') def __str__(self): return "{} {}".format(self.id, self.rental_name) class Book(models.Model): # autor, tytul gatunek, isbn, id w wypozyczalni book_author=models.CharField(max_length=50) book_title = models.CharField(max_length=100) book_isbn= models.CharField(max_length=17, unique=True) BOOK_GENRE= ( ('SF', "Sci-Fi"), ("ROM", "Romance"), ("HIS", "Historical"), ("HOR", "Horror"), ("THR", "Thriller"), ("BIO", "Biography"), ("KID", "For kids"), ("FAN", "Fantasy"), ) book_genre=models.CharField(max_length=3, choices=BOOK_GENRE) book_rental=models.ForeignKey(Rental, on_delete=models.CASCADE, default=1, related_name="display") class Meta: constraints =[ models.UniqueConstraint(fields=['book_author','book_title'], name='unique_book'), ] my views: class BookListView(ListView): model = Book template_name='book.html' class BookDetailView(DetailView): model = Book template_name='book_detail.html' class RentalListView(ListView): model = Rental template_name='rental_list.html' class RentalDetailView(DetailView): model = Rental template_name='rental_detail.html and my htmls look like this: <h1 style="font-size:11px; text-align:right;"><a href="{%url 'home' %}">Powrót do strony głównej</a></h1> {% block content %} {%for … -
JWT Tokens in Django Rest Framework
I am building a Django Rest Framework API which is using JWT authentication. I had created access tokens and refresh tokens and sent them to users. I also have a refresh token endpoint that will take old refresh token and generate new pair of tokens and send to user. I have doubt in its behavior related part. Currently what I can see that whenever I create new pair of access and refresh token using previous refresh token, the old access token is also working and new one is also working. However once when I was using OAuth2.0 (in different case), I observed that in that case the old access token won't work if we had created new refreshed tokens. But in case of my implementation of JWT in DRF this thing won't happens. I am not storing token in database. So I want to know that is this any implementation specific problem or is it the property of JWT only, and if it is property then please share some details over it with me. Thanks. -
How can i relaunch anaconda navigator without error
Navigator Error An unexpected error occurred on Navigator start-up Report Please report this issue in the anaconda issue tracker Main Error unacceptable character #x0000: special characters are not allowed in "C:\Users\Tokunbo.continuum\anaconda-client\config.yaml", position 0 Traceback Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\anaconda_navigator\exceptions.py", line 74, in exception_handler return_value = func(*args, **kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\anaconda_navigator\app\start.py", line 137, in start_app window = run_app(splash) File "C:\ProgramData\Anaconda3\lib\site-packages\anaconda_navigator\app\start.py", line 60, in run_app window = MainWindow(splash=splash) File "C:\ProgramData\Anaconda3\lib\site-packages\anaconda_navigator\widgets\main_window_init_.py", line 224, in init for _ in anaconda_solvers.POOL.solve(): File "C:\ProgramData\Anaconda3\lib\site-packages\anaconda_navigator\utils\anaconda_solvers\core.py", line 72, in solve configuration: typing.Any = binstar_client.utils.get_config() File "C:\ProgramData\Anaconda3\lib\site-packages\binstar_client\utils\config.py", line 250, in get_config file_configs = load_file_configs(SEARCH_PATH) File "C:\ProgramData\Anaconda3\lib\site-packages\binstar_client\utils\config.py", line 242, in load_file_configs raw_data = collections.OrderedDict(kv for kv in itertools.chain.from_iterable(load_paths)) File "C:\ProgramData\Anaconda3\lib\site-packages\binstar_client\utils\config.py", line 242, in raw_data = collections.OrderedDict(kv for kv in itertools.chain.from_iterable(load_paths)) File "C:\ProgramData\Anaconda3\lib\site-packages\binstar_client\utils\config.py", line 222, in dir_yaml_loader yield filepath, load_config(filepath) File "C:\ProgramData\Anaconda3\lib\site-packages\binstar_client\utils\config.py", line 206, in load_config data = yaml_load(fd) File "C:\ProgramData\Anaconda3\lib\site-packages\binstar_client\utils\yaml.py", line 12, in yaml_load return safe_load(stream) File "C:\ProgramData\Anaconda3\lib\site-packages\yaml_init.py", line 125, in safe_load return load(stream, SafeLoader) File "C:\ProgramData\Anaconda3\lib\site-packages\yaml_init_.py", line 79, in load loader = Loader(stream) File "C:\ProgramData\Anaconda3\lib\site-packages\yaml\loader.py", line 34, in init Reader.init(self, stream) File "C:\ProgramData\Anaconda3\lib\site-packages\yaml\reader.py", line 85, in init self.determine_encoding() File "C:\ProgramData\Anaconda3\lib\site-packages\yaml\reader.py", line 135, in determine_encoding self.update(1) File "C:\ProgramData\Anaconda3\lib\site-packages\yaml\reader.py", line 169, in update self.check_printable(data) File "C:\ProgramData\Anaconda3\lib\site-packages\yaml\reader.py", line 143, in check_printable …