I'm trying to use gdata python but unfortunately when I execute my script it keeps on saying me "ImportError: No module named docs".
I have tried importing it by running python directly in shell and everything seems fine.
Can someone help me out with this problem?
edit:
import gdata.docs
import gdata.docs.service
import gdata.docs.client
import gdata.spreadsheet.service
I had this problem when I started. My guess is that your Gdata library is not on your Python path. For example, my gdata and atom modules are located in the Python27/Lib/site-packages folder.
Another option is to update your PATH environmental variable to point to the current location of the Gdata files.
Related
I can't get this simple statement to work:
from plyer import notification
getting:
ImportError: cannot import name 'notification'
the import statement is correct and is used the same way in examples.
I couldn't find any special instructions to use this library so I'm assuming there aren't any.
I installed plyer using pip and it installed successfully. verified the files are in place. I tried using python 3.5 and 3.6, same result.
It seems the package is recognized but just the module isnt found?
Would appreciate some insight :)
A common cause for this kind of problem is having a script or module by the same name in a location that comes before the expected module or package's location in sys.path so it gets imported instead of the expected module or package.
The simple way to sort this out is to add this simple line before:
import plyer; print(plyer);
and check the result which will diplay the path of whatever named plyer was first found. Chances are it's a script in your current working directory...
I am trying write a python program to use the Opsgenie API's to pull some reports.
I installed the https://github.com/opsgenie/opsgenie-python-sdk
When i run my program i get the error message
"from opsgenie.alert.requests import ListAlertsRequest
ImportError: No module named requests"
The module is present in the site packages folder and I also added the path to the folder to PYTHONPATH.
It happened for multople module I am not sure if the dependencies work on the opsgenie-sdk.
Has anyone had this issue?
Help appreciated.
I am using an online spreadsheet app called AirTable and need to be able to access the API using Python.
There is a python interface to the API as outlined on Github:
https://github.com/bayesimpact/airtable-python
I've followed the getting started directions and when I run the code I get the following error:
AttributeError: module 'airtable' has no attribute 'Airtable'
What am I doing wrong?
Temporary fix:
from airtable import airtable
Permanent fix:
1 find your airtable installed path
2 find the ini file
3 Remove the #
4 Specify the class you need to use once imported
from airtable import airtable
class Airtable(object):
pass
May be more class you need to add.
I had this problem as well. The filename which I was writing in was named airtable.py
When I changed the filename to air.py it was able to import airtable without an issue.
First, check that if your project has a file name "airtable.py"
"You should never use the same name for a python file that is for a python library, python confuses its self, deciding where should it import, its priority is to import from the project files first and go to libraries later"
if that does not works then you may have installed the wrong library
pip uninstall airtable
python working library for airtbale is
pip install airtable-python-wrapper
The same question has been asked a number of times but I couldn't find the solution.
After I install a package using pip, I am able to import it in python console or python file and it works as expected.
The same package when I try to include in django, it gives import error.
Do I need to modify settings.py file or any requirement that I need to add? I am driving django with the help of virtual env.
Eg:
I am using BeautifulSoup and I am trying to import from bs4 import BeautifulSoup and I am getting error ImportError: No module named 'bs4'
This error only comes in django. I am not able to figure out why this is happening.
Screenshot attached for reference.
1. python console - shows no error
2. django console- import error
I am sorry as it is difficult to read the console but any other thing that I can include which will help me make myself more clear will be appreciated.
You don't show either the code of your site or the command you ran (and the URL you entered, if any) to trigger this issue. There's almost certainly some difference between the Python environment on the command line and that operating in Django.
Are you using virtual environments? If so, dependencies should be separately added to each environment. Were you operating from a different working directory? Python usually has the current directory somewhere in sys.path, so if you changed directories it's possible you made bs4 unavailable that way.
At the interactive Python prompt, try
import bs4
bs4.__file__
That will tell you where bs4 is being imported from, and might therefore give you a clue as to why it's not available to Django.
Im trying to import a company module into my software and I get the error:
ImportError: No module named config
from:
from pylons.config import config
So obviously, the module that im importing requires pylons.config but cant find it in my virtual environment.
If I go to the terminal and try some Python scripts I can seem to find the config file if I try:
from pylons import config
but will error if I try:
import pylons.config
Why is this?
And does anybody how or where I can get:
from pylons.config import config
to work. Bearing in mind that I cannot change the code for this module, only mine which is importing it or my own system files.
UPDATE
If anyone finding this page has a similar problem you may find that you are trying to run two modules with different versions of Pylons.
For example, you are creating a login application called myApp. You have some Python modules which help with login handling called pyLogin.
First you install pyLogin with python setup.py install. This adds the libraries to your site packages and updates any libraries it depends on, such as SqlAlchemy.
Next you install myApp in the same way which again updates libraries and dependencies.
This problem will occur if pyLogin and myApp are using different versions of Pylons. If pyLogin is using Pylons 0.9.6 and myApp is using Pylons 1.0 for example, then the pyLogin code will be called from myApp but it will be running in the wrong Pylons framework and hence will require EITHER from pylons import config or from pylons.config import config, but will only work with one. If it is using the wrong call for Pylons then you will find yourself with this error message.
So the only solution to this error is to either find earlier or later libraries which use the same Pylons version as your application or to convert your application to the same Pylons version as the libraries you are using.
There is a diffrence between two usages...
import loads a Python module into its own namespace, while from loads a Python module into the current namespace.
So, using from pylons import config imports config to to your current namespace. But trying to import a class or function using import is not possible since there is no namespace to keep them... You can only import modules, and use functions or classes via calling them with their own namespace like
import pylons
....
pylons.config #to retreive config
More about import in Python