Python conflicting module names

Import with files names conflict

I’m trying to develop a simulation class that replaces serial at specific apps(Win7, python 2.7). I have a SerialHandle class that works in number of apps, It’s job is add logic to the well known serial methods, the idea was to replace python serial.py with a dummy file with the same name so we won’t have to change and imports at SerialHandle . Now i have this file with Serial class just like the origin and it works fine:

Since i want to really simulate the methods i need the SerialException from serialutil so inside my serial.py i’m trying to import it using: from serial import SerialException But as expected i’ll get this raise since from serial goes to the local file at first:

Traceback (most recent call last): File "C:/CROW/ATE/DUTDrivers/DD_SimulatorExample/DD_SimulatorExample.py", line 18, in from Utilities.Serial.SerialHandle.trunk.SerialHandle import SerialHandle File "C:\CROW\ATE\Utilities\Serial\SerialHandle\trunk\__init__.py", line 4, in from Utilities.Simulator import serial File "C:\CROW\ATE\Utilities\Simulator\serial.py", line 11, in from serial import SerialException ImportError: cannot import name SerialException 
  1. Any way to tell the interpreter to ignore the local file at a specific from..import?
  2. Is there any other way to import from an absolute path?
  1. the file naming as serial.py is not a decision it’s a definition so changing the name is not relevant.
  2. Overloading python serial is not an option also.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Читайте также:  Произведение цифр строки python

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot install. CommandError: ‘xxx’ conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name. #359

cannot install. CommandError: ‘xxx’ conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name. #359

Comments

Followed exactly the instructions in the docs but when I get to «djangocms mysite» there is an error every time. Does not matter what I call the project. I am using python 3.7 on windows10

CommandError: ‘xxx’ conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name.

This is probably a documentation error. Previous version uses «djangocms -p . mysite» which works. The current documentation just says «djangocms mysite» which fails.

The text was updated successfully, but these errors were encountered:

1.2.0 I tried all kinds of names and there were not packages called those. Though when I did install using the -p option it looks nothing like the tutorial. The edit screen has no history, structure, content buttons nor toggle to hide toolbar. And when I added a 2nd content block the plugin + button does nothing. So looks like I am using a version that does not work?

On Fri, 27 Dec 2019 at 15:53, Iacopo Spalletti ***@***.***> wrote: @simonm3 thanks for following up here. Which djangocms-installer version are you using? I will check on windows, but both versions djangocms mysite and djangocms -p . mysite` should work (and work on my setup). I need to check on windows in the next days as I don’t have a windows box at hand. Validation is pretty basic: — project name must match this regexp https://github.com/nephila/djangocms-installer/blob/develop/djangocms_installer/config/internal.py#L13 — in must not be a keyword or a builtin ( https://github.com/nephila/djangocms-installer/blob/develop/djangocms_installer/config/internal.py#L38, https://github.com/nephila/djangocms-installer/blob/develop/djangocms_installer/config/internal.py#L39 ) — and import of the symbol must fail I can provide a dev version which enable a more verbose logging in this section to debug which of the check fails — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub , or unsubscribe .

Читайте также:  Установка пакета whl python

1.2.0 works according to my (and other users) test.
I’d better check what’s the behavior on windows 10, but it will take me a couple of days to have a windows box at hand

Hi yakky!!
Any resolution you identified on this issue, I am having same issue on windows 10 system.

Sorry, I currently don’t have a windows box to test the behavior

I very happily welcome some help from people with a windows PC at hand who can test and debug this behavior

i had the exact same error following the getting started instructions on the django website. also, i’m a windows 10 user. after considering (http://docs.django-cms.org/en/latest/introduction/01-install.html) it worked like a charm. i saw a discrepancy between
(env) $ djangocms mysite
and
mkdir tutorial-project
cd tutorial-project
djangocms mysite

See below a test run on a fresh windows 10 box with Python 3.8.6 installed

Just make sure that the current directory where you launch the command is empty and everything should be fine

Microsoft Windows [Version 10.0.17763.379] (c) 2018 Microsoft Corporation. All rights reserved. C:\>mkdir site_base C:\>cd site_base C:\site_base>python -m venv env C:\site_base>env\Scripts\activate (env) C:\site_base>python --version Python 3.8.6 (env) C:\site_base>pip install djangocms-installer Collecting djangocms-installer Downloading djangocms_installer-1.2.3-py2.py3-none-any.whl (56 kB) |ŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠ| 56 kB 156 kB/s Collecting tzlocal Downloading tzlocal-2.1-py2.py3-none-any.whl (16 kB) Requirement already satisfied: pip in c:\site_base\env\lib\site-packages (from djangocms-installer) (20.2.1) Collecting dj-database-url>=0.4 Downloading dj_database_url-0.5.0-py2.py3-none-any.whl (5.5 kB) Collecting six Downloading six-1.15.0-py2.py3-none-any.whl (10 kB) Collecting pytz Downloading pytz-2020.4-py2.py3-none-any.whl (509 kB) |ŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠŠ| 509 kB 7.7 kB/s Installing collected packages: pytz, tzlocal, dj-database-url, six, djangocms-installer Successfully installed dj-database-url-0.5.0 djangocms-installer-1.2.3 pytz-2020.4 six-1.15.0 tzlocal-2.1 WARNING: You are using pip version 20.2.1; however, version 20.2.4 is available. You should consider upgrading via the 'c:\site_base\env\scripts\python.exe -m pip install --upgrade pip' command. (env) C:\site_base>djangocms mysite Creating the project Please wait while I install dependencies If I am stuck for a long time, please check for connectivity / PyPi issues Dependencies installed Creating the project Operations to perform: Apply all migrations: admin, auth, bootstrap4_alerts, bootstrap4_badge, bootstrap4_card, bootstrap4_carousel, bootstrap4_collapse, bootstrap4_content, bootstrap4_grid, bootstrap4_jumbotron, bootstrap4_link, bootstrap4_listgroup, bootstrap4_media, bootstrap4_picture, bootstrap4_tabs, bootstrap4_utilities, cms, contenttypes, djangocms_file, djangocms_googlemap, djangocms_icon, djangocms_link, djangocms_picture, djangocms_snippet, djangocms_style, djangocms_text_ckeditor, djangocms_video, easy_thumbnails, filer, menus, sessions, sites Running migrations: . Migrations skipped for brevity . Creating admin user All done! Get into "C:\site_base\mysite" directory and type "python manage.py runserver" to start your project (env) C:\site_base>

Источник

Читайте также:  Is not selected java

Python conflicting module names

Seriously this is going to make me drop Django as a whole. It’s so frustrating.

I start a new project using https://www.django-rest-framework.org/tutorial/quickstart/

I activate the python virtual environment.

My requirements.txt looks like this:

asgiref==3.4.1
Django==3.2.6
django-cors-headers==3.4.0
django-environ==0.8.1
djangorestframework==3.12.4
django-rest-knox==4.1.0
gcloud==0.17.0
googleapis-common-protos==1.53.0
httplib2==0.19.1
jws==0.1.3
oauth2client==3.0.0
protobuf==3.17.3
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycryptodome==3.4.3
pyparsing==2.4.7
Pyrebase==3.0.27
python-jwt==2.0.1
pytz==2021.1
requests==2.11.1
requests-toolbelt==0.7.0
rsa==4.7.2
six==1.16.0
sqlparse==0.4.1
I try to start a new app with django-admin startapp profile. Immediately hit with this error:

CommandError: ‘profile’ conflicts with the name of an existing Python module and cannot be used as an app name. Please try another name.

I’ve googled around and nothing has helped. I’m on OSX. I thought pyenv was suppose to isolate my app from other module definitions.

Guess i’ll start a node app then.

Источник

Оцените статью