0

Apparently I'm doing something wrong, and all instructions I have found literally everywhere say how to install (program name here) with PIP but not how to execute it.

I am trying to run pyasn1, using a python3 virtual environment.

I have also tried using my default python2.7 environment, but no love there, either.

python3 -m venv asn1_env
source asn1_env/bin/activate

Just to check that I'm in the new virtual environment.

which python
/Users/xxxx/asn1_env/bin/python

Now we install pyasn1 for the umpteenth time...

pip install pyasn1
Successfully installed pyasn1-0.4.5

This is where things go awry...

which pyasn1

(nothing, can't find it in the virtual path)

find . -name "pyasn1.*"

./asn1_env/lib/python3.7/site-packages/pyasn1

(only finds a directory, which contains a bunch of files, none of which are called pyasn1)

Obviously, this won't work, either...

python pyasn1.py
/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'pyasn1.py': [Errno 2] No such file or directory
c.fogelklou
  • 1,781
  • 1
  • 13
  • 26
  • Did you try `import pyasn1` in the python REPL? I'm new to pyasn1 - but it looks like a library - which doesn't export an executable. So I wouldn't expect `pyasn1` to be a command in the shell after installation. But if you open up a python shell and type in `import pyasn1` it should work. – rdas Apr 13 '19 at 07:50

1 Answers1

1

There is nothing to run in pyasn1 because it's a library, not a runnable program.

The intended workflow is that you fist express your ASN.1 data structures in form of pyasn1 classes, then you could either decode serialized data (BER/DER/CER) into Python objects or vice-versa.

Ilya Etingof
  • 5,440
  • 1
  • 17
  • 21
  • Ah, that wasn't at all clear from the documentation in the Readme.md. That would explain why there weren't any examples on how to run it from the command line. (or perhaps I need to improve my reading comprehension. ) – c.fogelklou Apr 13 '19 at 09:16