Comments (13)
the error desc:[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:2621)
from generative-ai-python.
If I run it once, there is no problem, as follows:
for file in os.listdir(f"{output_frame_folder}"): path = os.path.join(f"{output_frame_folder}", file) sample_file = genai.upload_file(path=path,display_name=file)
But if my interface receives two requests at the same time, this code may be called twice in the same time period. In this case, an error will be reported as follows:
httplib2.Http() error:[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:2621)
pit:’output_frame_folder ‘ It is a folder that contains some pictures and an MP3
from generative-ai-python.
Does this mean that this method does not support concurrency?
from generative-ai-python.
@jiupinjiandingshi, I tried running Prompting with media files tutorial and genai.upload_file
works without any issues. Can you please share a colab gist or code which we can try to reproduce on our end. Thank you!
from generative-ai-python.
try to run pip install google-generativeai --upgrade
that solved it for me!
i was using google-generativeai-0.3.2
but now its google-ai-generativelanguage-0.6.4
from generative-ai-python.
Thanks, please reopen this if the problem comes back in a reproducible way.
from generative-ai-python.
i tried upgrading the library as suggested by @sMx7d . But still getting errors
File "/code/vision_models.py", line 228, in media2concept
video-backend | messages = [
video-backend | ^
video-backend | File "/code/vision_models.py", line 231, in <listcomp>
video-backend | "parts": await asyncio.create_task(make_video_prompt(media))
video-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
video-backend | File "/code/vision_models.py", line 154, in make_video_prompt
video-backend | framefiles = await upload_frames_concurrently(framefiles)
video-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
video-backend | File "/code/vision_models.py", line 136, in upload_frames_concurrently
video-backend | uploaded_frames = await asyncio.gather(*tasks)
video-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
video-backend | File "/code/vision_models.py", line 127, in aupload_frame
video-backend | res = await asyncio.to_thread(genai.upload_file, ff.file_path, name=ff.name)
video-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/asyncio/threads.py", line 25, in to_thread
video-backend | return await loop.run_in_executor(None, func_call)
video-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
video-backend | result = self.fn(*self.args, **self.kwargs)
video-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/site-packages/google/generativeai/files.py", line 69, in upload_file
video-backend | response = client.create_file(
video-backend | ^^^^^^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/site-packages/google/generativeai/client.py", line 79, in create_file
video-backend | return self.get_file({"name": result["file"]["name"]})
video-backend | ~~~~~~^^^^^^^^
video-backend | TypeError: string indices must be integers, not 'str'
anyone else finding the same issue?
from generative-ai-python.
@ronfromhp , uninstall and reinstall it.
from generative-ai-python.
@sMx7d somehow its gone back to giving the ssl error
these are the installed libraries:
google-ai-generativelanguage==0.6.4
google-api-core==2.19.0
google-api-python-client==2.130.0
google-auth==2.29.0
google-auth-httplib2==0.2.0
google-generativeai==0.5.4
googleapis-common-protos==1.63.0
grpcio==1.64.0
grpcio-status==1.62.2
h11==0.14.0
httpcore==1.0.5
httplib2==0.22.0
httpx==0.27.0
This is the same old error trace im getting:
video-backend | uploaded_frames = await asyncio.gather(*tasks)
video-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
video-backend | File "/code/vision_models.py", line 127, in aupload_frame
video-backend | res = await asyncio.to_thread(genai.upload_file, ff.file_path, name=ff.name)
video-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/asyncio/threads.py", line 25, in to_thread
video-backend | return await loop.run_in_executor(None, func_call)
video-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
video-backend | result = self.fn(*self.args, **self.kwargs)
video-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/site-packages/google/generativeai/files.py", line 69, in upload_file
video-backend | response = client.create_file(
video-backend | ^^^^^^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/site-packages/google/generativeai/client.py", line 77, in create_file
video-backend | result = request.execute()
video-backend | ^^^^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
video-backend | return wrapped(*args, **kwargs)
video-backend | ^^^^^^^^^^^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/site-packages/googleapiclient/http.py", line 902, in execute
video-backend | _, body = self.next_chunk(http=http, num_retries=num_retries)
video-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
video-backend | return wrapped(*args, **kwargs)
video-backend | ^^^^^^^^^^^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/site-packages/googleapiclient/http.py", line 1007, in next_chunk
video-backend | resp, content = _retry_request(
video-backend | ^^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/site-packages/googleapiclient/http.py", line 222, in _retry_request
video-backend | raise exception
video-backend | File "/usr/local/lib/python3.11/site-packages/googleapiclient/http.py", line 191, in _retry_request
video-backend | resp, content = http.request(uri, method, *args, **kwargs)
video-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/site-packages/httplib2/__init__.py", line 1724, in request
video-backend | (response, content) = self._request(
video-backend | ^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/site-packages/httplib2/__init__.py", line 1444, in _request
video-backend | (response, content) = self._conn_request(conn, request_uri, method, body, headers)
video-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/site-packages/httplib2/__init__.py", line 1396, in _conn_request
video-backend | response = conn.getresponse()
video-backend | ^^^^^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/http/client.py", line 1395, in getresponse
video-backend | response.begin()
video-backend | File "/usr/local/lib/python3.11/http/client.py", line 325, in begin
video-backend | version, status, reason = self._read_status()
video-backend | ^^^^^^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/http/client.py", line 286, in _read_status
video-backend | line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
video-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/socket.py", line 706, in readinto
video-backend | return self._sock.recv_into(b)
video-backend | ^^^^^^^^^^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/ssl.py", line 1314, in recv_into
video-backend | return self.read(nbytes, buffer)
video-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^
video-backend | File "/usr/local/lib/python3.11/ssl.py", line 1166, in read
video-backend | return self._sslobj.read(len, buffer)
video-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
video-backend | ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:2580)
from generative-ai-python.
Its stil a ssl error , sorry but i don't know anything in ssl or what it means .
But it seems that genertiveai version is 0.5.4 , IDK if it has upload file function or not , but either way, i don't think upgrading the library will solve as its a ssl error and not related to library functions.
I hope my response was clear, if you needed anything just mention me.
@ronfromhp
from generative-ai-python.
@jiupinjiandingshi can you reopen the issue? As currently I havent found a resolution which works
from generative-ai-python.
video-backend | TypeError: string indices must be integers, not 'str'
sorry , i just reviewed the error and i saw video-backend | TypeError: string indices must be integers, not 'str'
that error is likely not from the generative-ai
library , its from your code but IDK what the solve for it.
from generative-ai-python.
as of my previous comment i was still getting the same ssl error even after updating genai @sMx7d
from generative-ai-python.
Related Issues (20)
- TypeError: no default __reduce__ due to non-trivial __cinit__
- "Method doesn't allow unregistered callers (callers without established identity). Please use API Key or other form of API consumer identity to call this API." HOT 3
- pk_live_51PaFh3RtyvZJKkUox0DUnINS5ghNbwW8n7pLTQmvwjGpSrUoByY4nlp90lOXcwFeWU5OdT4y8DrCLbbXyFuFREGm00UWEaO5Nghttps://www.donations.stripe.com/checkout/www.donate.stripe/CashAppPay.$Ag42024 HOT 1
- [email protected] HOT 1
- Inconsistency in how model name is supplied in the library. HOT 2
- 500 Internal Server Error when using gemini-1.5-pro model HOT 9
- Error when attempting to use Gemini 1.5 Pro: google.api_core.exceptions.InternalServerError: 500 An internal error has occurred HOT 4
- {www.donate.stripe.com/cash.app/$Ag42024 "custom_attribute_definition": { "key": "charity", "name": "Charitable Organization", "description": "Is this merchant a charitable organization with 501(c)(3) status?", "version": 1, "updated_at": "2023-01-20T02:41:37Z", "schema": { "$ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.Boolean" }, "created_at": "2023-01-20T02:41:37Z", "visibility": "VISIBILITY_READ_WRITE_VALUES" } }
- g.dev/AustinRay-4031630597026839 content_copy HOT 1
- https://aistudio.google.com/app/prompts?state=%7B%22ids%22:%5B%2214WQzOLiiz0dFKiVGQ2y3WQifZSdjW4ww%22%5D,%22action%22:%22open%22,%22userId%22:%22109116126150763630254%22,%22resourceKeys%22:%7B%7D%7D HOT 1
- Ag22 HOT 1
- Ag22
- Benefit to TrusteeType Benefit
- json mode outputs extra brackets or doesn't include HOT 9
- Get finish_reason: 6 without reason and content reply HOT 2
- Ag2279122/Workday www.githubstatus.com/?subscription_confirmed=Trustee HOT 2
- www.google.com/finance/portfolio/1f3be294-4e5a-496e-8453-9ca892029401?window=1 HOT 1
- 7314874656 HOT 2
- google.api_core.exceptions.InvalidArgument: 400 API key not valid. Please pass a valid API key. [reason: "API_KEY_INVALID" domain: "googleapis.com" metadata { key: "service" value: "generativelanguage.googleapis.com" } ] HOT 2
- Context Cache and updating Gemini Code Assist HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from generative-ai-python.