SeanDaBlack / KelloggBot

Kellogg bad | Union good | Support strike funds
GNU General Public License v3.0
398 stars 81 forks source link

Error "FAILED TO FILL OUT APPLICATION AND SUBMIT: [WinError 2] The system cannot find the file specified" #60

Open kylerchin opened 2 years ago

kylerchin commented 2 years ago

File not found? I'm on Windows 11 using Python 3.10.0 Here's a portion of my logs:

 Please use find_element() instead
  driver.find_element_by_xpath(CREATE_AN_ACCOUNT_BUTTON).click()
USING GUERRILLA TO CREATE EMAIL
EMAIL CREATED
C:\Users\kyler\KelloggBot\main.py:88: DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead
  driver.find_element_by_xpath(XPATHS_2.get(key)).send_keys(info)
C:\Users\kyler\KelloggBot\main.py:91: DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead
  select = Select(driver.find_element_by_id(COUNTRY_REGION_CODE_LABEL))
C:\Users\kyler\KelloggBot\main.py:93: DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead
  select = Select(driver.find_element_by_id(COUNTRY_REGION_OF_RESIDENCE_LABEL))
C:\Users\kyler\KelloggBot\main.py:96: DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead
  driver.find_element_by_xpath(READ_ACCEPT_DATA_PRIVACY_STATEMENT_ANCHORTAG).click()
C:\Users\kyler\KelloggBot\main.py:98: DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead
  driver.find_element_by_xpath(ACCEPT_BUTTON).click()
C:\Users\kyler\KelloggBot\main.py:101: DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead
  driver.find_element_by_xpath(CREATE_ACCOUNT_BUTTON).click()
C:\Users\kyler\KelloggBot\main.py:122: DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead
  driver.find_element_by_xpath(VERIFY_EMAIL_INPUT).send_keys(passcode)
C:\Users\kyler\KelloggBot\main.py:123: DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead
  driver.find_element_by_xpath(VERIFY_EMAIL_BUTTON).click()
successfully made account for fake email perryamber@hotmail.com
FAILED TO FILL OUT APPLICATION AND SUBMIT: [WinError 2] The system cannot find the file specified

I am using the latest master branch version.

bolshoytoster commented 2 years ago

At main.py, line 276: https://github.com/SeanDaBlack/KelloggBot/blob/11a9218d04d7d26f6e124b45062b5e961a52ec72/main.py#L275-L281 Can you replace that with just:

    fill_out_application_and_submit(driver, random_city, fake_identity)

Notice that the line is indented by only 4 spaces rather than 8.

This will allow you to get the full stack trace, if you get the error again can you post the full error please.

kylerchin commented 2 years ago
PS C:\Users\kyler\KellCopy> python .\main.py
C:\Users\kyler\KellCopy\main.py:56: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
  driver = webdriver.Chrome(ChromeDriverManager().install(),options=options)

DevTools listening on ws://127.0.0.1:1216/devtools/browser/d0481774-49b9-4d74-b9da-68a2fffb11cc
[1217/113015.672:INFO:CONSOLE(23)] "JQMIGRATE: Migrate is installed with logging active, version 1.4.1", source: https://jobs.kellogg.com/platform/js/jquery/jquery-migrate-1.4.1.js (23)
[1217/113015.676:INFO:CONSOLE(2)] "JQMIGRATE: Migrate plugin loaded multiple times", source: https://jobs.kellogg.com/platform/js/jquery/jquery-migrate-3.1.0.min.js (2)
[1217/113015.676:INFO:CONSOLE(2)] "JQMIGRATE: Migrate is installed, version 3.1.0", source: https://jobs.kellogg.com/platform/js/jquery/jquery-migrate-3.1.0.min.js (2)
C:\Users\kyler\KellCopy\main.py:64: DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead
  driver.find_element_by_xpath(APPLY_NOW_BUTTON_1).click()
C:\Users\kyler\KellCopy\main.py:65: DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead
  driver.find_element_by_xpath(APPLY_NOW_BUTTON_2).click()
C:\Users\kyler\KellCopy\main.py:66: DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead
  driver.find_element_by_xpath(CREATE_AN_ACCOUNT_BUTTON).click()
[1217/113033.931:INFO:CONSOLE(5)] "JQMIGRATE: Migrate is installed, version 3.3.0", source: https://career4.successfactors.com/ui/extlib/jquery_3.5.1/jquery.js (5)
[1217/113035.054:INFO:CONSOLE(25)] "Uncaught Error: Widget needs a script tag element with type='IN/AwliWdiget' to provide parameters to work!", source: https://www.linkedin.com/mjobs/awli/awliWidget (25)
[1217/113035.984:INFO:CONSOLE(5)] "JQMIGRATE: Migrate is installed, version 3.3.0", source: https://career4.successfactors.com/ui/extlib/jquery_3.5.1/jquery.js (5)
[1217/113036.249:INFO:CONSOLE(20)] "Req in Event: /xi/ajax/remoting/call/plaincall/pwdPolicyControllerProxy.getPasswordPolicy.dwr", source: https://career4.successfactors.com/ui/perflog/js/perflog_d8020794e7597e403c5c26bfeac487df.js (20)
[1217/113036.379:INFO:CONSOLE(20)] "Req in Event: /xi/ajax/remoting/call/plaincall/pwdPolicyControllerProxy.getPasswordPolicy.dwr", source: https://career4.successfactors.com/ui/perflog/js/perflog_d8020794e7597e403c5c26bfeac487df.js (20)
[1217/113036.432:INFO:CONSOLE(25)] "Uncaught Error: Widget needs a script tag element with type='IN/AwliWdiget' to provide parameters to work!", source: https://www.linkedin.com/mjobs/awli/awliWidget (25)
USING GUERRILLA TO CREATE EMAIL
  File "C:\Users\kyler\KellCopy\main.py", line 283, in <module>
    main()
  File "C:\Users\kyler\KellCopy\main.py", line 276, in main
    fill_out_application_and_submit(driver, random_city, fake_identity)
  File "C:\Users\kyler\KellCopy\main.py", line 131, in fill_out_application_and_submit
    make_resume(fake_identity['first_name']+' '+fake_identity['last_name'], fake_identity['email'], fake_identity['phone'], resume_filename)
  File "C:\Users\kyler\KellCopy\resume_faker.py", line 2132, in make_resume
    subprocess.call(
  File "C:\Python310\lib\subprocess.py", line 345, in call
    with Popen(*popenargs, **kwargs) as p:  File "C:\Python310\lib\subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Python310\lib\subprocess.py", line 1435, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
bolshoytoster commented 2 years ago

Thanks, I'll have a look.

bolshoytoster commented 2 years ago

It appears to come from resume_maker.py: https://github.com/SeanDaBlack/KelloggBot/blob/11a9218d04d7d26f6e124b45062b5e961a52ec72/resume_faker.py#L2131-L2138 The annoying thing about windows errors is that they're really vague.

Have you got pdflatex installed? You can make sure it's working properly by running pdflatex in your command prompt.

mangoALCATRAZ commented 2 years ago

I looked into this and here is what I found. When pdflatex is called by subprocess.call() within resume_faker.py, sometimes it runs into an issue where the fonts it relies on needed by the tex/pdf generation are not installed. Because of this, pdflatex ends up returning with an error and NOT turning the generated tex into a pdf. Therefore, on line 2138 when it attempts to rename auto_resume.pdf, that file doesn't exist, hence the error.

I figured this out by executing pdflatex in the command line myself using the auto_resume.tex file the python script generates, which still generates just fine and can be found within resumeSrc. This is how you can do so in the command line and have it give you a detailed error and traceback to boot

pdflatex -interaction=nonstopmode -halt-on-error auto_resume.tex

If you are like me, chances are once you run this, it will crash and tell you that there are some fonts that it is unable to locate. Unfortunately, I am not entirely familiar with BasicTex. However, in my case, pdflatex was having trouble locating a variation of the EBGaramond font. After a quick google search to figure out how to install fonts properly using BasicTex, i was able to solve the problem by heading to my command line and typing:

tlmgr install collection-fontsextra

There was also another missing font issue i ran into. This was an entirely different font that pdflatex could not find that was resulting in the same error, and it happened on a different loop of the script with a different fake identity. Unfortunately I did not note which font, but I managed to fix that using

tlmgr install collection-fontsrecommended

From there, the script successfully generated auto_resume.pdf and the python script was able to continue to execute without throwing that failure.

I recommend that there be an addition to the installation README that specifies that font packages such as the above may need to be installed after BasicTex's installation.

EDIT: Didn't see the README update proposal before writing this. I am not sure if the solution presented in the README update @bolshoytoster proposed would account for this, but if so, deff go with that.

bolshoytoster commented 2 years ago

@mangoALCATRAZ

EDIT: Didn't see the README update proposal before writing this. I am not sure if the solution presented in the README update @bolshoytoster proposed would account for this, but if so, deff go with that.

My pr doesn't really address this, I'll add this in.