Google Cloud Python on raspbian












0















I want to use my rasbperrypi : take a photo and send the photo to firebase storage.



from google.cloud import storage
camera = PiCamera()
client = storage.Client()
bucket = client.get_bucket('gs://plante.appspot.com')


camera.start_preview()
sleep(5)
camera.capture('/home/pi/Desktop/culture/image.jpg')
camera.stop_preview()
sleep(5)

cultureBlob = bucket.get_blob('culture.jpg')
cultureBlob.upload_from_filename(filename='/home/pi/Desktop/culture/image.jpg')


But i have this error :



pi@raspberrypi:~ $ python test.py
Traceback (most recent call last):
File "test.py", line 31, in <module>
client = storage.Client()
File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/storage/client.py", line 71, in __init__
_http=_http)
File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/client.py", line 215, in __init__
_ClientProjectMixin.__init__(self, project=project)
File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/client.py", line 169, in __init__
project = self._determine_default(project)
File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/client.py", line 182, in _determine_default
return _determine_default_project(project)
File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/_helpers.py", line 179, in _determine_default_project
_, project = google.auth.default()
File "/home/pi/.local/lib/python2.7/site-packages/google/auth/_default.py", line 306, in default
raise exceptions.DefaultCredentialsError(_HELP_MESSAGE)
google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please see https://cloud.google.com/docs/authentication/getting-started


however, I have installed google cloud services /



> sudo pip install google-cloud-storage



pi@raspberrypi:~ $ gcloud version




Google Cloud SDK 225.0.0
alpha 2018.11.09
beta 2018.11.09
bq 2.0.37
core 2018.11.09
gsutil 4.34
kubectl 2018.11.09



pi@raspberrypi:~ $ pip show google-cloud-storage



Name: google-cloud-storage
Version: 1.13.0
Summary: Google Cloud Storage API client library
Home-page: https://github.com/GoogleCloudPlatform/google-cloud-python
Author: Google LLC
Author-email: googleapis-packages@google.com
License: Apache 2.0
Location: /home/pi/.local/lib/python2.7/site-packages
Requires: google


-api-core, google-cloud-core, google-resumable-media










share|improve this question

























  • you want to see that ?

    – al NTM
    Nov 24 '18 at 20:21











  • how i can obtain this ?

    – al NTM
    Nov 24 '18 at 20:43











  • sorry i don't understanrd. Howi must do i must execut a new script ?

    – al NTM
    Nov 24 '18 at 22:01











  • i all reinstall rasbian.. now i have this error..I can't connect to firebase storage directly ?

    – al NTM
    Nov 25 '18 at 11:14











  • Read and follow authentication/getting-started

    – stovfl
    Nov 25 '18 at 11:59
















0















I want to use my rasbperrypi : take a photo and send the photo to firebase storage.



from google.cloud import storage
camera = PiCamera()
client = storage.Client()
bucket = client.get_bucket('gs://plante.appspot.com')


camera.start_preview()
sleep(5)
camera.capture('/home/pi/Desktop/culture/image.jpg')
camera.stop_preview()
sleep(5)

cultureBlob = bucket.get_blob('culture.jpg')
cultureBlob.upload_from_filename(filename='/home/pi/Desktop/culture/image.jpg')


But i have this error :



pi@raspberrypi:~ $ python test.py
Traceback (most recent call last):
File "test.py", line 31, in <module>
client = storage.Client()
File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/storage/client.py", line 71, in __init__
_http=_http)
File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/client.py", line 215, in __init__
_ClientProjectMixin.__init__(self, project=project)
File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/client.py", line 169, in __init__
project = self._determine_default(project)
File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/client.py", line 182, in _determine_default
return _determine_default_project(project)
File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/_helpers.py", line 179, in _determine_default_project
_, project = google.auth.default()
File "/home/pi/.local/lib/python2.7/site-packages/google/auth/_default.py", line 306, in default
raise exceptions.DefaultCredentialsError(_HELP_MESSAGE)
google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please see https://cloud.google.com/docs/authentication/getting-started


however, I have installed google cloud services /



> sudo pip install google-cloud-storage



pi@raspberrypi:~ $ gcloud version




Google Cloud SDK 225.0.0
alpha 2018.11.09
beta 2018.11.09
bq 2.0.37
core 2018.11.09
gsutil 4.34
kubectl 2018.11.09



pi@raspberrypi:~ $ pip show google-cloud-storage



Name: google-cloud-storage
Version: 1.13.0
Summary: Google Cloud Storage API client library
Home-page: https://github.com/GoogleCloudPlatform/google-cloud-python
Author: Google LLC
Author-email: googleapis-packages@google.com
License: Apache 2.0
Location: /home/pi/.local/lib/python2.7/site-packages
Requires: google


-api-core, google-cloud-core, google-resumable-media










share|improve this question

























  • you want to see that ?

    – al NTM
    Nov 24 '18 at 20:21











  • how i can obtain this ?

    – al NTM
    Nov 24 '18 at 20:43











  • sorry i don't understanrd. Howi must do i must execut a new script ?

    – al NTM
    Nov 24 '18 at 22:01











  • i all reinstall rasbian.. now i have this error..I can't connect to firebase storage directly ?

    – al NTM
    Nov 25 '18 at 11:14











  • Read and follow authentication/getting-started

    – stovfl
    Nov 25 '18 at 11:59














0












0








0








I want to use my rasbperrypi : take a photo and send the photo to firebase storage.



from google.cloud import storage
camera = PiCamera()
client = storage.Client()
bucket = client.get_bucket('gs://plante.appspot.com')


camera.start_preview()
sleep(5)
camera.capture('/home/pi/Desktop/culture/image.jpg')
camera.stop_preview()
sleep(5)

cultureBlob = bucket.get_blob('culture.jpg')
cultureBlob.upload_from_filename(filename='/home/pi/Desktop/culture/image.jpg')


But i have this error :



pi@raspberrypi:~ $ python test.py
Traceback (most recent call last):
File "test.py", line 31, in <module>
client = storage.Client()
File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/storage/client.py", line 71, in __init__
_http=_http)
File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/client.py", line 215, in __init__
_ClientProjectMixin.__init__(self, project=project)
File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/client.py", line 169, in __init__
project = self._determine_default(project)
File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/client.py", line 182, in _determine_default
return _determine_default_project(project)
File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/_helpers.py", line 179, in _determine_default_project
_, project = google.auth.default()
File "/home/pi/.local/lib/python2.7/site-packages/google/auth/_default.py", line 306, in default
raise exceptions.DefaultCredentialsError(_HELP_MESSAGE)
google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please see https://cloud.google.com/docs/authentication/getting-started


however, I have installed google cloud services /



> sudo pip install google-cloud-storage



pi@raspberrypi:~ $ gcloud version




Google Cloud SDK 225.0.0
alpha 2018.11.09
beta 2018.11.09
bq 2.0.37
core 2018.11.09
gsutil 4.34
kubectl 2018.11.09



pi@raspberrypi:~ $ pip show google-cloud-storage



Name: google-cloud-storage
Version: 1.13.0
Summary: Google Cloud Storage API client library
Home-page: https://github.com/GoogleCloudPlatform/google-cloud-python
Author: Google LLC
Author-email: googleapis-packages@google.com
License: Apache 2.0
Location: /home/pi/.local/lib/python2.7/site-packages
Requires: google


-api-core, google-cloud-core, google-resumable-media










share|improve this question
















I want to use my rasbperrypi : take a photo and send the photo to firebase storage.



from google.cloud import storage
camera = PiCamera()
client = storage.Client()
bucket = client.get_bucket('gs://plante.appspot.com')


camera.start_preview()
sleep(5)
camera.capture('/home/pi/Desktop/culture/image.jpg')
camera.stop_preview()
sleep(5)

cultureBlob = bucket.get_blob('culture.jpg')
cultureBlob.upload_from_filename(filename='/home/pi/Desktop/culture/image.jpg')


But i have this error :



pi@raspberrypi:~ $ python test.py
Traceback (most recent call last):
File "test.py", line 31, in <module>
client = storage.Client()
File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/storage/client.py", line 71, in __init__
_http=_http)
File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/client.py", line 215, in __init__
_ClientProjectMixin.__init__(self, project=project)
File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/client.py", line 169, in __init__
project = self._determine_default(project)
File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/client.py", line 182, in _determine_default
return _determine_default_project(project)
File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/_helpers.py", line 179, in _determine_default_project
_, project = google.auth.default()
File "/home/pi/.local/lib/python2.7/site-packages/google/auth/_default.py", line 306, in default
raise exceptions.DefaultCredentialsError(_HELP_MESSAGE)
google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please see https://cloud.google.com/docs/authentication/getting-started


however, I have installed google cloud services /



> sudo pip install google-cloud-storage



pi@raspberrypi:~ $ gcloud version




Google Cloud SDK 225.0.0
alpha 2018.11.09
beta 2018.11.09
bq 2.0.37
core 2018.11.09
gsutil 4.34
kubectl 2018.11.09



pi@raspberrypi:~ $ pip show google-cloud-storage



Name: google-cloud-storage
Version: 1.13.0
Summary: Google Cloud Storage API client library
Home-page: https://github.com/GoogleCloudPlatform/google-cloud-python
Author: Google LLC
Author-email: googleapis-packages@google.com
License: Apache 2.0
Location: /home/pi/.local/lib/python2.7/site-packages
Requires: google


-api-core, google-cloud-core, google-resumable-media







python firebase google-cloud-storage raspbian






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 11:06







al NTM

















asked Nov 24 '18 at 19:02









al NTMal NTM

878




878













  • you want to see that ?

    – al NTM
    Nov 24 '18 at 20:21











  • how i can obtain this ?

    – al NTM
    Nov 24 '18 at 20:43











  • sorry i don't understanrd. Howi must do i must execut a new script ?

    – al NTM
    Nov 24 '18 at 22:01











  • i all reinstall rasbian.. now i have this error..I can't connect to firebase storage directly ?

    – al NTM
    Nov 25 '18 at 11:14











  • Read and follow authentication/getting-started

    – stovfl
    Nov 25 '18 at 11:59



















  • you want to see that ?

    – al NTM
    Nov 24 '18 at 20:21











  • how i can obtain this ?

    – al NTM
    Nov 24 '18 at 20:43











  • sorry i don't understanrd. Howi must do i must execut a new script ?

    – al NTM
    Nov 24 '18 at 22:01











  • i all reinstall rasbian.. now i have this error..I can't connect to firebase storage directly ?

    – al NTM
    Nov 25 '18 at 11:14











  • Read and follow authentication/getting-started

    – stovfl
    Nov 25 '18 at 11:59

















you want to see that ?

– al NTM
Nov 24 '18 at 20:21





you want to see that ?

– al NTM
Nov 24 '18 at 20:21













how i can obtain this ?

– al NTM
Nov 24 '18 at 20:43





how i can obtain this ?

– al NTM
Nov 24 '18 at 20:43













sorry i don't understanrd. Howi must do i must execut a new script ?

– al NTM
Nov 24 '18 at 22:01





sorry i don't understanrd. Howi must do i must execut a new script ?

– al NTM
Nov 24 '18 at 22:01













i all reinstall rasbian.. now i have this error..I can't connect to firebase storage directly ?

– al NTM
Nov 25 '18 at 11:14





i all reinstall rasbian.. now i have this error..I can't connect to firebase storage directly ?

– al NTM
Nov 25 '18 at 11:14













Read and follow authentication/getting-started

– stovfl
Nov 25 '18 at 11:59





Read and follow authentication/getting-started

– stovfl
Nov 25 '18 at 11:59












1 Answer
1






active

oldest

votes


















4














The google.cloud system requires some credentials. This can be either a system account or OAuth. The simplest solution is to create a file containing your account credentials (A JSON blob) and set the environment variable GOOGLE_APPLICATION_CREDENTIALS to contain the path to that file. Then run your software.



Open the Google Cloud Console using your account and find where your account credentials are defined. I dont actually know where that is..






share|improve this answer
























  • we must pay to use google cloud ?

    – al NTM
    Nov 25 '18 at 12:37











  • @alNTM You don't have to pay if you only use firebase and Cloud Storage as a hobby, you can store 5GB for free. here you have more info: firebase.google.com/pricing

    – Alex Riquelme
    Nov 26 '18 at 11:58











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53461447%2fgoogle-cloud-python-on-raspbian%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









4














The google.cloud system requires some credentials. This can be either a system account or OAuth. The simplest solution is to create a file containing your account credentials (A JSON blob) and set the environment variable GOOGLE_APPLICATION_CREDENTIALS to contain the path to that file. Then run your software.



Open the Google Cloud Console using your account and find where your account credentials are defined. I dont actually know where that is..






share|improve this answer
























  • we must pay to use google cloud ?

    – al NTM
    Nov 25 '18 at 12:37











  • @alNTM You don't have to pay if you only use firebase and Cloud Storage as a hobby, you can store 5GB for free. here you have more info: firebase.google.com/pricing

    – Alex Riquelme
    Nov 26 '18 at 11:58
















4














The google.cloud system requires some credentials. This can be either a system account or OAuth. The simplest solution is to create a file containing your account credentials (A JSON blob) and set the environment variable GOOGLE_APPLICATION_CREDENTIALS to contain the path to that file. Then run your software.



Open the Google Cloud Console using your account and find where your account credentials are defined. I dont actually know where that is..






share|improve this answer
























  • we must pay to use google cloud ?

    – al NTM
    Nov 25 '18 at 12:37











  • @alNTM You don't have to pay if you only use firebase and Cloud Storage as a hobby, you can store 5GB for free. here you have more info: firebase.google.com/pricing

    – Alex Riquelme
    Nov 26 '18 at 11:58














4












4








4







The google.cloud system requires some credentials. This can be either a system account or OAuth. The simplest solution is to create a file containing your account credentials (A JSON blob) and set the environment variable GOOGLE_APPLICATION_CREDENTIALS to contain the path to that file. Then run your software.



Open the Google Cloud Console using your account and find where your account credentials are defined. I dont actually know where that is..






share|improve this answer













The google.cloud system requires some credentials. This can be either a system account or OAuth. The simplest solution is to create a file containing your account credentials (A JSON blob) and set the environment variable GOOGLE_APPLICATION_CREDENTIALS to contain the path to that file. Then run your software.



Open the Google Cloud Console using your account and find where your account credentials are defined. I dont actually know where that is..







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 25 '18 at 11:22









Major EcclesMajor Eccles

34116




34116













  • we must pay to use google cloud ?

    – al NTM
    Nov 25 '18 at 12:37











  • @alNTM You don't have to pay if you only use firebase and Cloud Storage as a hobby, you can store 5GB for free. here you have more info: firebase.google.com/pricing

    – Alex Riquelme
    Nov 26 '18 at 11:58



















  • we must pay to use google cloud ?

    – al NTM
    Nov 25 '18 at 12:37











  • @alNTM You don't have to pay if you only use firebase and Cloud Storage as a hobby, you can store 5GB for free. here you have more info: firebase.google.com/pricing

    – Alex Riquelme
    Nov 26 '18 at 11:58

















we must pay to use google cloud ?

– al NTM
Nov 25 '18 at 12:37





we must pay to use google cloud ?

– al NTM
Nov 25 '18 at 12:37













@alNTM You don't have to pay if you only use firebase and Cloud Storage as a hobby, you can store 5GB for free. here you have more info: firebase.google.com/pricing

– Alex Riquelme
Nov 26 '18 at 11:58





@alNTM You don't have to pay if you only use firebase and Cloud Storage as a hobby, you can store 5GB for free. here you have more info: firebase.google.com/pricing

– Alex Riquelme
Nov 26 '18 at 11:58




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53461447%2fgoogle-cloud-python-on-raspbian%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

To store a contact into the json file from server.js file using a class in NodeJS

Redirect URL with Chrome Remote Debugging Android Devices

Dieringhausen