How to convert Gaussian input file .gjf to SMILES? Is there a way to convert Gaussian input files (.gjf) to SMILES-codes (.smi)?

I'm aware of Open Babel (http://openbabel.org/docs/2.3.0/FileFormats/Overview.html), but this lists .gjf as a "write-only" format. Is there, nevertheless, a way (which ideally can be integrated into a Python application) to convert .gjf to .smi?

Edit:

(as mentioned in the comments there could be two different formats in .gjf?!)
Some example to clarify:

...

Winmostar

0 1
C
N 1 R2
C 2 R3 1 A3
C 3 R4 2 A4 1 D4
C 3 R5 2 A5 1 D5
C 5 R6 3 A6 2 D6
C 4 R7 3 A7 2 D7
C 6 R8 5 A8 3 D8
H 5 R9 3 A9 2 D9
N 1 R10 2 A10 3 D10
H 8 R11 6 A11 5 D11
C 10 R12 1 A12 2 D12
...
R2 1.380897451
R3 1.347679561
R4 1.373428060
R5 1.389879183
R6 1.397784043
R7 1.383546211
R8 1.399306496
R9 1.102440160
R10 1.375509032
...
A3 108.5501889
A4 108.1923111
A5 131.7222115
A6 117.5631443
A7 123.5229334
A8 121.6972504
A9 120.8892161
A10 105.3917963
...
D4 3.7044863
D5 -177.0963408
D6 -178.8876730
D7 178.9809960
D8 0.1218056
D9 0.5014806
D10 -7.3468625
...
It is not aiming for code golf, but the following offers the conversion to intermediate .xyz which may be processed further (cf. vide infra):

import fnmatch
import os
import sys

gjf_register = []

for file in os.listdir("."):
    # collect all .gjf:
    if fnmatch.fnmatch(file, "*.gjf"):
        gjf_register.append(file)
    gjf_register.sort()

for entry in gjf_register:
    # recover only the atom block:
    per_file_register = []
    with open(entry, mode="r") as source:
        for line in source:
            per_file_register.append(line)
    del per_file_register[:5]  # clip the first lines

    # the other mandatory entry in the .xyz file:
    number_of_atoms = len(per_file_register) - 1

    # write an intermediate .xyz file:
    intermediate_xyz = str(entry)[:-4] + str(".xyz")
    print("File {} written.".format(intermediate_xyz))

    with open(intermediate_xyz, mode="w") as newfile:
        newfile.write(str(number_of_atoms))
        newfile.write(str("\n"))

        newfile.write(str(intermediate_xyz))
        newfile.write(str("\n"))

        for entry in per_file_register[:-1]:
            newfile.write(entry)

sys.exit(0)


The conversion into .smi may then be delegated to obabel, e.g. by

obabel *.xyz -osmi -m


if there are multiple files to consider.



Proof:  The following .cif

data_EFAHAW
_cell_length_a 8.1819
_cell_length_b 10.4285
_cell_length_c 9.2965
_cell_angle_alpha 90
_cell_angle_beta 99.962
_cell_angle_gamma 90
_symmetry_space_group_name_H-M 'P 21/c'

loop_
_symmetry_equiv_pos_site_id
_symmetry_equiv_pos_as_xyz
1 x,y,z
2 -x,1/2+y,1/2-z
3 -x,-y,-z
4 x,1/2-y,1/2+z

loop_
_atom_site_label
_atom_site_type_symbol
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
O3 O 0.19290 0.35524 0.46580
C9 C 0.16780 0.24532 0.42690
O2 O 0.05757 0.21719 0.30246
C7 C 0.05180 0.07991 0.27798
C1 C 0.16866 0.02605 0.40441
C6 C 0.23660 0.12584 0.49162
C3 C 0.35070 0.10279 0.61788
C5 C 0.39278 -0.02130 0.65283
C2 C 0.32245 -0.12294 0.56458
C4 C 0.20840 -0.10008 0.43826


was converted by 

babel -icif EFAHAW.cif -ogjf test.gjf


into 

#Put Keywords Here, check Charge and Multiplicity.

 EFAHAW

0  15
O           0.82917         3.70462         4.26502
C           0.68636         2.55832         3.90884
O          -0.01540         2.26497         2.76942
C          -0.02324         0.83334         2.54528
C           0.72957         0.27166         3.70291
C           1.14519         1.31232         4.50144
C           1.87569         1.07195         5.65752
C           2.16377        10.20637         5.97753
C           1.73027         9.14642         5.16948
C           1.00028         9.38482         4.01285


The above script converted it into .xyz

10
test.xyz
O           0.82917         3.70462         4.26502
C           0.68636         2.55832         3.90884
O          -0.01540         2.26497         2.76942
C          -0.02324         0.83334         2.54528
C           0.72957         0.27166         3.70291
C           1.14519         1.31232         4.50144
C           1.87569         1.07195         5.65752
C           2.16377        10.20637         5.97753
C           1.73027         9.14642         5.16948
C           1.00028         9.38482         4.01285


and already mentioned babel -ixyz test.xyz -osmi test.smiles offered the SMILES string

O=C1O[C][C]=C1[C].[C][C][C] test.xyz


Due to the definition of asymmetric unit and unit cell, other original input formats than .cif may work even better (i.e., may yield molecules which are not fragmented as here), e.g. «native» .mol2 or .sdf.