I would like to install PRAW so I can make reddit bots and stuff, but all the install guides are confusing to me so could someone explain how to as noob friendly as possible. I've had some experience with vanilla python. Thanks!
praw is best installed, according to the documentation, via pip. To install pip, you need setuptools. Here is a simple guide on installing pip via setuptools.
Basically, download ez_setup.py and get-pip.py, two Python scripts that automatically get and install setuptools and pip. You'll want to run the following commands in the terminal in the same directory as the location of the files, in order:
python ez_setup.py
python get-pip.py
Finally, you'll want to use pip to get praw. pip is an executable file that is usually located in your python build directory. For example, in Windows, it's located in C:\Python27\scripts. You can add that directory to your system path variable, but right now you can just navigate to that directory where pip.exe is installed. Then, run the following command in the terminal:
pip install praw
I recently had trouble with this so I thought I would add what I did.
Install Pip - https://pip.pypa.io/en/stable/installing/
install praw pip install praw; This is done on your pc/mac/linux(?)
Installation guide
Register on reddit as a developer and register the app. To be able to use the api you need to have a client_id and a client_secret. Get those by registering here. More information about the types of applications can be found here.
Now you are ready to begin coding. This is a good script to verify that you are connecting to the reddit api. The client_id and client_secret are from the previous step and the user_agent is a string that is unique to your app. I used something like 'my first app by /u/myUsername'. The password and username is your reddit login
Run this code and it should output your username.
import praw
reddit = praw.Reddit(client_id='CLIENT_ID',
client_secret="CLIENT_SECRET", password='PASSWORD',
user_agent='USERAGENT', username='USERNAME')
print(reddit.user.me())
Related
I found this script (tutorial) on GitHub (https://github.com/amyoshino/Dash_Tutorial_Series/blob/master/ex4.py) and I am trying to run in my local machine.
Unfortunately I am having and Error
I would really appreciate if anyone can help me to run this script.
Perhaps this is something easy but I am new in coding.
Thank you!
You probably just need to pip install the dash-core-components library!
Take a look at the Dash Installation documentation. It currently recommends running these commands:
pip install dash==0.38.0 # The core dash backend
pip install dash-html-components==0.13.5 # HTML components
pip install dash-core-components==0.43.1 # Supercharged components
pip install dash-table==3.5.0 # Interactive DataTable component (new!)
pip install dash-daq==0.1.0 # DAQ components (newly open-sourced!)
For more info on using pip to install Python packages, see: Installing Packages.
If you have run those commands, and Flask still throws that error, you may be having a path/environment issue, and should provide more info in your question about your Python setup.
Also, just to give you a sense of how to interpret this error message:
It's often easiest to start at the bottom and work your way up.
Here, the bottommost message is a FileNotFound error.
The program is looking for the file in your Python37/lib/site-packages folder. That tells you it's looking for a Python package. That is the directory to which Python packages get installed when you use a tool like pip.
Alright, have been installing Google Assistant on my Windows 10 PC and have been met with multiple errors, the last of which I solved by going here: Google Assistant Installation on Python3.6 OSX
Now, I have everything installed, and want to test my mic and then start using the assistant. However, when I put in the commands
python -m googlesamples.assistant.audio_helpers
and
python -m googlesamples.assistant
I get this error:
C:\Users\robmak3>python -m googlesamples.assistant
C:\Users\robmak3\AppData\Local\Programs\Python\Python36\python.exe: No
module named googlesamples.assistant.__main__; 'googlesamples.assistant' is
a package and cannot be directly executed
I've been trying to follow this guide: https://www.xda-developers.com/how-to-get-google-assistant-on-your-windows-mac-or-linux-machine/
Any help fixing this would be great! Thanks!
As per version 0.3.0 of the SDK the gRPC samples are using a different auth helpers.
pip install --upgrade google-auth-oauthlib[tool]
google-oauthlib-tool --client-secrets path/to/client_secret_XXXXX.json --scope https://www.googleapis.com/auth/assistant-sdk-prototype --save --headless
And you can launch the update gRPC sample with:
python -m googlesamples.assistant.grpc.pushtotalk
You should be able to follow the instructions from the SDK package and gRPC package page and explore the reference sample
Try this command instead:
python -m googlesamples.assistant.grpc.audio_helpers
If you go to the following path you will notice that there is a directory named grpc inside assistant directory.
C:\Users\%username%\appdata\local\programs\python\python36-32\lib\site-packages\googlesamples\assistant\
That is why you need to append .grpc next to assistant. And inside grpc directory you can see audio_helpers.py script.
To launch google assistant enter following command:
python -m googlesamples.assistant.grpc.pushtotalk
I am currently setting up Django on my Windows 10 system and after having installed it successfully, I am now facing an error message when trying to start a new Django project.
I have created a new directory for my project, gone to the command line and changed the directory to this new folder path and then typed the command:
django-admin.py startproject mysite
but I get a pop up window with the error message:
"Still can't get my hands on win32ui"
As I understand it, win32ui is a module contained within pywin32 - so I have gone and checked that pywin32 is correctly installed on my laptop - which it is as:
pip install pywin32
results in:
Requirement already satisfied (use --upgrade to upgrade): pywin32 in c:\python27\lib\site-packages
I've searched Google and StackOverflow but there isn't a single hit for this error message in relation to new Django projects.
Could anyone shed some light on how I can successfully get a new Django project set up?
According to here, to install pywin32 system files, run python.exe Scripts\pywin32_postinstall.py -install from an elevated command prompt.
For example, this works for me: "C:\Programs\Python\Python3\CPython\x64\Python35\python.exe" "C:\Programs\Python\Python3\CPython\x64\Python35\Scripts\pywin32_postinstall.py" -install.
It looks like Python can't properly locate the libraries you're trying to import. Doing a clean python install may solve the issue. However, instead of doing that, you could try the following:
I've seen this problem happen before when a python installation failed to copy pywintypes27.dll and pythoncom27.dll to the win32 folder, please try doing this:
Go to C:\Python27\Lib\site-packages\pywin32_system32
Copy pywintypes27.dll and pythoncom27.dll
Paste them in C:\Python27\Lib\site-packages\win32
For future reference, if this works, how did you install Python?
This should be pretty basic as I've installed lots of python packages, but I can't for the life of my get google apis client library for python to install.
I'm pressure sure I've gone through the instructions on this website properly:
https://developers.google.com/api-client-library/python/start/installation
To summarize I've done the following:
$ easy_install --upgrade google-api-python-client
this seems to work fine, doesn't report any errors or warnings
downloaded and unzipped google-api-python-client-gae-1.2.zip into the directory where my project is
but if I open an iPython session in the folder where I unpacked the full dependencies I can't do the basic imports such as:
import google.appengine.api it just says "No Module named google.appengine.api"
I checked in my site-packages folder and google_api_python_client-1.2-py2.7.egg is there. But it doesn't show up in sys.path
when I do sys.path.append('C:\Anaconda\Lib\site-packages\google_api_python_cli
ent-1.2-py2.7.egg') it adds the correct path, but the import still doesn't work.
EDIT: This fixed my problem
Adding the Google SDK to my Python path did the trick. I don't know why the installer didn't do this when I ran it. but hey, this worked
So if I run:
sys.path.append('C:\\Program Files (x86)\\Google\\google_appengine')
from google.appengine import api
works!
Without knowing all the steps you took to install app engine and the client APIs, my only recommendation is to install (or reinstall) the Google App Engine Python SDK from here: https://developers.google.com/appengine/downloads#Google_App_Engine_SDK_for_Python. Looks like you're on windows, so you would grab the MSI.
Just make sure you launch the AppEngineLauncher application after installation as it will give you the option to create symlinks so you can run commands from terminal.
I am trying to learn how to use Google Cloud Storage with Python.
My app is location is: myapp/lib
The documentation says to use:
"pip install GoogleAppEngineCloudStorageClient -t myapp/lib"
When I do I get:
"error: must supply either home or prefix/exec-prefix -- not both"
I have never used pip to install to a specific directory, I have just used it for my local Python installation.
I am under the impression that you need to be able to install 3rd party modules in the libs directory of your app in order for Google App Engine to use them. Is this correct?
How do people do this?
Leon
I had a similar issue when trying to install BeautifulSoup. Finally I had just downloaded it manually and put it in a folder named 'bs4' inside of 'libs' and using it like this:
sys.path.insert(0, 'libs')
from bs4 import BeautifulSoup
You should be able to download GCS from SVN as well, check out these links:
https://developers.google.com/appengine/docs/python/googlecloudstorageclient/download
https://developers.google.com/appengine/docs/python/googlecloudstorageclient/#Python_What_to_do_next
My app worked perfectly with BeautifulSoup in the 'libs' folder when deployed to google cloud appengine.
You can cd to the app directory and just run "pip install GoogleAppEngineCloudStorageClient -t lib".
Alternatively, it can be downloaded directly from here. You can then move the cloudstorage folder with your app.
To install the client library on Windows 7 in my project, I used:
C:\Python27\scripts>pip install setuptools --no-use-wheel --upgrade
C:\Python27\scripts>pip install GoogleAppEngineCloudStorageClient -t <my_app_directory_root>
More here.