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

I had to re-open ticket Error message, cannot get it up and running?? #12 #14

Closed
HHawk opened this issue Dec 12, 2021 · 15 comments
Closed

Comments

@HHawk
Copy link

HHawk commented Dec 12, 2021

Sorry, but I had to re-open the ticket again: I had to re-open ticket Error message, cannot get it up and running?? #12
Still not solved, probably doing something wrong....

@HHawk
Copy link
Author

HHawk commented Dec 13, 2021

Python 3.10.1 is good for Windows 10, right? Or is that version to new?

@HHawk
Copy link
Author

HHawk commented Dec 13, 2021

MetaMask wallet is supported, right? Maybe that's the issue...

@HHawk
Copy link
Author

HHawk commented Dec 13, 2021

Okay, I redid the whole Python setup and other necessary stuff... But still the exact same issue. Sigh.

Error message:

Traceback (most recent call last):
  File "C:\Users\Computer\Desktop\DeFi_PanCakeSwapBot-master\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:\Users\Computer\Desktop\DeFi_PanCakeSwapBot-master\DeFiTranscation.py", line 291, in <module>
    runCode()
  File "C:\Users\Computer\Desktop\DeFi_PanCakeSwapBot-master\DeFiTranscation.py", line 133, in runCode
    BNB_balance, TokenSymbol, NoOfTokens, params = InitializeTrade()
  File "C:\Users\Computer\Desktop\DeFi_PanCakeSwapBot-master\DeFiTranscation.py", line 66, in InitializeTrade
    sellTokenAbi = tokenAbi(TokenToSellAddress, driver)
  File "C:\Users\Computer\Desktop\DeFi_PanCakeSwapBot-master\abi.py", line 21, in tokenAbi
    abi = findAbi(address, driver)
  File "C:\Users\Computer\Desktop\DeFi_PanCakeSwapBot-master\abi.py", line 41, in findAbi
    driver.get("chrome://settings/clearBrowserData");
  File "C:\Users\Computer\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\Computer\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\Computer\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.

So maybe MetaMask does not work with your bot?
I will try something else along with a different token, but I doubt that's it, as you stated that you got it working. So it must be something else...

Regards

@HHawk
Copy link
Author

HHawk commented Dec 13, 2021

Also tried a different token; same issue...

I also tried changing the "TRADE_TOKEN_ADDRESS" to "None" as shown in your example. Then I get a manual input screen for the token. But when I add the token address manually, the same error shows up.

So maybe MetaMask is the issue? Or something else, but no clue...

//edit

I emptied the folder /data and tried again with yet another different coin (Harmony ONE).
On the first go I get the following:

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

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Computer\Desktop\DeFi_PanCakeSwapBot-master\DeFiTranscation.py", line 291, in <module>
    runCode()
  File "C:\Users\Computer\Desktop\DeFi_PanCakeSwapBot-master\DeFiTranscation.py", line 133, in runCode
    BNB_balance, TokenSymbol, NoOfTokens, params = InitializeTrade()
  File "C:\Users\Computer\Desktop\DeFi_PanCakeSwapBot-master\DeFiTranscation.py", line 66, in InitializeTrade
    sellTokenAbi = tokenAbi(TokenToSellAddress, driver)
  File "C:\Users\Computer\Desktop\DeFi_PanCakeSwapBot-master\abi.py", line 21, in tokenAbi
    abi = findAbi(address, driver)
  File "C:\Users\Computer\Desktop\DeFi_PanCakeSwapBot-master\abi.py", line 38, in findAbi
    f.write(abi[0].text)
IndexError: list index out of range

The created ABI file (ABI_0x03fF0ff224f904be3118461335064bB48Df47938) in /data is empty (0 KB).
I guess this might be an issue with the token, so I decided to test yet another different token, this time Safemoon (0x8076c74c5e3f5852037f31ff0093eeb8c8add8d3).

Result:

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

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "C:\Users\Computer\Desktop\DeFi_PanCakeSwapBot-master\DeFiTranscation.py", line 291, in <module>
    runCode()
  File "C:\Users\Computer\Desktop\DeFi_PanCakeSwapBot-master\DeFiTranscation.py", line 133, in runCode
    BNB_balance, TokenSymbol, NoOfTokens, params = InitializeTrade()
  File "C:\Users\Computer\Desktop\DeFi_PanCakeSwapBot-master\DeFiTranscation.py", line 66, in InitializeTrade
    sellTokenAbi = tokenAbi(TokenToSellAddress, driver)
  File "C:\Users\Computer\Desktop\DeFi_PanCakeSwapBot-master\abi.py", line 21, in tokenAbi
    abi = findAbi(address, driver)
  File "C:\Users\Computer\Desktop\DeFi_PanCakeSwapBot-master\abi.py", line 41, in findAbi
    driver.get("chrome://settings/clearBrowserData");
  File "C:\Users\Computer\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\Computer\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\Computer\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.**

This is the same error message I am getting with the original token I was trying (Hamster).
I marked the two main errors; first one says it cannot find/open the ABI file. The other error says Malformed URL, but I am guessing that's the result of the main error?

@HHawk
Copy link
Author

HHawk commented Dec 13, 2021

Bleh... I have no clue anymore what is wrong. I give up.

@ZainAchak
Copy link
Owner

I don't know why is that happening to you, if the token that I've used on YouTube tutorial also didn't work you then I'm not sure what to do. I tried HAM and it was perfectly fine and script doesn't have any concern with metamask specifically It does need a wallet address with Binance Smart Chain network that it.

@HHawk
Copy link
Author

HHawk commented Dec 13, 2021

I don't know why is that happening to you, if the token that I've used on YouTube tutorial also didn't work you then I'm not sure what to do. I tried HAM and it was perfectly fine and script doesn't have any concern with metamask specifically It does need a wallet address with Binance Smart Chain network that it.

Yeah, it's very strange indeed... Maybe it's the Python version? Running the latest Python 3.10.1.
I have 3 browsers installed; Edge (obviously), Chrome and Firefox.

Running all commands as admin.

I have no idea what's wrong. The only thing I read from the error above is that it cannot open: "data/ABI_0x10ED43C718714eb63d5aA57B78B54704E256024E.txt"

Error:

  File "C:\Users\Computer\Desktop\DeFi_PanCakeSwapBot-master\abi.py", line 17, in tokenAbi
    with open(f"data/{filename}") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'data/ABI_0x10ED43C718714eb63d5aA57B78B54704E256024E.txt'

Though the file is there (size: 12 KB). With various elements inside (but all empty apparently).
I think that is the issue.

I am running your script within a VM based on a clean installation of Windows 10.
No clue what else I can test to be honest. No other ideas? I will run one more test.

@ZainAchak
Copy link
Owner

Okay so do it manually Copy the ABI contract from here LINK, and make a file with in the location "data/ABI_0x10ED43C718714eb63d5aA57B78B54704E256024E.txt" with the same name.

@HHawk
Copy link
Author

HHawk commented Dec 13, 2021

Ugh... I now really give up. I keep getting the same error over and over. Even uninstalled Python 3.10 and installed Python 3.6.8 instead. I also copied all files in /data but with .txt behind it. No luck.

Checking the closed issues, more people had this exact same error:

So, including myself, four (4) people have the same/similar error...

@hinnecco
Copy link

I believe the problem is not enough time to catch the ABI, try to add a delay.

@vanbangalon
Copy link

I don't know why is that happening to you, if the token that I've used on YouTube tutorial also didn't work you then I'm not sure what to do. I tried HAM and it was perfectly fine and script doesn't have any concern with metamask specifically It does need a wallet address with Binance Smart Chain network that it.

Yeah, it's very strange indeed... Maybe it's the Python version? Running the latest Python 3.10.1. I have 3 browsers installed; Edge (obviously), Chrome and Firefox.

Running all commands as admin.

I have no idea what's wrong. The only thing I read from the error above is that it cannot open: "data/ABI_0x10ED43C718714eb63d5aA57B78B54704E256024E.txt"

Error:

  File "C:\Users\Computer\Desktop\DeFi_PanCakeSwapBot-master\abi.py", line 17, in tokenAbi
    with open(f"data/{filename}") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'data/ABI_0x10ED43C718714eb63d5aA57B78B54704E256024E.txt'

Though the file is there (size: 12 KB). With various elements inside (but all empty apparently). I think that is the issue.

I am running your script within a VM based on a clean installation of Windows 10. No clue what else I can test to be honest. No other ideas? I will run one more test.

Same problem I encountered. Maybe it's a bug from web3.

@vanbangalon
Copy link

Hello bro need help with this issue.

File "C:\Users\vanba\Downloads\DeFi_PanCakeSwapBot-master\DeFiTransaction.py", line 291, in <module> runCode() File "C:\Users\vanba\Downloads\DeFi_PanCakeSwapBot-master\DeFiTransaction.py", line 133, in runCode BNB_balance, TokenSymbol, NoOfTokens, params = InitializeTrade() File "C:\Users\vanba\Downloads\DeFi_PanCakeSwapBot-master\DeFiTransaction.py", line 70, in InitializeTrade BNB_balance = web3.eth.get_balance(walletAddress) File "C:\Users\vanba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\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\vanba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\web3\method.py", line 202, in process_params _apply_request_formatters(params, self.request_formatters(method))) File "C:\Users\vanba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\eth_utils\functional.py", line 45, in inner return callback(fn(*args, **kwargs)) File "C:\Users\vanba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\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\vanba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\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\vanba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\web3\_utils\abi.py", line 833, in data_tree_map return recursive_map(map_to_typed_data, data_tree) File "C:\Users\vanba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\web3\_utils\decorators.py", line 30, in wrapped wrapped_val = to_wrap(*args) File "C:\Users\vanba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\web3\_utils\formatters.py", line 89, in recursive_map items_mapped = map_collection(recurse, data) File "C:\Users\vanba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\web3\_utils\formatters.py", line 76, in map_collection return datatype(map(func, collection)) File "C:\Users\vanba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\web3\_utils\formatters.py", line 88, in recurse return recursive_map(func, item) File "C:\Users\vanba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\web3\_utils\decorators.py", line 30, in wrapped wrapped_val = to_wrap(*args) File "C:\Users\vanba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\web3\_utils\formatters.py", line 90, in recursive_map return func(items_mapped) File "C:\Users\vanba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\web3\_utils\abi.py", line 830, in map_to_typed_data return ABITypedData(func(*elements)) File "C:\Users\vanba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\web3\_utils\normalizers.py", line 78, in wrapper modified = to_wrap(type_str, data) File "C:\Users\vanba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\web3\_utils\normalizers.py", line 196, in abi_address_to_hex validate_address(data) File "C:\Users\vanba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\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

@hinnecco
Copy link

Problem with your wallet address, did you set the wallet address in the config file? or did you set an environment variable with your wallet address?

@vanbangalon
Copy link

Problem with your wallet address, did you set the wallet address in the config file? or did you set an environment variable with your wallet address?

This is the code sir, can you teach me exactly how to set environment variable on this? I just hide my private key for security. Thanks!

import os

YOUR_WALLET_ADDRESS = os.environ.get('0xcA159df58f82b1d4519F789421E2Db67Eb8727E8')  # Add Your Wallet Address here by removing whole line
YOUR_PRIVATE_KEY = os.environ.get('ALREADY SETUP')  # Add Your Private Key here by removing whole line

TRADE_TOKEN_ADDRESS = None  # Add token address here example : "0xc66c8b40e9712708d0b4f27c9775dc934b65f0d9"
WBNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"
PANCAKE_ROUTER_ADDRESS = "0x10ED43C718714eb63d5aA57B78B54704E256024E"
SHOW_TX_ON_BROWSER = True

SELL_TOKENS = None
BUY_TOKENS = None

@hinnecco
Copy link

Problem with your wallet address, did you set the wallet address in the config file? or did you set an environment variable with your wallet address?

This is the code sir, can you teach me exactly how to set environment variable on this? I just hide my private key for security. Thanks!

import os

YOUR_WALLET_ADDRESS = os.environ.get('0xcA159df58f82b1d4519F789421E2Db67Eb8727E8')  # Add Your Wallet Address here by removing whole line
YOUR_PRIVATE_KEY = os.environ.get('ALREADY SETUP')  # Add Your Private Key here by removing whole line

TRADE_TOKEN_ADDRESS = None  # Add token address here example : "0xc66c8b40e9712708d0b4f27c9775dc934b65f0d9"
WBNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"
PANCAKE_ROUTER_ADDRESS = "0x10ED43C718714eb63d5aA57B78B54704E256024E"
SHOW_TX_ON_BROWSER = True

SELL_TOKENS = None
BUY_TOKENS = None

you do not need use the environment variable it is only if you want, you can just set the value direcltly in the config file.
Change this:
YOUR_WALLET_ADDRESS = os.environ.get('0xcA159df58f82b1d4519F789421E2Db67Eb8727E8')
to this:
YOUR_WALLET_ADDRESS = '0xcA159df58f82b1d4519F789421E2Db67Eb8727E8'
and do the same for your private key and remember to add the 0x in the begin of your private key

so your private key will be something like this

YOUR_PRIVATE_KEY = '0xA12468c1724937c.......'

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

4 participants