Linked Questions
16 questions linked to/from Python module with a dash, or hyphen (-) in its name
0
votes
1
answer
453
views
How do I import modules that have '-' within the module name in python 3 [duplicate]
I'm trying to import a module that has a dash in the module name. Whenever I try this, I get a syntax error. Can I get some help?
I've tried reinstalling the module with pip3
I've also tried using ...
0
votes
1
answer
174
views
Import python module from another folder, with main directory having a "-" [duplicate]
I have a workspace called "bi-etl". The structure is as follows:
├───bi-etl
│ ├───utils
│ │ ├───file_a.py
│ │ └───file_b.py
│ ├───googlesheet
│ │ ├───parameter_update.py
The ...
-1
votes
1
answer
71
views
Python Import Syntax Rules [duplicate]
I've been doing some searching but I couldn't find any consensus on the syntax allowed for imports.
I threw an syntax error for this import and was wondering if there was documentation on allowable ...
391
votes
8
answers
266k
views
How to import module when module name has a '-' dash or hyphen in it?
I want to import foo-bar.py, this works:
foobar = __import__("foo-bar")
This does not:
from "foo-bar" import *
My question: Is there any way that I can use the above format i.e., ...
207
votes
7
answers
151k
views
Is it ok to use dashes in Python files when trying to import them?
Basically when I have a python file like:
python-code.py
and use:
import (python-code)
the interpreter gives me syntax error.
Any ideas on how to fix it? Are dashes illegal in python file names?
1
vote
3
answers
4k
views
Problem with python and __import__
Sorry for the generic title, will change it once I understand the source of my problem
I have the following structure:
foo/
foo/__init__.py
foo/bar/
foo/bar/__init__.py
foo/bar/some_module.py
When I ...
1
vote
0
answers
3k
views
Importing files from different folder, "__init__.py" does not work
I have seen many responses suggesting including an __init__.py file in the subdirectory of submodules in order to import them as python package, but I can't get it working for my project. My project ...
3
votes
0
answers
3k
views
Import a module from a subdirectory in FastAPI
I have an api with a structure like this
my-api
├── Dockerfile
├── __init__.py
├── app
│ ├── __init__.py
│ ├── api
│ │ ├── __init__.py
│ │ └── mymodule.py
│ ├── config.py
│ ├── main....
-3
votes
1
answer
1k
views
Python: Error when importing a module with '-' in the name
I am trying to import anisble playbook module from sh
>>>> from sh import ansible-playbook
File "<stdin>", line 1
from sh import ansible-playbook
^
...
1
vote
3
answers
702
views
Django - ModuleNotFoundError
I'm trying to import a python file from another python file in Django. There is a function I want to call from the other file, but every time I import the file I get an error.
Traceback (most recent ...
0
votes
2
answers
370
views
Call webservice method that contains hyphen
I am trying to call SAP web service using zeep module. We have a web service method called “-CTSH-HC_RFC_XCHG_RATE_UPLOAD” and when try to call that method, getting the error
” Service has no ...
0
votes
3
answers
148
views
Python module import containing . and _
Problem:
I would like to import a module (name: Ex3.2_myModule) to a file (name: Ex3.2_Test.py). They are in the same directory. To do it I tried several options (i.e. screenshot) proposed in several ...
0
votes
1
answer
183
views
Django App installed from Git but not found
I want to install some apps I have developed and are hosted on my own git service but since it appears they have been correctly installed, when I add them to INSTALLED_APPS throws me a ...
1
vote
0
answers
88
views
How to create documentation for Python project with filename having '-', for example 1-test.py
I am trying to create a documentation for my python project using sphinx. When I do make html, i am getting errors arrivals.7`-`clean module:
WARNING: invalid signature for automodule ('modules.1-...
0
votes
2
answers
56
views
Importing a file from a different folder
I have the folder structure
├── project-main
└── assets
└── player.py
└── map.py
How do I import map.py into player.py
I tried
from map import *, which didn't work
I also tried
from project-...