"sharepoint" and "sharepy" packages unable to import - python

I'm trying to write a script in python that will modify files and folders in a sharepoint site. Based off what I've read online about working with sharepoint using python, I tried to install and import the "sharepoint" and "sharepy" modules.
I used "pip install sharepoint" and "pip install sharepy" in the command prompt to install the packages, and then in my script used these lines to import the packages:
import sharepoint
import sharepy
Multiple IDE's don't recognize the packages (in Visual Studio, the error says "No module named 'sharepoint'") and I can't use their libraries to complete my code. The modules in question are present in the same subfolder as other modules that do successfully import, so I'm not really understanding the problem here. What could be causing these libraries to not import?

in visual studio code change python path to where you installed python

You don't need a module named "sharepoint"
Instead of that, you have to install : office365-rest-python-client
(with pip)

Related

Module importing works in python console (pycharm) but not works on terminal

Hi i'm recently working on a module in python (package named pykiwoom)
I installed a module in conda 32-bit environment pip install pykiwoom and tried to import this
from pykiwoom.kiwoom import Kiwoom
This works perfectly fine when I execute this in python console in pycharm
However, when I try this in terminal error occurs
ModuleNotFoundError: No module named 'pykiwoom.kiwoom'; 'pykiwoom' is not a package
internal structure of package pykiwoom looks like this
pykiwoom
init.py
kiwoom.py
parser.py
Can somebody tell me why this error occurs?
I think where you install your package is important in your case. You can check the packages installed using pip list in terminal, and check if you find it there.
This solution provides overview of how to setup your files as packages and modules.
Nevertheless, I think if you install your package in the terminal using pip, you could possibly access it.

Trying to import GitHub module

I'm trying to import https://github.com/chrisconlan/algorithmic-trading-with-python in my code. I've never imported anything from GitHub before and have looked at various other questions that have been asked on Stack Overflow regarding this problem but it just doesn't work. When I try to run the 'portfolio.py' code for example I keep getting a ModuleNotFound error for 'pypm'. What exactly is the correct way to import such a module or the whole GitHub directory?
I'm working with Visual Studio Code on Windows.
You will need to pip install the module. In your case the command you would need to run is python -m pip install -U git+https://github.com/chrisconlan/algorithmic-trading-with-python. Once you have done that you need to find the name of the module. You can do this with pip list. Find the name of the module you just installed.
Then you just stick import <module name> at the top of your code with the rest of your imports.
What i used to do in this is to clone the repository on the folder where are installed the python's packages. This is useful when you do not want to use the pip cmd tool, keeping the pip's cache memory under control.

"unresolved import" in Python - all other imports worked so far?

I am a bit lost. I've just recently started working with python and have been able to use other libraries, that I've imported without any issues.
Install via pip command
Restart Visual Studio Community 2019
I can use the library
Now I wanted to import the docx2pdf library. But using the same 3 steps is not working and I don't know what to do.
from docx2pdf import convert <-- gets the error "unresolved import"
Also:
after installing it via pip I get the following message in addition to the installation being a success:
WARNING: The script docx2pdf.exe is installed in 'C:\Users\user\AppData\Roaming\Python\Python37\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
I didn't get this message from other libraries.
I am using windows 10.
Thanks for the help!
In VS Code, when we use the global python environment to install the module, we can use the command "pip show docx2pdf" to check its storage location is: "\users\username\appdata\local\programs\python\python38\lib\ site-packages"
It is recommended that you reinstall the module "docx2pdf" or try to delete the previously installed "docx2pdf" folder and reinstall it.
Run:

Pylint error in Visual Studio Code Python

I'm getting this Unable to import 'dataImport' pylint(import-error).
How do I resolve this?
Attached is my codes:
import saveFile
import dataImport
dataImport.read_csv('income.csv')
saveFile.educationGraph()
saveFile.ageGraph()
saveFile.YrsInCompanyGraph()
saveFile.yrsCurrRoleGraph()
saveFile.workYrsGraph()
enter image description here
When I installed the module "dataImport" using pip in VSCode,(pip install dataImport) I still couldn't use it, so I found it in the package installation directory and found that it was installed by default with the name "dataimport", so VSCode could not find the package "dataImport".
solve:
We can rename the package name to "dataImport", or use "import dataimport":
In addition, please confirm that the module "dataimport" is successfully installed in the currently selected VSCode environment. (pip list)

Downloaded package ImportError

I have recently installed python 2.17.14 to use a package which I installed in the command prompt with:
python -m pip install packageName
However, whenever I try to use it with a script provided by the package authors, I get Import Errors:
ImportError: cannot import X from YX
ImportError: attempted relative import with no known parent package.
I don't know what I'm doing wrong, as I am really new to Python. Does anyone have any ideas?
The package is called neurodesign and I downloaded the try out script from the official website "neuropowertools.org"
Best,
Max
In case anyone (who is also new to python^^) fails ridiculously at this task as well: I had to manually install all the modules used within this package for it to work as they weren't installed automatically.

Categories