Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > PYTHON Development
  New Posts New Posts
  FAQ FAQ  Forum Search   Register Register  Login Login

QTCF.dll Issues [Solved]

 Post Reply Post Reply
Author
Message
ShawnFrueh View Drop Down
Member
Member
Avatar

Joined: 2013 Jan 26
Location: Minneapolis
Online Status: Offline
Posts: 136
Post Options Post Options   Quote ShawnFrueh Quote  Post ReplyReply Direct Link To This Post Topic: QTCF.dll Issues [Solved]
    Posted: 2014 Oct 27 at 5:52pm
I seem to be having some issues with the qtguiagent.exe file. Using python I am launching a powershell script to kill Cinema 4D, swap plugins and then restart Cinema. The issue I have is when I am restarting cinema. I get a:
"QTCF.dll is missing from your computer. error"

On my local testing machine everything runs fine if I place the QTCF.dll in the main cinema folder. Has anyone run into this problem? Each machine is using windows 8.1 and I am guessing (A big guess) that the issue is when killing Cinema the qtguiagent.exe is not being completely killed? I have also tried adding that to the powershell code but no luck.

Would it also have to do with using subprocess to call powershell? This is how I set it up:
subprocess.Popen([PowershellPath,'-ExecutionPolicy','Unrestricted',CodeFromCinemaToRunInPS])
does Being a subprocess hold back the completion of the process killing? If so how should something like this be handled? 


Edited by ShawnFrueh - 2014 Oct 30 at 9:49am
Back to Top
wbeh View Drop Down
Member
Member


Joined: 2009 Sep 12
Location: Germany
Online Status: Offline
Posts: 245
Post Options Post Options   Quote wbeh Quote  Post ReplyReply Direct Link To This Post Posted: 2014 Oct 28 at 12:45am
Originally posted by ShawnFrueh

I seem to be having some issues with the qtguiagent.exe file. Using python I am launching a powershell script to kill Cinema 4D, swap plugins and then restart Cinema. The issue I have is when I am restarting cinema. I get a:
"QTCF.dll is missing from your computer. error"
On my local testing machine everything runs fine if I place the QTCF.dll in the main cinema folder. Has anyone run into this problem? Each machine is using windows 8.1 and I am guessing (A big guess) that the issue is when killing Cinema the qtguiagent.exe is not being completely killed? I have also tried adding that to the powershell code but no luck.
Would it also have to do with using subprocess to call powershell? This is how I set it up:
subprocess.Popen([PowershellPath,'-ExecutionPolicy','Unrestricted',CodeFromCinemaToRunInPS])
does Being a subprocess hold back the completion of the process killing? If so how should something like this be handled? 


"QTCF.dll" is a dll of Quicktime's installation, not of Cinema or the qtguiagent (and neither of them loads this dll directly). Chances are that your restart mechanism (or the libs/shells involved with it) fiddles with the start path or the environment of Windows in a way that QuickTime can't find its own dlls. I think that 's the direction you should have a look at...

Best regards,

Wilfried
Back to Top
ShawnFrueh View Drop Down
Member
Member
Avatar

Joined: 2013 Jan 26
Location: Minneapolis
Online Status: Offline
Posts: 136
Post Options Post Options   Quote ShawnFrueh Quote  Post ReplyReply Direct Link To This Post Posted: 2014 Oct 28 at 7:41am
Thanks for the input Wilfried

The restart happens when I use python to write a ps1 file (powershell) and run it using subprocess. The code for the restart running in powershell is:
Start-Process 'C:\Program Files\MAXON\Cinema R16\CINEMA 4D.exe'
 
This works completely fine when running strait through powershell, no Cinema involved, and runs without error. As soon as I run the same code but this time through Cinema I get the error. 

What makes me wonder is how some of the computers won't have this problem while others will. (The setup and program versions are all the same(latest))

When I get the chance I will post a simple version of the script to see if any of you can figure it out.
Back to Top
ShawnFrueh View Drop Down
Member
Member
Avatar

Joined: 2013 Jan 26
Location: Minneapolis
Online Status: Offline
Posts: 136
Post Options Post Options   Quote ShawnFrueh Quote  Post ReplyReply Direct Link To This Post Posted: 2014 Oct 28 at 11:43am
Ok here is the script stripped down: 
import c4d, subprocess,os,sys
from c4d import gui

# Get Cinemas Process ID for murder
PID = str(os.getpid())

# Cinema's EXE file for restart
app = ("'"+c4d.storage.GeGetStartupApplication()+"'")

# Get users document path
DocPath = c4d.storage.GeGetC4DPath(c4d.C4D_PATH_MYDOCUMENTS)

# Check and create a powershell file in your documents path
if not os.path.exists(DocPath+"\C4D_Restart.ps1"):
    f = open(DocPath+"\C4D_Restart.ps1","w")
    f.write("")
    f.close()
else:
    pass

# Path to Powershell program
PSPath = r'C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe'

# path to the created code.
Wpath = r""+DocPath+"\C4D_Restart.ps1"

# Code to write into the Powershell file.
ps1 = r"Stop-Process "+PID+"\nStart-Sleep -Seconds 2\n\nStart-Process "+app+"\n"

# Write to powershell file
f = open(Wpath,"w")
f.write(ps1)
f.close()

# Run powershell
subprocess.Popen([PSPath,'-ExecutionPolicy','Unrestricted',Wpath])

You may need to enable Powershell's scripts to run buy running Powershell as admin and run this:
set-executionpolicy unrestricted
Back to Top
spedler View Drop Down
Member
Member


Joined: 2008 Apr 19
Location: United Kingdom
Online Status: Offline
Posts: 680
Post Options Post Options   Quote spedler Quote  Post ReplyReply Direct Link To This Post Posted: 2014 Oct 28 at 1:59pm
If you start and stop processes like that, you may run into problems. Take a look in task manager after you run this script a few times, there's a good chance you have multiple instances of qtguiagent.exe running. That could be the cause of the problem.

I really wouldn't force a process to halt in that way - better to find a way to make Cinema shut down correctly.
Back to Top
wbeh View Drop Down
Member
Member


Joined: 2009 Sep 12
Location: Germany
Online Status: Offline
Posts: 245
Post Options Post Options   Quote wbeh Quote  Post ReplyReply Direct Link To This Post Posted: 2014 Oct 29 at 3:42am
Originally posted by spedler

If you start and stop processes like that, you may run into problems. Take a look in task manager after you run this script a few times, there's a good chance you have multiple instances of qtguiagent.exe running. That could be the cause of the problem.

I really wouldn't force a process to halt in that way - better to find a way to make Cinema shut down correctly.


No that doesn't matter. Each instance of Cinema starts its own qtguiagent (it 's necessary due to the single-threaded nature of QT). If the Cinema process is killed without properly ending the qtguiagent, this qtguiagent will wait for pipe input without ever getting data but it won't conflict with newer instances of Cinema or other qtguiagents (so nothing to worry about).

Best regards,

Wilfried
Back to Top
wbeh View Drop Down
Member
Member


Joined: 2009 Sep 12
Location: Germany
Online Status: Offline
Posts: 245
Post Options Post Options   Quote wbeh Quote  Post ReplyReply Direct Link To This Post Posted: 2014 Oct 29 at 3:49am
Originally posted by ShawnFrueh

Thanks for the input <span style="line-height: 16.7999992370605px; : rgb248, 248, 252;">Wilfried</span>. 
The restart happens when I use python to write a ps1 file (powershell) and run it using subprocess. The code for the restart running in powershell is:
Start-Process 'C:\Program Files\MAXON\Cinema R16\CINEMA 4D.exe'
 
This works completely fine when running strait through powershell, no Cinema involved, and runs without error. As soon as I run the same code but this time through Cinema I get the error. 
What makes me wonder is how some of the computers won't have this problem while others will. (The setup and program versions are all the same(latest))
When I get the chance I will post a simple version of the script to see if any of you can figure it out.


Shawn, you could try setting the current (or active) directory before starting Cinema from the shell/python to make sure the Windows DLL loader is using the same paths like when starting the app from the explorer - but with these experiments you're on your own (it 's outside of the SDK scope).

Best regards,

Wilfried
Back to Top
ShawnFrueh View Drop Down
Member
Member
Avatar

Joined: 2013 Jan 26
Location: Minneapolis
Online Status: Offline
Posts: 136
Post Options Post Options   Quote ShawnFrueh Quote  Post ReplyReply Direct Link To This Post Posted: 2014 Oct 29 at 7:10am
Thanks for the replies Wilfried and Spedler.

A force shutdown is required, when Cinema is shut down correctly (using quit or just closing Cinema) the process will hang in the task manager due to some beta plugins such as Octane and CarbonScatter.

Setting paths sounds like a decent place to start troubleshooting, thanks Wilfried!
Back to Top
spedler View Drop Down
Member
Member


Joined: 2008 Apr 19
Location: United Kingdom
Online Status: Offline
Posts: 680
Post Options Post Options   Quote spedler Quote  Post ReplyReply Direct Link To This Post Posted: 2014 Oct 29 at 12:00pm
Originally posted by wbeh


No that doesn't matter. Each instance of Cinema starts its own qtguiagent (it 's necessary due to the single-threaded nature of QT). If the Cinema process is killed without properly ending the qtguiagent, this qtguiagent will wait for pipe input without ever getting data but it won't conflict with newer instances of Cinema or other qtguiagents (so nothing to worry about).

Best regards,

Wilfried


Thanks Wilfried, I always wondered about that. Good to know that it isn't causing a problem.

Steve
Back to Top
ShawnFrueh View Drop Down
Member
Member
Avatar

Joined: 2013 Jan 26
Location: Minneapolis
Online Status: Offline
Posts: 136
Post Options Post Options   Quote ShawnFrueh Quote  Post ReplyReply Direct Link To This Post Posted: 2014 Oct 30 at 9:49am
Taking a look into file paths I discovered that the qtguiagent.exe file is in fact not the one in the QuickTime installation but rather in cinemas win32 directory:
C:\Program Files\MAXON\Cinema R16\resource\libs\win32
Here is where the QTCF.dll file should be place and everything runs as planned.

I have not checked to see if this effects QuickTime files in Cinema. If someone finds that it does, please report back.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.094 seconds.