Open hygull opened 6 years ago
Today, I installed python_wpapi using pip and tried to execute my main.py file but failed.
python_wpapi
main.py
The following is the install history on GIT BASH (Windows 10).
rishikesh agrawani@DESKTOP-8AATOO4 MINGW64 /d/projects/Tasks/PyLaTex/wordpress-api/src $ pip install python_wpapi Collecting python_wpapi Using cached python_wpapi-0.3.1-py2.py3-none-any.whl Requirement already satisfied: requests in c:\anacondapython2.5.0.1\lib\site-packages (from python_wpapi) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\anacondapython2.5.0.1\lib\site-packages (from requests->python_wpapi) Requirement already satisfied: idna<2.7,>=2.5 in c:\anacondapython2.5.0.1\lib\site-packages (from requests->python_wpapi) Requirement already satisfied: urllib3<1.23,>=1.21.1 in c:\anacondapython2.5.0.1\lib\site-packages (from requests->python_wpapi) Requirement already satisfied: certifi>=2017.4.17 in c:\anacondapython2.5.0.1\lib\site-packages (from requests->python_wpapi) Installing collected packages: python-wpapi Successfully installed python-wpapi-0.3.1
Now I created 2 files main.py and config.py inside my current directory /d/projects/Tasks/PyLaTex/wordpress-api/src.
config.py
/d/projects/Tasks/PyLaTex/wordpress-api/src
USERNAME = "hygull"; PASSWORD = "^([A-Zm-z]{0-9})(WdPrs)$";
import config from python_wpapi import WpApi; username = config.USERNAME; password = config.PASSWORD; api1 = WpApi("https://hygull.wordpress.com"); print api1.get_posts();
When I tried to run, it shows me error as follows.
rishikesh agrawani@DESKTOP-8AATOO4 MINGW64 /d/projects/Tasks/PyLaTex/wordpress-api/src $ python main.py Traceback (most recent call last): File "main.py", line 2, in <module> from python_wpapi import WpApi; ImportError: cannot import name WpApi
@hygull Try using from python_wpapi.python_wpapi import WpApi
from python_wpapi.python_wpapi import WpApi
Today, I installed
python_wpapi
using pip and tried to execute mymain.py
file but failed.The following is the install history on GIT BASH (Windows 10).
Now I created 2 files
main.py
andconfig.py
inside my current directory/d/projects/Tasks/PyLaTex/wordpress-api/src
.config.py
main.py
When I tried to run, it shows me error as follows.