Python Forum
FileNotFoundError...System cannot find the path specified - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: FileNotFoundError...System cannot find the path specified (/thread-17172.html)

Pages: 1 2 3


FileNotFoundError...System cannot find the path specified - alex9745 - Apr-01-2019

I am new to programming and am trying to run some code. I am getting the following error:

adding screen shot -

https://imgur.com/CqPVaCE



some one plz help me

Thank you for your attention in this matter. Heart


RE: [python]FileNotFoundError...System cannot find the path specified - buran - Apr-01-2019

Please, don't post images of code and/or traceback.
Post your code in python tags, full traceback - in error tags.
See BBcode help for more info.


script error - alex9745 - Apr-01-2019

I am new to programming and am trying to run some code. I am getting the following error:

Traceback (most recent call last):
File "C:\Users\admin\Desktop\sunnxt.py", line 35, in <module>
mp4_data = subprocess.check_output ([mp4dump, '--format', 'json', '--verbosity', '3', FInput])
File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 336, in check_output
**kwargs).stdout
File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 403, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 707, in __init__
restore_signals, start_new_session)
File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 992, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified


some one please help me


RE: [python]FileNotFoundError...System cannot find the path specified - snippsat - Apr-01-2019

You should post code(sunnxt.py) and not just Traceback.
Looking at it so are there two places that may need an absolute Path mp4dump and FInput
If have mp4dump in Windows Path,then may not need an absolute Path as i use in this test.
I can do a test,and also convert output to json data you can use.
import subprocess
import json

file_in = r'E:\div_code\mp4\Sample.mp4'
mp4_data = subprocess.check_output([r'E:\div_code\mp4\mp4dump.exe', '--format', 'json', '--verbosity', '3', file_in])
mp4_data = mp4_data.decode()
json_data = json.loads(mp4_data)
Test usage it's now a dictionary and when coming from json is normal to also have list mixed in.
>>> json_data[0]
{'compatible_brand': 'isom',
 'header_size': 8,
 'major_brand': 'M4V ',
 'minor_version': 1,
 'name': 'ftyp',
 'size': 28}
>>> json_data[3]
{'header_size': 24,
 'name': 'BE7ACFCB97A9-42E8-9C71-9994-91E3AFAC',
 'size': 1650}
>>> json_data[0]['major_brand']
'M4V '
>>> 



RE: [python]FileNotFoundError...System cannot find the path specified - alex9745 - Apr-02-2019

code

# -*- coding: utf-8 -*-
from subprocess import call
import subprocess
import re
import xmltodict
import json
import re
import requests
import base64
import time
import os
import argparse
import binascii
import configparser
import sys
from requests import Request, Session

currentFile = __file__
realPath = os.path.realpath(currentFile)
dirPath = os.path.dirname(realPath)
dirName = os.path.basename(dirPath)
wvDecrypterexe = dirPath + "/binaries/wvDecrypter.exe"
challengeBIN = dirPath + "/binaries/challenge.bin"
licenceBIN = dirPath + "/binaries/licence.bin"
mp4dump = dirPath + "/binaries/mp4dump.exe"

if os.path.isfile(challengeBIN) : os.remove (challengeBIN)
if os.path.isfile(licenceBIN) : os.remove (licenceBIN)

WV_SYSTEM_ID = 'ed ef 8b a9 79 d6 4a ce a3 c8 27 dc d5 1d 21 ed'
FInput = "encryptedvideo.mp4"
FOutput = "decryptedvideo.mp4"
KID = "a4c1cdo8-39eb-58el-b646-8bfdf427e60a"
pssh = None
mp4_data = subprocess.check_output ([mp4dump, '--format', 'json', '--verbosity', '3', FInput])
mp4_data = json.loads(mp4_data)


for atom in mp4_data:
    if atom['name'] == 'moov':
        for child in atom['children']:
            if child['name'] == 'pssh' and child['system_id'] == f'[(WV_SYSTEM_ID)]':
                pssh = re.sub(r'^\[08 01 ([a-f0-9 ]+)\]$', r'\1', child['data'])
                pssh = re.sub(r'\8+', '', pssh)
                pssh = pssh.strip('[]')
                pssh = base64.b64encode (binascii.unhexlify(pssh)).decode('utf-8')
                print(f'PSSH: (pssh)')
                break 
				
				
				
				
if not pssh:
    print('unable to extract PSSSH')
    sys.exit(1)

PSSH = pssh
CERTIFICATE = ""
cookies = ""
token = ""
licurl = "https://www.sunnxt.com/content/license/?content_id=70994="



wvdecrypt_video = subprocess.Popen([wvDecrypterexe, '--kid',KID, '--pssh', PSSH, '--certificate', CERTIFICATE, '--input', FInput, '--output', FOutput, '--debug'])
time.sleep(5)

with open(challengeBIN,"rb") as fd:
        challenge_decoded =fd.read()

data = challenge_decoded
		
headers = {

'accept': '*/*',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8',
'content-length': '4623',
'cookie': '_ga=GA1.2.975246051.1552289966; _fbp=fb.1.1552290075724.1403904187; _gid=GA1.2.396418812.1554157407; laravel_session=FjoUcOZyhVfX6dc39N85kGddMKV0DROVRS7wZLbU; _gat=1; mp_8417b02dcd9f6d45a5d3a0a7eadb1c4b_mixpanel=%7B%22distinct_id%22%3A%209176320%2C%22%24device_id%22%3A%20%221696bb128e0163-0af1f5159fe13b-3e3d5200-15f900-1696bb128e1f9%22%2C%22%24initial_referrer%22%3A%20%22https%3A%2F%2Fwww.google.com%2F%22%2C%22%24initial_referring_domain%22%3A%20%22www.google.com%22%2C%22__mps%22%3A%20%7B%7D%2C%22__mpso%22%3A%20%7B%7D%2C%22__mpus%22%3A%20%7B%7D%2C%22__mpa%22%3A%20%7B%7D%2C%22__mpu%22%3A%20%7B%7D%2C%22__mpr%22%3A%20%5B%5D%2C%22__mpap%22%3A%20%5B%5D%2C%22%24search_engine%22%3A%20%22google%22%2C%22data%20Connection%22%3A%20%22NULL%22%2C%22city%22%3A%20%22%22%2C%22country%22%3A%20%22India%22%2C%22gps%22%3A%20%22NULL%22%2C%22session%20id%22%3A%20%22NULL%22%2C%22email%20id%22%3A%20%22ambadysuresh9745%40gmail.com%22%2C%22mobile%20no%22%3A%20%22NULL%22%2C%22Device-ID%22%3A%20%22NULL%22%2C%22%24user_id%22%3A%209176320%2C%22user%20id%22%3A%209176320%7D; XSRF-TOKEN=eyJpdiI6IlRaY2J6dm5tTHJuY0pNV3NrV0hqYnc9PSIsInZhbHVlIjoiRENlMzdEQ1VpTWxnMXhGWHRhdHhcL0VZc3ZQM016QnNVR2tRZ1QwM3psQm02MnhRMFk1Q1hMWUs4ZXFDeWk2ZU9oSGI1clE2cnp3aERjSWNcL3hOUHNUdz09IiwibWFjIjoiNWY2ZjM2MDc3ZmMyNWU1ODUxMDY4YmNjZThkN2FhMGMzYjAwYWQ4ZjljYzY3MDhmNTNjMjg0MmE0MDU0MmY1MiJ9',
'origin':'https://www.sunnxt.com',
'referer': 'https://www.sunnxt.com/movie/detail/6604/Nela-Ticket/',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36',
}

		
		
		
print("\nSending POST request to license url...\n")
resp = requests.post(url=licurl, data=data, headers=headers)
license_decoded = resp.content
print(license_decoded)
licenseb64 = base64.b64encode(license_decoded)	

with open(licenceBIN, "wb") as ld:
	ld.write(license_b64)
	
stdoutdata, stderrdata = wvdecrypt_video.communicate()

if str(wvdecrypt_video.returncode) == "0":
	os.remove(challengeBIN)
	os.remove(licenceBIN)



RE: [python]FileNotFoundError...System cannot find the path specified - alex9745 - Apr-02-2019

some one please help


RE: [python]FileNotFoundError...System cannot find the path specified - snippsat - Apr-02-2019

Give absolute(full path) to these as i shown in my code.
FInput = "encryptedvideo.mp4"
FOutput = "decryptedvideo.mp4"



RE: [python]FileNotFoundError...System cannot find the path specified - alex9745 - Apr-02-2019

(Apr-02-2019, 08:07 AM)snippsat Wrote: Give absolute(full path) to these as i shown in my code.
FInput = "encryptedvideo.mp4"
FOutput = "decryptedvideo.mp4"

dont understand i already put full script


RE: [python]FileNotFoundError...System cannot find the path specified - DeaD_EyE - Apr-02-2019

Both are relative paths. A relative path depends on the current working directory.
If your cwd is in /home/user and your files are in /home/user/video, the relative path should
be 'video/encryptedvideo.mp4' or better a absolute path: '/home/user/video/encryptedvideo.mp4'


RE: [python]FileNotFoundError...System cannot find the path specified - alex9745 - Apr-02-2019

(Apr-02-2019, 08:07 AM)snippsat Wrote: Give absolute(full path) to these as i shown in my code.
FInput = "encryptedvideo.mp4"
FOutput = "decryptedvideo.mp4"

encryptedvideo.mp4 - C:\Users\admin\Music\source.mp4


decryptedvideo.mp4 - C:\Users\admin\Music

full path