manage.py createsuperuser: AttributeError: module 'os' has no attribute 'PathLike' - python

I'm trying a Django tutorial. For some reason my existing superuser got deleted; creating that went fine, but I can't make another one. This also happens when I try to use pip.
I didn't change anything in the libraries so not sure why this happens now but didn't before. On windows 7 (Python 3.6.3 and Django 1.11). I've seen similar but not the exact same problems for Windows. Still I checked the file and there seems to be a PathLike class.
I've also tried to repair my Python installation but it didn't help. any ideas?

Seems like you may have modified the settings.py file. But as MrName mentioned you need to share full stack trace

This looks like a feature that changed in Python3.6 as you can see here. Make sure that your python version is 3.6 or greater.

Update your Python and Django version and that will work perfect.

AttributeError: module 'os' has no attribute 'PathLike'
Installing it into the global site-packages with the below command solved my problem:
pip install --user virtualenvwrapper

Related

Why can't I use/import a ttk theme in Python

So I was trying to use a ttk theme named "Sun Vally" (Link) But when I tried to use it, it gave an error of "ModuleNotFoundError: No module named 'sv_ttk'" even though I already have pip installed it.. I am still new to all this.. thanks in advance!
For starters, try running the command pip list in your terminal. Does the module sv_ttk 1.0 appear in the list? If not, you may need to try running pip install sv-ttk again. This also assumes you aren't using a Python virtual environment, but I imagine you aren't.
You may also want to check if the module is properly installing into your site packages directory (the location of which is platform dependent). Are you on Mac OS or Windows?
Please update this question with a minimal example of what you've already tried so we can help you further.
IF FIGURED IT OUT! I was using cmd to install pip but never realized I needed to use a different terminal... Turns out PyCharm has its own terminal and wont work if you used a different one...

How do I fix this python converting file into an app - still have not found a solution

This question is not a duplicate of this question, because I am trying to create an app.
I am currently following this tutorial, but when I try to run my app,
my command prompt prints out this error:
Why does this error happen and how can I solve it? I read through all the answers to the linked question, but none of them are pertinent to my problem.
Please anyone help me, I still haven't found a working solution; I am getting desperate!!!
Edit: I can't just install and uninstall pynput? Idk why it doesn't work because shouldn't pynput come with idle?
Version: 3.74 python idle, most updated version of pyinstaller
The following might help you if you haven't tried them already:
Update pip from the command line
Unistall pyinstaller
Re-install pyinstaller and try it again
If the above does not work, try running the following command in the command line. Make sure there are some print statements in your code to see if it works.
python monitoring_culmination_product.py
If you got a message saying "python is not recognised as an internal or external command" then python might have not been added as an environment path.Try this to fix the issue.
You could always re-install python if things get difficult.(make sure you install the appropriate version 32-64bit)
If the command though executed without a problem. Try to use pyinstaller on another file to see if the problem has to make sure the problem has to do with pyinstaller.
From a personal experience, pyinstaller can be unreliable at times so I put the following line in my projects just to make sure. It might help you too.
import pkg_resources.py2_warn
Disclaimer: Although it is not specified I assume that you are using Windows
You could try to use conda create to get an environment containing all the need dependencies (numpy, etc) and then use pyinstaller as explained in this discussion.
Please fall back to 1.6.8 version of pynput. pip install pynput==1.6.8
Ref : https://stackoverflow.com/a/63721929/14759065

Error importing numpy & graphlab after installing ipython

I have got a strange issue.
I am now using graphlab/numpy to develop a project via Pycharm 5. OS is Mac OS 10.11.5. I created a p2.7 virtual environment for the project. Programme runs well. But after I install ipython, I can no longer import graphlab and numpy correctly.
Error message:
AttributeError: 'module' object has no attribute 'core'
System keeps telling that attribute ‘core' and 'connect' are missing. But I am pretty sure that they can be found in graphlab/numpy folders, and no duplicates.
Project runs all right in terminal. Now I have to uninstall ipython. Then everything is ok again.
Please kindly help.
Please remember that console applications and GUI application do not share the same environment on OS X.
This also means that if you install a Python package from the console, this would probably not be visible to PyCharm.
Usually you need to install packages using PyCharm in order to be able to use them.
Upgrading pip itself then reinstalling worked for me

editing code of a python module

Running pymatlab on my machine results in
Exception AttributeError: "'MatlabSession' object has no attribute 'engine'" in > ignored
after the command session = pymatlab.session_factory() is run.
How to fix this problem has been discussed already here:
Running MATLAB from Python
It looks like one line of code in the sessionfactory.py script in the pymatlab module has to be changed in a minor way. The problem I have is that the pymatlab module which is installed on my machine is in .egg form and it doesn't look like it is possible to change the code directly with a text editor. Any suggestions on how to do that?
Thanks
If you use easy_install, check
How do I forbid easy_install from zipping eggs?
If you prefer pip (and you probably should), check
pip: “Editable” Installs, i.e.
pip install -e pymatlab

Running django-admin.py startproject is giving me an error

I've just started looking into python and django.. Im pretty sure ive successfull installed both python and the django framework and i managed to add python and django-admin.py to my system path but now when i run the command django-admin.py startproject My_Test_Site, in the folder i want to create a new project directory in (just following the tutorials), i get the following error:
What am i doing wrong?
This is not a Django error. It appears it cannot find the Python module unicodedata which is part of the Python Standard Library (docs). I see that there is also a bug report about this issue (Python 2.7 on Windows, see here). On the other hand, some people there report that reinstalling their Python installation fixed the problem. You could give that a try.
notice the last line, it says import unicodedata, importError
im guessing you probably didnt install your django properly.
so reinstall it and check that django is in your "path", i believe django does this automatically when it installs but doesnt hurt to double check.
if reinstalling django still doesn't work, i suggest you uninstall python and django related stuff.
then install python, install pip, then use pip install django.

Categories