Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Raised during long export #48

Open
edmundsj opened this issue Feb 16, 2022 · 1 comment
Open

Error Raised during long export #48

edmundsj opened this issue Feb 16, 2022 · 1 comment

Comments

@edmundsj
Copy link

I am trying to export a sequence in premiere using pymiere, and it's chugging along nicely until after about 3 minutes, I get the following error:

Traceback (most recent call last):
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 449, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 444, in _make_request
    httplib_response = conn.getresponse()
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1345, in getresponse
    response.begin()
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 276, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 440, in send
    resp = conn.urlopen(
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 785, in urlopen
    retries = retries.increment(
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\retry.py", line 550, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\packages\six.py", line 769, in reraise
    raise value.with_traceback(tb)
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 449, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 444, in _make_request
    httplib_response = conn.getresponse()
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1345, in getresponse
    response.begin()
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 276, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Jordan\My Drive\GTD\YouTube\Automation\pymiere_test.py", line 19, in <module>

  File "C:\Users\Jordan\My Drive\GTD\YouTube\Automation\video_maker.py", line 32, in make
    sequence = self.get_sequence_from_clip_array(clip_array)
  File "C:\Users\Jordan\My Drive\GTD\YouTube\Automation\video_maker.py", line 80, in export_sequence
    def export_sequence(self, sequence):
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\site-packages\pymiere\objects\premiere_objects.py", line 1315, in exportAsMediaDirect
    return self._eval_on_this_object("exportAsMediaDirect({}, {}, {})".format(_format_object_to_es(outputFilePath), _format_object_to_es(presetPath), _format_object_to_es(workAreaType)))
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\site-packages\pymiere\core.py", line 176, in _eval_on_this_object
    result = _eval_script_returning_object(line)
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\site-packages\pymiere\core.py", line 472, in _eval_script_returning_object
    result = eval_script(script, decode_json=True)
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\site-packages\pymiere\core.py", line 97, in eval_script
    response = requests.post(PANEL_URL, json={"to_eval": "try{\n" + code + "\n}catch(e){e.error=true;ExtendJSON.stringify(e)}"})
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 117, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\Jordan\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 501, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

I'm not sure what to make of it. Does premiere become non-responsive during export to whatever protocol is being used to query it? Is there a relatively painless workaround here, or a way to explicitly re-establish communication?

@luis10barbo
Copy link

Idk if you still need it but i made a simple workaround :

  • Create a never ending loop
  • Write "pymiere.objects.app" -> this will check if a connection can be established, if not, return an exception. Because it returns an exception when failed, which is something that would end the loop, you need to write it inside an "try" block
  • At the end of the "try" block, you return to quit the loop and the function
  • at the exception you could write any function that tells you the connection wasn't made
import pymiere
import logger # could switch logger functions for print()

def check_if_premiere_alive(TIMEOUT=2) -> bool: # Returns True if connection is established
            is_first_check = True
            while 1:
                # Loops infinitely til Adobe Premiere Pro communication is re-established
                try:  # (pymiere.objects.app) will return an exception and end loop if no conection could be established, so try is necessary, i guess?
                    pymiere.objects.app
                    logger.info("Adobe Premiere Pro connection estabilished") # No exception was returned, which means that a connection could be established (Video finished rendering/Premiere has open)
                    return True # Ends loop
                except:
                     if is_first_check == True:
                         # Connection error message. Will only show once to avoid spam
                         logger.error("Adobe Premiere Pro connection couldn't be established, maybe the program is not open")
                         is_first_check = False
                 
                time.sleep(TIMEOUT) # Possibly unnecessary delay?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants