justin2341 commited on
Commit
e7f1148
·
verified ·
1 Parent(s): d58a636

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -6
app.py CHANGED
@@ -21,12 +21,20 @@ encoder = handtool.create_encoder(config)
21
  machineCode = encoder.getMachineCode()
22
  print("\nmachineCode: ", machineCode.decode('utf-8'))
23
 
24
- try:
25
- with open(licensePath, 'r') as file:
26
- license = file.read()
27
- except IOError as exc:
28
- print("failed to open license.txt: ", exc.errno)
29
- print("\nlicense: ", license)
 
 
 
 
 
 
 
 
30
 
31
  ret = encoder.setActivation(license.encode('utf-8'))
32
  print("\nactivation: ", ret)
 
21
  machineCode = encoder.getMachineCode()
22
  print("\nmachineCode: ", machineCode.decode('utf-8'))
23
 
24
+ # Get a specific environment variable by name
25
+ license = os.environ.get("LICENSE")
26
+
27
+ # Check if the variable exists
28
+ if license is not None:
29
+ print("Value of LICENSE:")
30
+ else:
31
+ license = ""
32
+ try:
33
+ with open(licensePath, 'r') as file:
34
+ license = file.read().strip()
35
+ except IOError as exc:
36
+ print("failed to open license.txt: ", exc.errno)
37
+ print("license: ", license)
38
 
39
  ret = encoder.setActivation(license.encode('utf-8'))
40
  print("\nactivation: ", ret)