Python doesn't run script

Question: I need help with my Script my Python code with selenium doesn’t run.

The error:

python3 main.py
nix error: building nix env: exit status 1
Output has been trimmed to the last 20 lines
copied source '/nix/store/x8dbrija74rnw16hrbw5r5apx9k81giz-nixpkgs-21.11-src/pkgs/data/icons/hicolor-icon-theme/setup-hook.sh' -> '/nix/store/c9fwa4fbfj3d66k6lrcab6fxqwamwiff-setup-hook.sh'
instantiated 'hicolor-icon-theme-0.17.tar.xz' -> '/nix/store/7kzp65ay6dixp30553b0zqpiq2incrkb-hicolor-icon-theme-0.17.tar.xz.drv'
instantiated 'hicolor-icon-theme-0.17' -> '/nix/store/7r0c4pzicbv02xrc762wq80qbl25xgmd-hicolor-icon-theme-0.17.drv'
instantiated 'adwaita-icon-theme-41.0.tar.xz' -> '/nix/store/qldcfaz136cnl3b2qc14zj2xfp885y33-adwaita-icon-theme-41.0.tar.xz.drv'
instantiated 'adwaita-icon-theme-41.0' -> '/nix/store/qqqlia21mvar6slwgsckwl62yb9rg63v-adwaita-icon-theme-41.0.drv'
instantiated 'ed-1.17.tar.lz' -> '/nix/store/0qqsrpsnbl0a48qjg5zgnrdx3pp9c95h-ed-1.17.tar.lz.drv'
instantiated 'ed-1.17' -> '/nix/store/fvcgwws2spzi9k0ndxvvsf6q477zmdwv-ed-1.17.drv'
instantiated 'chromium-98.0.4758.102' -> '/nix/store/fsxh492wgwy4igxc402hwraw83nc1s9p-chromium-98.0.4758.102.drv'
evaluating file '/nix/store/x8dbrija74rnw16hrbw5r5apx9k81giz-nixpkgs-21.11-src/pkgs/development/tools/selenium/chromedriver/default.nix'
instantiated 'chromedriver_linux64.zip' -> '/nix/store/gv8hfdm6ilbhwzlka30fv8r807h97gdc-chromedriver_linux64.zip.drv'
instantiated 'chromedriver-98.0.4758.102' -> '/nix/store/2q63kda7ahp186crni7n2mxq6diqqv4a-chromedriver-98.0.4758.102.drv'
evaluating file '/nix/store/x8dbrija74rnw16hrbw5r5apx9k81giz-nixpkgs-21.11-src/pkgs/tools/misc/toybox/default.nix'
instantiated 'source' -> '/nix/store/dn6kk0lj20ghvgn0q99ipf81p2kaxkdr-source.drv'
instantiated 'toybox-0.8.5' -> '/nix/store/9bgiwzq30r4qj1zbkkjwgk80h8hnb69d-toybox-0.8.5.drv'
evaluating file '/nix/store/x8dbrija74rnw16hrbw5r5apx9k81giz-nixpkgs-21.11-src/pkgs/tools/security/sudo/default.nix'
instantiated 'sudo-1.9.7p2.tar.gz' -> '/nix/store/jad13z9bbxkm6sq3q27prxhaj9hya67r-sudo-1.9.7p2.tar.gz.drv'
instantiated 'sudo-1.9.7p2' -> '/nix/store/x6xnn0y5mrhrrajqnc7wxw343ippq5yk-sudo-1.9.7p2.drv'
error: attribute 'selenium' missing, at /home/runner/SNAPCHAT-STREAK-RESTOR/replit.nix:10:5
(use '--show-trace' to show detailed location information)

unable to find executable exec: "python3": executable file not found in $PATH

Hey, @trober50 welcome to the forums!

Can you please provide a link to the Repl? This way it is easier for staff and members of the community to help you!

Also see this guide on how to share your code:

1 Like

Hey @QwertyQwerty88
i cant provide my full project link because there are sensitive informations in it.

1 Like

You should store all sensitive information in your secrets tab, so that you can share the repls.

3 Likes

Simply provide the entire code without the sensitive information, and don’t forget to use codeblocks. :))

2 Likes

i used the secret tab
here is the link

I’m not in the right position to say anything, but does this program you sent violate Snapchat’s TOS?

no there is nothing about doing somthing like i do.

So, what does not work about it? Any errors/messages?

I guess try python instead of python3.

1 Like

so i changed it to python instead of python3 now i get this error:

~/SNAPCHAT-STREAK-RESTOR$ python main.py
python: command not installed. Multiple versions of this command were found in Nix.
Select one to run (or press Ctrl-C to cancel):
Adding python39Full to replit.nix
success
/nix/store/z47xa2w82saknxczlirm25f9s3bw3yh7-python3-3.9.6
Traceback (most recent call last):
  File "/home/runner/SNAPCHAT-STREAK-RESTOR/./script.py", line 1, in <module>
    from selenium import webdriver
ModuleNotFoundError: No module named 'selenium'

What happens if you run python in the shell? If you get an error maybe you are using a non template Emory nix?

this is in my Replit.nix file:

{ pkgs }: {
  deps = [
    pkgs.python39Full
    pkgs.chromium
    pkgs.chromedriver
    pkgs.toybox
    pkgs.sudo
    pkgs.iproute2
    pkgs.selenium
  ];
  env = {
    PYTHON_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
      # Needed for pandas / numpy
      pkgs.stdenv.cc.cc.lib
      pkgs.zlib
      # Needed for pygame
      pkgs.glib
      # Needed for matplotlib
      pkgs.xorg.libX11
    ];
    PYTHONBIN = "${pkgs.python310}/bin/python3.10";
    LANG = "en_US.UTF-8";
  };
}

this is what i get when i run python main.py in the shell:

~/SNAPCHAT-STREAK-RESTOR$ python main.py
python: command not installed. Multiple versions of this command were found in Nix.
Select one to run (or press Ctrl-C to cancel):
Adding python39Full to replit.nix
success
/nix/store/z47xa2w82saknxczlirm25f9s3bw3yh7-python3-3.9.6
Traceback (most recent call last):
  File "/home/runner/SNAPCHAT-STREAK-RESTOR/./script.py", line 1, in <module>
    from selenium import webdriver
ModuleNotFoundError: No module named 'selenium'

So you are using an empty nix and nit a template? Then maybe somebody can help you as so far I have only used templates.

the problem is i didnt find a template and the main problem is that the script and everything worked just fine and then out of no where it stoped running and i didnt changed anything in the script.

remove pkgs.selenium from replit.nix

i did and nothing changed it says:

 python main.py
Traceback (most recent call last):
  File "/home/runner/SNAPCHAT-STREAK-RESTOR/./script.py", line 1, in <module>
    from selenium import webdriver
ModuleNotFoundError: No module named 'selenium'

it should have said ‘detected change in environment, reloading shell’ after you ran the command. Try again.

i got this now:

 pip install selenium
pip: command not installed. Multiple versions of this command were found in Nix.
Select one to run (or press Ctrl-C to cancel):
Adding python39Packages.pip to replit.nix
success
/nix/store/3xcbipxg7dacja7arkqsdp31wv48a59b-python3.9-pip-21.1.3
An error occurred during configuration: option use-feature: invalid choice: 'content-addressable-pool' (choose from '2020-resolver', 'fast-deps', 'in-tree-build')
Detected change in environment, reloading shell...

your repl is broken because it’s missing the venv folder :thinking: All I can suggest is to move to a new python repl