[Errno 2] No such file or directory (PYTHON)

I’m attempting to get this snap to run on Solus (haven’t tested on others). However, as the title states, I am receiving the following error when attempting to run (after a successful build):

~$ smbmap 
/snap/smbmap/14/usr/bin/python3: can't open file 'pysmbmap.py': [Errno 2] No such file or directory

I’ve attempted several iterations, trying different things with command.

Here’s a current version of my .yaml:

name: smbmap # check to see if it's available
version: '0.4+git' # check versioning
summary: SMBMap allows users to enumerate samba share drives across an entire domain. # 79 char long summary
description: |
    SMBMap allows users to enumerate samba share drives across an entire domain. List share drives, drive permissions, share contents, upload/download functionality, file name auto-download pattern matching, and even execute remote commands. This tool was designed with pen testing in mind, and is intended to simplify searching for potentially sensitive data across large networks.
grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs

apps:
  smbmap:
    command: usr/bin/python3 pysmbmap.py
    environment: 
      LC_ALL: C.UTF-8
    plugs:
      - home
      - network
     
parts: 
  my-part:
    source: https://github.com/kz6fittycent/smbmap
    source-type: git
    plugin: python
    python-version: python3
    
    build-packages:
      - python3
      
    stage-packages:
      - python3

I’ve not had this issue with python-based snaps before.

Thanks for your help!

I think you just have to pass the path of pysmbmap.py, perhaps you wanted to say $SNAP/pysmbmap.py?

Yeah, I thought so, too. However, that didn’t work either (I think that was on attempt #3).

What is the error if you do that?

Same error; exactly.

I’ve tried using different versions of python (2/3), changing the directory to the actual python script, even running it like you’d actually run a Python script (e.g. python pysmbmap.py, usr/bin/python $SNAP/pysmbmap.py and usr/bin/python pysmbmap.py) and each time, it’s the same exact error.

That’s why I’m hoping you guys can help, lol. It’s WEIRD.

It is complaining that the path and filename you have given the command: option is not present in your snap’s filesystem. Specifically there is no file called pysmbmap.py at the top of your snap’s hierarchy. Perhaps your build puts it elsewhere? You will need to examine your snap to find out where, and if, the build has placed the file so that you can call it correctly.

The path should be prefixed with $SNAP once you’ve found it, so if the file is at usr/bin/pysmbmap.py inside your snap then you will want a command with python $SNAP/usr/bin/pysmbmap.py.

1 Like