Stackdriver Debug shows "multiple modules matching" error - google-app-engine

I am trying to live debug a Python Google App Engine Standard application in Stackdriver Debug console. When I click on a deployed file (main.py) and the line where I want it to break, I get an error message stating "Multiple modules matching" and lists a couple files with the same name.
This is a new deployed version with that filename being unique in my project. I wouldn't expect it to see multiples of the same filename. Because of that error, I am unable to debug the deployed app.

The debugger loops through all the loaded Python modules in the project and may find a file with the same name. When multiple files are listed, copy and paste the full path to the file you are wanting to debug.
Example: apps/[PROJECT]/[VERSION.UNIQUE_ID]/myfile.py:[LINE_NUMBER]
You can copy the full path from the file listed in the error message.

Related

How should I configure Webpack for a react website to be able to use it without a server

I'm building a react website. The goal for it is to be able to simply put the finished website on a USB key and be able to use it on a computer without any internet access.
I'm using react v16.6. I've already tried to simply open the build/index.html file but I received a few Not allowed to load local resource: file:///static/... and the page was blank.
This projects is using a JSON file, pictures and videos.
I don't really know where I should go from here to be able to this.
Thanks for any help.
Based on some of your details, I'm assuming you're using create-react-app.
If you read the error message or look in build.html you'll see that the built site is trying to load your javascript from /build/static/js/.... This would effectively be trying to load the files from the root of the file system, not the current directory. You can set "homepage": "." in package.json and the built site will load the files correctly. This is documented in the message that you get when you do npm run build, which also links to https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#deployment for more details.

Running GAE GCS on PyCharm under OS X, runtime error "No module named cloudstorage"

I am trying to add Google Cloud Storage functionality to a Python GAE app that is already running with significant functionality. I work entirely within PyCharm on my development computer, which is a Mac running OS X 10.9.5.
I have created a new Python module that contains this statement:
import cloudstorage as gcs
as shown in the sample code at https://cloud.google.com/appengine/docs/python/googlecloudstorageclient/getstarted
When I first added that line, PyCharm said "No module named cloudstorage" in the editor.
I then followed both the "pip" and the "svn" instructions at https://cloud.google.com/appengine/docs/python/googlecloudstorageclient/download
to download the GCS Client Library.
In trying to follow those instructions, taking into account my prior experience with this programming environment, I actually tried using "pip" three times:
Once without the "-t" option, since I've never needed that option with "pip" before
Once using the "-t" option to specify my application directory's "lib" subdirectory
Once using:
pip install GoogleAppEngineCloudStorageClient -t /Applications/GoogleAppEngineLauncher.app//Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib, since I wasn't sure what the instructions meant by "<your_app_directory/lib>"
As mentioned, I also executed the "svn" command. Then, as mentioned in install python google cloud storage client on Ubuntu 14.04, I ran "cd gcs-client/src" and "sudo python setup.py install". I ran these commands in my user root directory.
After each of those successful but different installations of the GCS Client Library, I looked at the PyCharm editor window for my module, and it always had the same "No module named cloudstorage" error. But as an experiment, I would also try restarting PyCharm, and also try running my app.
At some point, the editor window stopped showing the error. It was not immediately after one of those steps above, but after I would go away to read various webpages and then come back to look at the error again. I don't know which of the installations was the one that got rid of the error message in the PyCharm editor.
In any case, whenever I try to run the app (again, inside PyCharm), I always get the runtime error "ImportError: No module named cloudstorage" on the same import statement.
The Run/Debug Configuration page for this app has both "Add content roots to PYTHONPATH" and "Add source roots to PYTHONPATH" checked.
Of course the main help I want is how to get past the "No module named cloudstorage" runtime error, even though the import statement no longer shows an error.
I think I also have as many as three spurious versions of the GCS Client Library. I'm much more concerned with getting past "Module not found", since it's a show-stopper, but if you have any idea how I can delete the spurious versions so that they're not just lying around, I'd be most grateful for that help as well.
If the "cloudstorage" directory is at <app>/lib/cloudstorage, then the import statement has to specify "lib":
import lib.cloudstorage
In my case, it's:
import lib.cloudstorage as gcs
By the way, the <app>/lib/GoogleAppEngineCloudStorageClient-1.9.5.0-py2.7.egg-info directory does not seem to be needed and can be deleted.
Actually, you also need to
touch __init__.py
in the lib directory. This will make the cloudstorage module visible to the "import lib.cloudstorage" command.
Dear Google: The distributions should include this file (or the procedure should account for it), and the demo script should be changed to reflect the expected usage. But more importantly why are you distributing/PROLIFERATING library code like this??!!! Why is this not distributed via gcloud? How am I ever going to pick up a patch for this library?
The accepted answer's solution
import lib.module_name
definitely can solve the problem. But I don't like add lib in front of every single module and happened to see how Google suggest import third party libs like this.
appengine will automatically run a file called appengine_config.py. So you can create such a file and put
from google.appengine.ext import vendor
vendor.add('lib')
inside that file. This will help you tell appengine to find dependencies in that folder, so you can simply write
import cloudstorage as gcs
I solve the missing module issue by adding the following to my main application file (main.py):
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), "lib"))
I think this is the way Guido intended. Now my code simply says import cloudstorage as gcs. None of the lib.cloudstorage or lib/__init__.py business.
From
https://stackoverflow.com/a/37645984/1740008

PyDev PDFMiner GAE: ImportError: No module named pdfminer.converter

I work on GAE project in PyDev
I'd like to use the PDFminer library in order to convert a pdf file to a text file.
My problem is when i run the application it dosn't work and it displays this error message :
ImportError: No module named pdfminer.converter
I tested the same code in a normale python project and it works fine.
I used the same code in python console and it works too
I add the pdfminer folder to the python interpreter, i removed the interpreter and i add it again but i have always the same error.
Really i don't what i have to do, can anybody help me please ?
The problem comes from the fact that the PDFMiner is a third party library i copied the PDFMiner's files into the project and i works fine GAE don't import lib if isn't a pure python even if it exits in PYTHONPATH I found the solution in this post: Google App Engine "no module named requests" PyDev

Oauth error no such method

I don't know why, but when I launch my application I suddenly always receive the following error (that before never appeared):
java.lang.NoSuchMethodError: com.google.gdata.client.authn.oauth.GoogleOAuthParameters.setOAuthType(Lcom/google/gdata/client/authn/oauth/OAuthParameters$OAuthType;)
The line of code generating the error is:
oauthParameters.setOAuthType(OAuthParameters.OAuthType.TWO_LEGGED_OAUTH);
That error wasn't appeared before, always in eclipse there wasn't an error and all was working fine.
I've never changed library. It seems that when I deploy to app-engine it doesn't upload the jar with that class?
Since you're only seeing this issue when you deploy, it sounds like you've included the gdata-java-client jars in a location so that they are visible to your local Java runtime, but are not sent to the App Engine server upon deployment.
The easiest way to resolve this is to include the gdata-java-client and its dependencies in the war/WEB-INF/lib directory of your application, and to reference those jars in your Java build path within Eclipse.

Unable to deploy a Roo/GWT application on Google AppEngine from Springsource Tool Suite

I followed this excellent tutorial but, as it doensn't cover the deployment part, I tried to do it by myself.
So, I installed Springsource Tool Suite in Ubuntu.
Then, I create a "demo1" Roo project.
Next, with the built-in Roo Shell, I taped the following commands:
persistence setup --provider DATANUCLEUS --database HYPERSONIC_IN_MEMORY
entity --class ~.server.domain.Employee
field string --fieldName firstName --sizeMin 3 --sizeMax 20
field string --fieldName lastName --sizeMin 3 --sizeMax 20
gwt setup
After I checked "Use Google Webkit" in "Webkit Options", the project ran perfectly!
Then, to deploy the application to the App Engine, I taped the following command:
persistence setup –database GOOGLE_APP_ENGINE –provider DATANUCLEUS
which runs without any problem.
Then, i setup the AppEngine options (Application name and version ...) and clicked on the "Deploy App Engine Project" icon.
A popup shows and asks for the project name, email and password.
I gave all these information and clicked on "Deploy".
Unhopefully, an error occured and a popup showed with the following error message:
GWT compilation failed
And in the console, I got the following error:
Compiling module com.springsource.demo1.gwt.ApplicationCommon
[ERROR] Module has no entry points defined
I think that the problem is that GWT can't find the war file ...
Anyone succeded in deploying a GWT/Roo application by clicking on the "Deploy" icon?
Thank you very much,
Regards.
What you need to do is go to the Google -> Webtool Kit Settings... and remove ApplicationCommon from the Entry Point Modules list, and you probably need to remove some more, so only the configuration file with the Entry point remains.
Some background: The error is generated by the GWT compiler. When deploying GWT compiles the Java source to JavaScript. GWT uses module files with the extension: .gwt.xml which contain configuration information for the compiler. In at least one of these configuration files an entry point must be specified. By default the Webtool Kit Settings contain all those gwt.xml files from your project (there are probably 4), while only those with an entry point should be specified.
What version of STS were you using? I think this may be fixed with STS 2.3.3.M2...

Resources