Google Cloud Python on raspbian
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
|
show 1 more comment
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
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
|
show 1 more comment
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
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
python firebase google-cloud-storage raspbian
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
|
show 1 more comment
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
|
show 1 more comment
1 Answer
1
active
oldest
votes
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..
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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..
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
add a comment |
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..
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
add a comment |
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..
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..
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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