I have a script that runs fine in Windows 2003 (32-bit). It basically
calls the Windows defrag command. When I try the exact same code on
Windows 2003 (64-bit) I get the following message:
C:\Scripts>autodefrag.py
Starting defragment: defrag -v C: >>c:/Scripts/DEFRAG20070502.log
'defrag' is not recognized as an internal or external command,
operable program or batch file.
I have tried defrag.exe and even giving it the full path to
defrag.exe. Always the same result. Here is the python code that is
generating this error:
cmd = "defrag -v C: >>c:/Scripts/DEFRAG20070502.log"
print "Starting defragment: ", cmd
errorlevel = os.system(cmd)
Anyone know what the heck is going on and how to fix it? This code
works fine on my 32-bit windows machines.
Thanks. 6 3785 ns********@gmail.com wrote:
I have a script that runs fine in Windows 2003 (32-bit). It basically
calls the Windows defrag command. When I try the exact same code on
Windows 2003 (64-bit) I get the following message:
C:\Scripts>autodefrag.py
Starting defragment: defrag -v C: >>c:/Scripts/DEFRAG20070502.log
'defrag' is not recognized as an internal or external command,
operable program or batch file.
I have tried defrag.exe and even giving it the full path to
defrag.exe. Always the same result. Here is the python code that is
generating this error:
cmd = "defrag -v C: >>c:/Scripts/DEFRAG20070502.log"
print "Starting defragment: ", cmd
errorlevel = os.system(cmd)
Anyone know what the heck is going on and how to fix it? This code
works fine on my 32-bit windows machines.
Thanks.
Sounds like system can't find defrag. Usually this is because of a path
issue. Are you running the script in the foreground or scheduled? Can
you open a command prompt and enter the command and have it work? If
you give full path, this shouldn't be the problem.
-Larry
On May 2, 3:07 pm, Larry Bates <larry.ba...@websafe.comwrote:
nsjmetz...@gmail.com wrote:
I have a script that runs fine in Windows 2003 (32-bit). It basically
calls the Windows defrag command. When I try the exact same code on
Windows 2003 (64-bit) I get the following message:
C:\Scripts>autodefrag.py
Starting defragment: defrag -v C: >>c:/Scripts/DEFRAG20070502.log
'defrag' is not recognized as an internal or external command,
operable program or batch file.
I have tried defrag.exe and even giving it the full path to
defrag.exe. Always the same result. Here is the python code that is
generating this error:
cmd = "defrag -v C: >>c:/Scripts/DEFRAG20070502.log"
print "Starting defragment: ", cmd
errorlevel = os.system(cmd)
Anyone know what the heck is going on and how to fix it? This code
works fine on my 32-bit windows machines.
Thanks.
Sounds like system can't find defrag. Usually this is because of a path
issue. Are you running the script in the foreground or scheduled? Can
you open a command prompt and enter the command and have it work? If
you give full path, this shouldn't be the problem.
-Larry
I have tried foreground and scheduled (neither works). I can run
defrag from the command prompt with no problem. If I give it the full
path in the script it still fails. I am completely befuddled. Help.
minitotoro wrote:
On May 2, 3:07 pm, Larry Bates <larry.ba...@websafe.comwrote:
>nsjmetz...@gmail.com wrote:
>>I have a script that runs fine in Windows 2003 (32-bit). It basically calls the Windows defrag command. When I try the exact same code on Windows 2003 (64-bit) I get the following message: C:\Scripts>autodefrag.py Starting defragment: defrag -v C: >>c:/Scripts/DEFRAG20070502.log 'defrag' is not recognized as an internal or external command, operable program or batch file. I have tried defrag.exe and even giving it the full path to defrag.exe. Always the same result. Here is the python code that is generating this error: cmd = "defrag -v C: >>c:/Scripts/DEFRAG20070502.log" print "Starting defragment: ", cmd errorlevel = os.system(cmd) Anyone know what the heck is going on and how to fix it? This code works fine on my 32-bit windows machines. Thanks.
Sounds like system can't find defrag. Usually this is because of a path issue. Are you running the script in the foreground or scheduled? Can you open a command prompt and enter the command and have it work? If you give full path, this shouldn't be the problem.
-Larry
I have tried foreground and scheduled (neither works). I can run
defrag from the command prompt with no problem. If I give it the full
path in the script it still fails. I am completely befuddled. Help.
Copy and paste the traceback here for us.
-Larry
On May 2, 3:46 pm, Larry Bates <larry.ba...@websafe.comwrote:
minitotoro wrote:
On May 2, 3:07 pm, Larry Bates <larry.ba...@websafe.comwrote:
nsjmetz...@gmail.com wrote: I have a script that runs fine in Windows 2003 (32-bit). It basically calls the Windows defrag command. When I try the exact same code on Windows 2003 (64-bit) I get the following message: C:\Scripts>autodefrag.py Starting defragment: defrag -v C: >>c:/Scripts/DEFRAG20070502.log 'defrag' is not recognized as an internal or external command, operable program or batch file. I have tried defrag.exe and even giving it the full path to defrag.exe. Always the same result. Here is the python code that is generating this error: cmd = "defrag -v C: >>c:/Scripts/DEFRAG20070502.log" print "Starting defragment: ", cmd errorlevel = os.system(cmd) Anyone know what the heck is going on and how to fix it? This code works fine on my 32-bit windows machines. Thanks.
Sounds like system can't find defrag. Usually this is because of a path
issue. Are you running the script in the foreground or scheduled? Can
you open a command prompt and enter the command and have it work? If
you give full path, this shouldn't be the problem.
-Larry
I have tried foreground and scheduled (neither works). I can run
defrag from the command prompt with no problem. If I give it the full
path in the script it still fails. I am completely befuddled. Help.
Copy and paste the traceback here for us.
-Larry
I'm sorry, but I'm not familiar with traceback. How do I use it?
Thanks.
On May 2, 4:15 pm, minitotoro <nsjmetz...@gmail.comwrote:
On May 2, 3:46 pm, Larry Bates <larry.ba...@websafe.comwrote:
minitotoro wrote:
On May 2, 3:07 pm, Larry Bates <larry.ba...@websafe.comwrote:
>nsjmetz...@gmail.com wrote:
>>I have a script that runs fine in Windows 2003 (32-bit). It basically
>>calls the Windows defrag command. When I try the exact same code on
>>Windows 2003 (64-bit) I get the following message:
>> C:\Scripts>autodefrag.py
>>Starting defragment: defrag -v C: >>c:/Scripts/DEFRAG20070502.log
>>'defrag' is not recognized as an internal or external command,
>>operable program or batch file.
>>I have tried defrag.exe and even giving it the full path to
>>defrag.exe. Always the same result. Here is the python code that is
>>generating this error:
>>cmd = "defrag -v C: >>c:/Scripts/DEFRAG20070502.log"
>>print "Starting defragment: ", cmd
>>errorlevel = os.system(cmd)
>>Anyone know what the heck is going on and how to fix it? This code
>>works fine on my 32-bit windows machines.
>>Thanks.
>Sounds like system can't find defrag. Usually this is because of a path
>issue. Are you running the script in the foreground or scheduled? Can
>you open a command prompt and enter the command and have it work? If
>you give full path, this shouldn't be the problem.
>-Larry
I have tried foreground and scheduled (neither works). I can run
defrag from the command prompt with no problem. If I give it the full
path in the script it still fails. I am completely befuddled. Help.
Copy and paste the traceback here for us.
-Larry
I'm sorry, but I'm not familiar with traceback. How do I use it?
Thanks.
Upon further investigation it turned out to be a windohs 64-bit issue
(which is what I was afraid of). I did however find an asinine work
around.
Make a copy of defrag.exe from the system32 folder and paste it in the
same directory as the python script. Voila! It now works. Piece of
junk windohs... :-S
minitotoro <ns********@gmail.comwrote:
> Upon further investigation it turned out to be a windohs 64-bit issue (which is what I was afraid of). I did however find an asinine work around.
Make a copy of defrag.exe from the system32 folder and paste it in the same directory as the python script. Voila! It now works. Piece of junk windohs... :-S
If you are using a 32-bit Python, then all references you make to
\windows\system32 are automatically rewritten to \windows\syswow64. If
defrag.exe is not present in \windows\syswow64, that could explain it.
Unbelievable but true. Although we were all smart enough to handle the
transition from \windows\system in Win16 to \windows\system32 in Win32,
Microsoft apparently believes programmers have all grown too stupid to
handle the transition to Win64 on our own.
Some registry references are also silently rewritten.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Moosebumps |
last post by:
So, after reading some messages about os.system, and looking at the popen
stuff and trying it a bit, I still have not found a way to keep a command
window open for several commands (on Windows...
|
by: mike |
last post by:
regards:
I use Jtidy (api) to translate a HTML file into a "XHTML file".
But The "XHTML file" cannot be identified by nokia 6600.
Do I miss something important?
Or this is Jtidy's weakness or...
|
by: Chris |
last post by:
I posted this in the C# language group, then thought it
might be more appropriate in this group. I would not
cross-post except I want the answer so badly.
I built small C# Web and Web Service...
|
by: freesteel |
last post by:
I have posted about this problem before. SInce then I found a much
better article to help with embedding python in a multithreaded
application:
http://www.linuxjournal.com/article/3641
I...
|
by: miago |
last post by:
Searching this forum I found an example of running Unix commands from Python;I wonder if there is a way to get the output of windows commands on a string using Python.Thanks in advance;
Miago.
|
by: techtonik |
last post by:
Hello, everyb.
Does anybody know simple cross-platform method of probing if
executable binary is available and launching it.
Problem no.1: test if executable file is available
I'll take...
|
by: tmp123 |
last post by:
Hello,
Thanks for your time.
We have very big files with python commands (more or less, 500000
commands each file).
It is possible to execute them command by command, like if the
commands...
|
by: raocheng |
last post by:
Please see the following code.
Suppose I have many shell commands to be executed. And I don't want to
fork a sub shell for each command(eg: status,output =
commands.getstatusoutput(cmd)) because...
|
by: Hishaam |
last post by:
How to execute commands in internal zones of solaris using python
running from the global zone ?
i tried --
1os.popen("zlogin <zone1>")
2os.popen("zonename")
the 2nd command executes back...
|
by: rcook349 |
last post by:
I'm trying to automate our builds and publishes of our Windows application
(deployed to a website via ClickOnce).
I'm getting close, I think, on the commands I need to execute. However, how
do...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |