aditya shukla escribió:
How can we convert .py files to batch files? is there any library for this?
Aditya
------------------------------------------------------------------------
-- http://mail.python.org/mailman/listinfo/python-list
Maybe py2exe can help you. 5 6748
On Sep 15, 3:04 pm, Matias Surdi <matiassu...@gm ail.comwrote:
aditya shukla escribió:
How can we convert .py files to batch files? is there any library for this?
Aditya
------------------------------------------------------------------------
-- http://mail.python.org/mailman/listinfo/python-list
Maybe py2exe can help you.
I assume you are on Windows? Let's assume you have a file stuff.py
that reads:
import os
print os.listdir('.') # list current directory, good enough for
testing...
Then, insert the following line at the top:
@setlocal enableextension s & python -x %~f0 %* & goto :EOF
Now save this file as stuff.cmd somewhere along your PATH. Now calling
'stuff' should execute your file.
On Linux, you would instead insert the shebang line that points to
your python interpreter, such as
#!/usr/bin/python
at the top and also set the executable bit, but I suppose if you use
Linux at all you know that.
En Mon, 15 Sep 2008 20:36:05 -0300, Michael Palmer <m_********@yah oo.ca>
escribió:
>aditya shukla escribió:
How can we convert .py files to batch files? is there any library for
this?
I assume you are on Windows? Let's assume you have a file stuff.py
that reads:
import os
print os.listdir('.') # list current directory, good enough for
testing...
Then, insert the following line at the top:
@setlocal enableextension s & python -x %~f0 %* & goto :EOF
Now save this file as stuff.cmd somewhere along your PATH. Now calling
'stuff' should execute your file.
Cool! I'd enclose the first argument in quotes "%~f0" - in case the path
contains any whitespace.
--
Gabriel Genellina
Michael Palmer wrote:
On Sep 15, 3:04 pm, Matias Surdi <matiassu...@gm ail.comwrote:
>aditya shukla escribió:
>>How can we convert .py files to batch files? is there any library for this? Aditya ------------------------------------------------------------------------
<snip>On Linux, you would instead insert the shebang line that points to
your python interpreter, such as
#!/usr/bin/python
at the top and also set the executable bit, but I suppose if you use
Linux at all you know that.
Doh! I'm new to Linux and so I didn't know that, thanks!
One small snag though, it doesn't work on my system :-(
I did both steps, the shebang and the execute bit but nada...
r0g@steppa:~/Desktop/py$ ls
kickstart.py kickstart.py~ kicktest.py kicktest.py~
r0g@steppa:~/Desktop/py$ kickstart.py
bash: kickstart.py: command not found
Any ideas why this might be? A path thing? I'm on Ubuntu 8.04 / Py2.5
Thanks,
Roger.
On 2008-09-17, r0g <ai******@techn icalbloke.comwr ote:
r0g@steppa:~/Desktop/py$ ls
kickstart.py kickstart.py~ kicktest.py kicktest.py~
r0g@steppa:~/Desktop/py$ kickstart.py
bash: kickstart.py: command not found
Any ideas why this might be?
Yes.
A path thing?
Yes.
Linux systems generally don't have the current directory in the
PATH that's searched for executbles (it's regarded as a rather
serious security problem if you do).
Try doing this:
./kickstart.py
--
Grant Edwards grante Yow! Look into my eyes and
at try to forget that you have
visi.com a Macy's charge card!
Grant Edwards wrote:
On 2008-09-17, r0g <ai******@techn icalbloke.comwr ote:
>r0g@steppa:~/Desktop/py$ ls kickstart.py kickstart.py~ kicktest.py kicktest.py~ r0g@steppa:~/Desktop/py$ kickstart.py bash: kickstart.py: command not found
Any ideas why this might be?
Yes.
>A path thing?
Yes.
Linux systems generally don't have the current directory in the
PATH that's searched for executbles (it's regarded as a rather
serious security problem if you do).
Try doing this:
./kickstart.py
Brilliant! :D Thanks v.much for that, turns out the very same thing had
been driving me nuts a few days earlier when I was trying to run an
installer I had downloaded, bit of an Izzard Printer moment LOL - http://www.youtube.com/watch?v=2wHEqDepAXo
Thanks again!
Roger. http://www.technicalbloke.com http://movingtoubuntu.technicalbloke.co.uk This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bernhard Sollfrank |
last post by:
Hello,
i have to start a batch process from a dll to transfer
files created by this dll to remote ftp server. I created
a batch file:
ftp -n -v -i -s:D:\batch\ftpcmds.txt ftp-server
and a file containing the ftp commands:
|
by: Herb Stevenson |
last post by:
Hello all. I need to set up a batch file to work w/ the Visual Studio.NET
2003 command prompt. However, when I run the batch file it uses the
standard command prompt. Is there a way to differentiate batch files
between the two prompts? Also, where might I find information on the
differences between the 2 prompts?
Thanks,
Herb
|
by: erniedude |
last post by:
Hi,
I'm a newbie and I was wondering if anyone knew a (Python) script to
run 4 batch files, one after the other (assuming the directories are
known). It would be better if all 4 batch files could run
simultaneously, but that might break Windows... ;) The problem I had
was I couldn't get the files to RUN, only to OPEN. Thanks for the
help!!!
pseudo-code looks like this
|
by: j.a. harriman |
last post by:
Hi,
On MSDN I know there is a JScript example (Upgrading Visual C++ Projects to
Visual Studio .NET in Batch Mode) to upgrade VS6 C++ projects to .NET
solutions.
It converts the project files (*.dsp), but doesn't create the solution
(*.sln) file.
Is there an automated way to convert an existing VS6 C++ *.dsw to a .NET
*.sln?
|
by: Steve Jorgensen |
last post by:
I remember that I used to set up utility batch files, and create Windows
shortcuts to them that would ask the user for parameters to supply to the
batch files. From what I can tell, this functionality simply doesn't exist
anymore in Windows 2000 or above. I did find a work-around to this that I
thought y'all might want to know about.
There are a number of new fetures in batch files available on Windows 2000
including an extended syntax...
| |
by: gwarning! |
last post by:
Goal: Have multiple text files, each of various lengths, be
concatenated together into one final consolidated text file.
Problem: Since the names of the files to be concatenated can change
from day to day, I need to be able to dynamically generate a batch
file to concatenate these files. So far, I have looked at using
FileSearch.FindFiles.Count to determine the number of files so that I
can loop through the files that exist in a...
|
by: Mario Crevits |
last post by:
My name is Mario Crevits, I'm from Belgium (Roeselare) and I'm working with
Access97 for several years now. We are in an Access97-2000 migration
project. I'm writing a wizard for the end-users to automatically find and
convert their Access97 databases on a specific drive.
I want to convert the databases through VBA :
1. create an empty Access2000
2. set the right properties and references
3. import the objects (tables, queries,...
|
by: Charles Neitzel |
last post by:
I'm trying to write a windows application in C# (Using Microsoft Visual C#
2005 Express) that is nothing more than a simple UI with buttons on it. The
buttons do various things like running programs and executing registry
entries. The majority of my buttons work however, I have come upon a problem.
I need a few of the buttons to run DOS batch files, the batch files in turn
run program installers (specifically windows update runtime .exe...
|
by: Charles |
last post by:
I'm trying to write a windows application in C# (Using Microsoft Visual
C#
2005 Express) that is nothing more than a simple UI with buttons on it.
The
buttons do various things like running programs and executing registry
entries. The majority of my buttons work however, I have come upon a
problem.
I need a few of the buttons to run DOS batch files, the batch files in
turn
run program installers (specifically windows update runtime .exe...
|
by: Chris Rebert |
last post by:
On Mon, Sep 15, 2008 at 10:30 AM, aditya shukla
<adityashukla1983@gmail.comwrote:
Unless your Python scripts are essentially just *really basic* shell
scripts that happen to be written in Python, then no, it's not even
possible, much less automated. Python and batch files are just too
vastly different: Python is a general-purpose programming language
with a large standard library; batch files are a castrated version of
bash.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |