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

Error message, cannot get it up and running?? #12

Closed
HHawk opened this issue Dec 3, 2021 · 11 comments
Closed

Error message, cannot get it up and running?? #12

HHawk opened this issue Dec 3, 2021 · 11 comments

Comments

@HHawk
Copy link

HHawk commented Dec 3, 2021

Hi ZainAchak!

(posted it first in a closed thread, my bad)

Well I fixed several issues I was experiencing, however I cannot get past this error:

Traceback (most recent call last):
  File "C:\pancakeswapbot\abi.py", line 17, in tokenAbi
    with open(f"data/{filename}") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'data/ABI_0x679D5b2d94f454c950d683D159b87aa8eae37C9e.txt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\pancakeswapbot\DeFiTranscation.py", line 291, in <module>
    runCode()
  File "C:\pancakeswapbot\DeFiTranscation.py", line 133, in runCode
    BNB_balance, TokenSymbol, NoOfTokens, params = InitializeTrade()
  File "C:\pancakeswapbot\DeFiTranscation.py", line 66, in InitializeTrade
    sellTokenAbi = tokenAbi(TokenToSellAddress, driver)
  File "C:\pancakeswapbot\abi.py", line 21, in tokenAbi
    abi = findAbi(address, driver)
  File "C:\pancakeswapbot\abi.py", line 41, in findAbi
    driver.get("chrome://settings/clearBrowserData");
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 333, in get
    self.execute(Command.GET, {'url': url})
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: Malformed URL: URL constructor: chrome://settings/clearBrowserData is not a valid URL.

Also this line is weird: FileNotFoundError: [Errno 2] No such file or directory: 'data/ABI_0x679D5b2d94f454c950d683D159b87aa8eae37C9e.txt'

The file is in there! So no clue why he cannot find it. The script even created it!
Though it only has empty variables in it...

Any idea perhaps? Thanks.

@HHawk
Copy link
Author

HHawk commented Dec 9, 2021

ZainAchak? Are you still with us??

@ZainAchak
Copy link
Owner

ABI is taken from BSCScan, First, try to find if the token does exist on the Bscscan website, If yes then try to search if the chart for that token is available on PooCoin or Arken website. If these both exist then share the address with me, I'll try to figure it out. :))

@HHawk
Copy link
Author

HHawk commented Dec 11, 2021

Hi ZainAchak!

Thanks for taking the time to answer and sorry for being impatient.

The Hamster (HAM) coin is available on both:

https://bscscan.com/token/0x679d5b2d94f454c950d683d159b87aa8eae37c9e?a=0x4b2b0984484f8eae50dcc28afb7c1742467045c9

https://poocoin.app/tokens/0xb7b36ca86685af52186f1f9394e91d115a9da654

But still getting the same error:

Traceback (most recent call last):
  File "C:\PancakeSwapBot\abi.py", line 17, in tokenAbi
    with open(f"data/{filename}") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'data/ABI_0xb7b36CA86685Af52186f1f9394e91d115A9Da654.txt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\PancakeSwapBot\DeFiTranscation.py", line 291, in <module>
    runCode()
  File "C:\PancakeSwapBot\DeFiTranscation.py", line 133, in runCode
    BNB_balance, TokenSymbol, NoOfTokens, params = InitializeTrade()
  File "C:\PancakeSwapBot\DeFiTranscation.py", line 66, in InitializeTrade
    sellTokenAbi = tokenAbi(TokenToSellAddress, driver)
  File "C:\PancakeSwapBot\abi.py", line 21, in tokenAbi
    abi = findAbi(address, driver)
  File "C:\PancakeSwapBot\abi.py", line 41, in findAbi
    driver.get("chrome://settings/clearBrowserData");
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 333, in get
    self.execute(Command.GET, {'url': url})
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: Malformed URL: URL constructor: chrome://settings/clearBrowserData is not a valid URL.

Probably I am doing something wrong, but no clue to be honest... :(

Regards

@ZainAchak
Copy link
Owner

For this specific Token ABI, the script isn't working properly because of the wrong decimal indication.
You can try this decimalData.py script, replace it within your script. It worked for me, and for HAM use this address: 0x679d5b2d94f454c950d683d159b87aa8eae37c9e

def getTokenDecimal(decimal):
    decimal = int("1" + str("0" * decimal))
    decimalsDict = {"wei": 1,
                    "kwei": 1000,
                    "babbage": 1000,
                    "femtoether": 1000,
                    "mwei": 1000000,
                    "lovelace": 1000000,
                    "picoether": 1000000,
                    "gwei": 1000000000,
                    "shannon": 1000000000,
                    "nanoether": 1000000000,
                    "nano": 1000000000,
                    "szabo": 1000000000000,
                    "microether": 1000000000000,
                    "micro": 1000000000000,
                    "finney": 1000000000000000,
                    "milliether": 1000000000000000,
                    "milli": 1000000000000000,
                    "ether": 1000000000000000000,
                    "kether": 1000000000000000000000,
                    "grand": 1000000000000000000000,
                    "mether": 1000000000000000000000000,
                    "gether": 1000000000000000000000000000,
                    "tether": 1000000000000000000000000000000}

    # list out keys and values separately
    key_list = list(decimalsDict.keys())
    val_list = list(decimalsDict.values())

    # print key with val 100
    # position = key_list[position]

    if decimal in val_list:
        position = val_list.index(decimal)
        position = key_list[position]
        return key_list[position]
    else:
        return key_list[7]

@HHawk
Copy link
Author

HHawk commented Dec 11, 2021

Sorry, changed both, but still getting an error:

Traceback (most recent call last):
  File "C:\PancakeSwapBot\abi.py", line 17, in tokenAbi
    with open(f"data/{filename}") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'data/ABI_0x679D5b2d94f454c950d683D159b87aa8eae37C9e.txt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\PancakeSwapBot\DeFiTranscation.py", line 291, in <module>
    runCode()
  File "C:\PancakeSwapBot\DeFiTranscation.py", line 133, in runCode
    BNB_balance, TokenSymbol, NoOfTokens, params = InitializeTrade()
  File "C:\PancakeSwapBot\DeFiTranscation.py", line 66, in InitializeTrade
    sellTokenAbi = tokenAbi(TokenToSellAddress, driver)
  File "C:\PancakeSwapBot\abi.py", line 21, in tokenAbi
    abi = findAbi(address, driver)
  File "C:\PancakeSwapBot\abi.py", line 41, in findAbi
    driver.get("chrome://settings/clearBrowserData");
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 333, in get
    self.execute(Command.GET, {'url': url})
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: Malformed URL: URL constructor: chrome://settings/clearBrowserData is not a valid URL.

@HHawk
Copy link
Author

HHawk commented Dec 11, 2021

And when I re-run the command another time I get a different error:

Traceback (most recent call last):
  File "C:\PancakeSwapBot\DeFiTranscation.py", line 291, in <module>
    runCode()
  File "C:\PancakeSwapBot\DeFiTranscation.py", line 133, in runCode
    BNB_balance, TokenSymbol, NoOfTokens, params = InitializeTrade()
  File "C:\PancakeSwapBot\DeFiTranscation.py", line 70, in InitializeTrade
    BNB_balance = web3.eth.get_balance(walletAddress)
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\module.py", line 53, in caller
    (method_str, params), response_formatters = method.process_params(module, *args, **kwargs)  # noqa: E501
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\method.py", line 202, in process_params
    _apply_request_formatters(params, self.request_formatters(method)))
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\eth_utils\functional.py", line 45, in inner
    return callback(fn(*args, **kwargs))
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\method.py", line 52, in _apply_request_formatters
    formatted_params = pipe(params, request_formatters)
  File "cytoolz\functoolz.pyx", line 667, in cytoolz.functoolz.pipe
  File "cytoolz\functoolz.pyx", line 642, in cytoolz.functoolz.c_pipe
  File "cytoolz\functoolz.pyx", line 505, in cytoolz.functoolz.Compose.__call__
  File "cytoolz\functoolz.pyx", line 254, in cytoolz.functoolz.curry.__call__
  File "cytoolz\functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\_utils\abi.py", line 799, in map_abi_data
    return pipe(data, *pipeline)
  File "cytoolz\functoolz.pyx", line 667, in cytoolz.functoolz.pipe
  File "cytoolz\functoolz.pyx", line 642, in cytoolz.functoolz.c_pipe
  File "cytoolz\functoolz.pyx", line 254, in cytoolz.functoolz.curry.__call__
  File "cytoolz\functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\_utils\abi.py", line 833, in data_tree_map
    return recursive_map(map_to_typed_data, data_tree)
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\_utils\decorators.py", line 30, in wrapped
    wrapped_val = to_wrap(*args)
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\_utils\formatters.py", line 89, in recursive_map
    items_mapped = map_collection(recurse, data)
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\_utils\formatters.py", line 76, in map_collection
    return datatype(map(func, collection))
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\_utils\formatters.py", line 88, in recurse
    return recursive_map(func, item)
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\_utils\decorators.py", line 30, in wrapped
    wrapped_val = to_wrap(*args)
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\_utils\formatters.py", line 90, in recursive_map
    return func(items_mapped)
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\_utils\abi.py", line 830, in map_to_typed_data
    return ABITypedData(func(*elements))
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\_utils\normalizers.py", line 78, in wrapper
    modified = to_wrap(type_str, data)
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\_utils\normalizers.py", line 196, in abi_address_to_hex
    validate_address(data)
  File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\_utils\validation.py", line 177, in validate_address
    raise TypeError('Address {} must be provided as a string'.format(value))
TypeError: Address None must be provided as a string

And yes, I did put the address inside the quotes...

@HHawk
Copy link
Author

HHawk commented Dec 12, 2021

Other than using CMD, I also tried running it with Powershell. Same (2nd) error...

@ZainAchak
Copy link
Owner

It don't know why this error comes up for you, Because I've tried the same script for the HAM address and it worked for me perfectly. Try to use another bsc token and see if you get the same error or not.

@HHawk
Copy link
Author

HHawk commented Dec 13, 2021 via email

@HHawk
Copy link
Author

HHawk commented Dec 13, 2021

Going to redo the whole Puthon installation on a new Windows 10 installation. Let's see if that helps...
I have no clue what the error message means, which I posted.

@yazidou
Copy link

yazidou commented Oct 24, 2023

HI HHawk,
Didn't work for you because I have the same error!!

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