pycharm

I am trying to import views.py to urls.py using from . import views but I keep getting an import error

I am trying to import views.py to urls.py using from . import views but I keep getting an import error Question: from django.contrib import admin from django.urls import path from . import views urlpatterns = [ path(‘admin/’, admin.site.urls), path("", views.home), path("predict/", views.predict), path("predict/result", views.result) the traceback is File "C:UsersuserPycharmProjectsDiabetes PredictionDiabetes_PredictionDiabetes_Predictionurls.py", line 19, in from . …

Total answers: 2

Environment variable is returning 'None'

Environment variable is returning 'None' Question: I am using windows 11 and the latest version of Pycharm. I try to save environment variable using pycharm termimal by typing ‘export API_KEY=dfdfdg’ and when I type ‘env’ and run then the termianl show all the environment variable including ‘API_KEY’ but in my code, when I wanna fetch …

Total answers: 2

How to accept only the next word in PyCharm GitHub copilot suggestion

How to accept only the next word in PyCharm GitHub copilot suggestion Question: I would like to be able to accept only the next word of a github Copilot suggestion instead of the full suggestion. This is possible with VS Code as documented here. Is there a way to do this in PyCharm too? Asked …

Total answers: 1

Getting an index position in a sorted list without built-in functions

Getting an index position in a sorted list without built-in functions Question: I have been given a task to find the index position of x in a list. I have tried many times, but I always seem to get the wrong index position for some values. The rules are: No built-in functions Valid for all …

Total answers: 2

ModuleNotFoundError: No module named 'settings' for any django project

ModuleNotFoundError: No module named 'settings' for any django project Question: I have been studying Django for some time and have been working on a project. Everything was fine until yesterday when I was studying a new topic, saved the project and shut down my PC. There were no errors or anything. Today, when I tried …

Total answers: 3

Adding hatch to Seaborn multi-boxplot

Adding hatch to Seaborn multi-boxplot Question: In the chart below, I want to add hatch (‘/’) only to the ‘rest’ category in both boxlots. I will be glad if you help I add the sample codes below: import seaborn as sns exercise = sns.load_dataset("exercise") df1=exercise.loc[(exercise["diet"]=="low fat"),:] df2=exercise.loc[(exercise["diet"]=="no fat"),:] fig, axes = plt.subplots(1, 2) ax1=sns.boxplot(x=’kind’, y=’pulse’, …

Total answers: 1

Unable to initialize device PRN on Pycharm

Unable to initialize device PRN on Pycharm Question: New to PyCharm, was wondering what is going wrong, I have the newest Pycharm update installed, can’t run terminal commands on PyCharm for some reason. Every time I try, I get the "Unable to initialize device PRN" response from PyCharm. For context, I do have Python installed …

Total answers: 2

How do I remove float and NaN

How do I remove float and NaN Question: I’m trying to convert a list with over 20 rows and convert into a data frame but I’m running into an issue. When I convert my list, it returns a float and nan in some of the numbers in my data frame. Is there a way to …

Total answers: 2

How to fix TypeError: cannot unpack non-iterable Button object

How to fix TypeError: cannot unpack non-iterable Button object Question: I was writing my PySimpleGUI program and it (Still) does not load This is the error it gives me: Traceback (most recent call last): File "D:PythonLavoro.py", line 89, in <module> event = window.read() ^^^^^^^^^^^^^ File "D:PythonvenvLibsite-packagesPySimpleGUIPySimpleGUI.py", line 10075, in read results = self._read(timeout=timeout, timeout_key=timeout_key) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ …

Total answers: 2

os.listdir returns the error: no such file or directory even though the directory actually exists

os.listdir returns the error: no such file or directory even though the directory actually exists Question: This is my project files structure: and this is my main.py script: if __name__ == ‘__main__’: leukemia_dir = "../dataset/leukemia" # if I click here, I get redirected to the folder file_names = os.listdir(leukemia_dir) # << won’t work Unfortunately, os.listdir(leukemia_dir) …

Total answers: 2