Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

خطاهای حین اجرا #230

Open
mjdehghan opened this issue Oct 16, 2023 · 2 comments
Open

خطاهای حین اجرا #230

mjdehghan opened this issue Oct 16, 2023 · 2 comments

Comments

@mjdehghan
Copy link

mjdehghan commented Oct 16, 2023

چرا برخی موارد خطاهایی همچون خطاهای زیر ظاهر میشوددر صورتیکه برخی موارد همین کدها برای دقیقا همان نام نمادهای مشخص با چند بار تکرار اجرا در فاصله زمانی چند ثانیه تکرار مجدد اجرا دون هیچگونه تغییر در کدنتیجه به درستی و بدون خطا حاصل میشود
با جرای کد زیر
ticker = tse.Ticker(symbolname)
و دسترسی به اطلاعات
برخی موارد با خطاهای زیر مواجه می شوم

انواع خطاهایی که هر بار ممکن با یکی از موارد مواجه شویم را در اینحا آوردم
سپاس

ticker = tse.Ticker(symbolname)
print(ticker.market_cap)
Error 1:
Traceback (most recent call last):
File "/Python/Python310/test_test.py", line 151, in
print(ticker.market_cap)
File "\Python\Python310\lib\site-packages\pytse_client\ticker\ticker.py", line 606, in market_cap
return self.get_ticker_real_time_info_response().market_cap
File "\Python\Python310\lib\site-packages\pytse_client\ticker\ticker.py", line 692, in get_ticker_real_time_info_response
buy_orders, sell_orders = get_orders(orders_section)
File "\Python\Python310\lib\site-packages\pytse_client\ticker\api_extractors.py", line 31, in get_orders
buy_count = int(order_numbers[0])
ValueError: invalid literal for int() with base 10: "} gtag('js'"

ticker = tse.Ticker(symbolname)
print(ticker.title)

Error 2:

Traceback (most recent call last):
File "/Python/Python310/test_test.py", line 96, in
print(ticker.title)
File "\Python\Python310\lib\site-packages\pytse_client\ticker\ticker.py", line 186, in title
re.findall(r"Title='(.*?)',", self._ticker_page_response.text)[
IndexError: list index out of range

ticker = tse.Ticker(symbolname)
df=ticker.client_types

Error 3:

Traceback (most recent call last):
File "\Python310\lib\site-packages\pandas\core\internals\construction.py", line 982, in _finalize_columns_and_data
columns = _validate_or_indexify_columns(contents, columns)
File "\Python310\lib\site-packages\pandas\core\internals\construction.py", line 1030, in _validate_or_indexify_columns
raise AssertionError(
AssertionError: 13 columns passed, passed data had 7 columns

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/Python/Python310/test_test.py", line 70, in
df=ticker.client_types
File "\Python310\lib\site-packages\pytse_client\ticker\ticker.py", line 386, in client_types
client_types = download_ticker_client_types_record(self.index)
File "\Python310\lib\site-packages\tenacity_init
.py", line 339, in wrapped_f
return self(f, *args, **kw)
File "\Python310\lib\site-packages\tenacity_init_.py", line 430, in call
do = self.iter(retry_state=retry_state)
File "\Python310\lib\site-packages\tenacity_init_.py", line 367, in iter
return fut.result()
File "\Python310\lib\concurrent\futures_base.py", line 439, in result
return self.__get_result()
File "\Python310\lib\concurrent\futures_base.py", line 391, in __get_result
raise self.exception
File "\Python310\lib\site-packages\tenacity_init
.py", line 433, in call
result = fn(*args, **kwargs)
File "\Python310\lib\site-packages\pytse_client\download.py", line 399, in download_ticker_client_types_record
client_types_data_frame = pd.DataFrame(
File "\Python310\lib\site-packages\pandas\core\frame.py", line 721, in init
arrays, columns, index = nested_data_to_arrays(
File "\Python310\lib\site-packages\pandas\core\internals\construction.py", line 519, in nested_data_to_arrays
arrays, columns = to_arrays(data, columns, dtype=dtype)
File "\Python310\lib\site-packages\pandas\core\internals\construction.py", line 883, in to_arrays
content, columns = _finalize_columns_and_data(arr, columns, dtype)
File "\Python310\lib\site-packages\pandas\core\internals\construction.py", line 985, in _finalize_columns_and_data
raise ValueError(err) from err
ValueError: 13 columns passed, passed data had 7 columns

پ

ticker = tse.Ticker(symbolname)

Error 4

Traceback (most recent call last):
File "/Python/Python310/test_test.py", line 52, in
ticker = tse.Ticker(symbolname)
File "\Python\Python310\lib\site-packages\pytse_client\ticker\ticker.py", line 127, in init
self._history = download(
File "\Python\Python310\lib\site-packages\pytse_client\download.py", line 114, in download
df = df.drop(columns=["", ""])
File "\Python\Python310\lib\site-packages\pandas\util_decorators.py", line 311, in wrapper
return func(*args, **kwargs)
File "\Python\Python310\lib\site-packages\pandas\core\frame.py", line 4948, in drop
return super().drop(
File "\Python\Python310\lib\site-packages\pandas\core\generic.py", line 4279, in drop
obj = obj._drop_axis(labels, axis, level=level, errors=errors)
File "\Python\Python310\lib\site-packages\pandas\core\generic.py", line 4323, in _drop_axis
new_axis = axis.drop(labels, errors=errors)
File "\Python\Python310\lib\site-packages\pandas\core\indexes\base.py", line 6644, in drop
raise KeyError(f"{list(labels[mask])} not found in axis")
KeyError: "['', ''] not found in axis"

@Glyphack
Copy link
Owner

ممنونم بابت گزارش، اینارو باید هرکدوم رو دونه دونه چک کنیم ببینیم چطوری پیش اومده. اگر مشکل این باشه که سایت یکی در میون جواب میده یا نمیده فکر کنم کاریش نمیشه کرد.
ممکنه این مشکلا با تغییر آدرس و استفاده از سایت جدید هم حل بشه. بنظرم بهتره اول اون رو انجام بدیم بعد این مشکلارو چک کنیم.

@sadrabadi10
Copy link

سلام عرض می کنم
کد ایمپورت کتابخانه pytse_client برنامه پایتون رو می بنده ارور میده
در ضمن من این کتابخانه را در cmd نصب کردم

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants