Programming :: Python - Call Function From The Command Line After Compile The Program?
Dec 28, 2010If i have a python file with a function call_me(a,b),how can I call this function from the command line ,after i compile the program?
View 5 RepliesIf i have a python file with a function call_me(a,b),how can I call this function from the command line ,after i compile the program?
View 5 Repliesi've gotten my fedora 12 to the point where i can run python3 scripts from command line and can call up python 2.6.2 idle with the command 'idle' from command line. what command will call up python3 (3.1.2 to be exact) idle?
View 5 Replies View RelatedThe following is the UDP client code I am using.
Code:
Even the server is down, sendto function is not returning -1.
Instead, it is returning the length of the message as if it is success.
i have ubuntu 10.04 and python 2.6 installed how do i run, stop or restart a .py file from the command line.
btw im using Putty from a windows computer
In practice I have a script that call a java program that call a linux system command. The script if I run it, from a shell functions well,so it is not a java problem. The problem come out when i put this script in a crontab schedulation. The result in this case is that java do not execute the system command. I think it depends on crontab
View 4 Replies View RelatedI've got the "OpenCryptoKi" project source from "sourceforge.net" at here:But I don't know how should I compile and build it by "GCC" or "Make"?!I have ubuntu 9.04 and I've set the linux runlevel at 3, but I'm not so familiar with compiling such project at commandline environment of linux
View 6 Replies View RelatedI have C++ source code(*.cpp) files that expects it's header files in System's include folder which is/usr/include.The cpp files has include lines like this:
Code:
#include <some.h>
#include <another.h>
[code]...
curl: try 'curl --help' or 'curl --manual' for more information so here curl is working when I'm trying php test.php I got: PHP Fatal error: Call to undefined function: curl_init() in /root/test.php on line 142
Also in php.ini is missing extension=php_curl.dll but I added and the same problem
I am wanting to write a program that runs a program or command-line. Is there are way of making a program that activates a command-line (for example executing 'ps -a -f' or '/home/shared/fah').
In addition to that, I want the program to do a 'ps -a -f' and put the results in a buff, how could I do this.
I thought about this a while ago when reading through a Python tutorial and I googled some and couldn't find an answer. Now I want to know it for Ruby, also, and it's more important now because I want to invoke Ruby with -w.
How can you use:
Code:
with a -w option to ruby, like:
Code:
This doesn't work and I can't find an explanation of how to do it.
Code:
I am trying a scenario for calling a shell script when ever a trigger is called. Can some one guide me how to achieve this scenario. Also it should passes the value from the table to the shell script. Can some one explain me along with the example.
View 2 Replies View RelatedI got two cgi shell scripting files. Is it possible when i am in file 1, to call a function from file 2?
View 2 Replies View RelatedI'm looking for a way to launch "TRIM" commands to a SSD drive myself, from a c++ code I'm going to write, for flash erasing an SSD drive (and not to wait for others things that "should do it automatically in some circumstances if this or this, this and this have been enabled and [..]" but will never tell me if it worked or not
I know there is thousands of complicated ways to test and check if it worked, and also software that needs money to do so, that's why I just want to call myself the TRIM functions and read the return value (like true or false) in order to know if it worked !
Where I can find the c++ call that could permit me to do so ? I heard about the GLibC that gives a way to access every user space function related to Linux Kernel (poll, select and others) as standard c++ functions, I suppose that, if there is a way, it will be on the GLibC but how to find it ?
Am getting errors about "mysql_connect()" for the following code:
Have compiled PHP with MySQL support using the following:
Thought PHP 5.3 has a built-in replacement called mysqlnd, and there's no need to install "php-mysql" RPM.
However, according to the following site this is still required: [url]
Give me an idea whether I really have to install php-mysql RPM in order to use mysql_connect() for PHP?
But it's been hell finding an answer, or I just don't know what to look for..I have a prompt that asks for a float, and if the user doesn't put in a valid number, then it should die with an error message.
Code:
def die_with_error():
print 'ERROR: You didn't specify a valid number!'
[code]....
I am writing a function(in C language in Linux) to initialize an array of a structure from a mysql table by calling a function by reference but I have a problem with call this function by reference . this is my program:PHP Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
[code]...
I want to be able to do
sudo ./program.py
instead of always having to do
sudo python program.py
What do I need to change?
I'm trying to teach myself python (from Learn Python the hardway e-book) but am struggling to grasp the concepts of Classes etc. Part of exercise 43 is to rewrite the game / create a new game with classes for each room etc. So I'll show you my code so far and explain at the bottom my problem
Code:
#ex43a.py
from sys import exit
[code]....
I am exploring the Python 3 standard library and am currently attempting to test the bin function. It converts an integer into a binary string. I believe the module I wrote is flawed somehow. Here's the source code:
Code:
#!/usr/bin/python3.1
#This module tests the bin() function.
import sys
def get_input():
x = input("Enter an integer: ")
def use_bin():
[code]....
As you can see, the binary form given is always 0b10111. I'm no expert on binary code (or hexadecimal notation), but surely 9000 and two would have different results?
EDIT: Added a line in the module to repeat back what integer the user entered, and then the binary form. It would appear that no matter what integer the user enters, Python thinks it's "23".
Example output:
Code:
>>>
Enter an integer: 1
You entered 23
The binary form of this integer is 0b10111
>>>
I'm a bit new to Python programming and hoped that someone might be able to help with a problem I'm having. What I essentially want to do is to combine two text files line for line. I know how to do this in a bash script so to give you a better idea here's the code for that:
Code:
This is basically for adding on values to the end of a CSV file that uses ';' as the delimiter. So say file1 said:
And file2 said:
Then running this command would create merged_file1_and_file2 which would be:
The code I'm using at the moment is:
Code:
As I'm sure any experienced python programmer will see, this prints out the first line of the file "csvraw" and then all of the lines of "stamps" and then the remainder of "csvraw".
What I'd like to do is something like: (pseudo code, I know it's not python ;-))
Code:
Is this possible? I've tried googling and my Python Pocket Reference hasn't been much help. I've looked at pickling but that doesn't seem appropriate.
i want compile function c to java under linux. the bashfile comp :
$ cc -fpic -c $(SRCS)
$ ld -shared $(OBJS) -o module.so
i see in www.swig.org
$ comp -java example.i # line 1
$ gcc -c example.c example_wrap.c -I/usr/java/jdk1.6.0_17/include -I/usr/java/jdk1.6.0_17/include/linux # line 2
$ gcc -shared example.o example_wrap.o -mno-cygwin -Wl,--add-stdcall-alias -o example.so #line 3
error line 3 :
/usr/bin/ld: unrecognized option '--add-stdcall-alias'
/usr/bin/ld: use the --help option for usage information collect2: ld returned 1 exit status
I have a script that i want to add some functionality to, but im new to python. Right now it runs command line as ./script https://server user passwd verbose , which returns alot of informtion. I would like it to be able to only return information for a particular function when a flag is passed. exp: ./script https://server user passwd verbose -m (for memory only)
Under the ClassesToCheck section are the different things that can be retrieved. I would like that when you run the script as ./script https://server user passwd verbose -m, it returns only the 'Memory' info. -c would be for 'CPU', etc... Also, i would like the OK at the end of the script to be the first line that is return in the output instead of the last.
i am new to python programing and i have a couple of ?'s
1- what would i do if i needed to find the closest, bigger number, from a list of numbers when the user types a number in.
2- (windows) i need a program that can compile .py files into a .exe file so that it works on a machine without python it also needs to work with python 3.2.
I've been working in a program in BASH and would like to measure its efficiency in different machines. Of course I am able to display the date at the beginning and at the end of its execution, but I'd rather use some sort of timer function to measure in seconds its speed. Is there any timer function available through command line?
View 6 Replies View Relatedfrom the commend line i went to compile the c program by giving the commend "gcc first.c -o first" but the commend line showing gcc is not found. iam using fedora 13 pls tell me what can i do to compile the program. the program i used to compile is below
#include<stdio.h>
main()
{
How do I kill a python application from the command line? For an example I have 2 applications running. The first is bleachbit and the second is furiusisomount. They are both python applications so they both come up as python under process name. I could kill them by ID number but if there was another way to do it so that it could be automated in a bash script.
View 9 Replies View RelatedI had problems with python stuff and so update manager did not work. Also many other problems, PiTiVi was installed but did not start eg... After many trials of this and that I removed python-gtk2 and so also ubuntu desktop. But was unable to get it back. Now I cannot even shut down. While it is not possible to install desktop or anything else, would it be possible to fix this by upgrading the whole system to 10.04 (10.10?)? Would it fix python installation. How could I do it. Some info tells to change sources.list and run apt-get upgrade, but some tell not to do so.
t@t:~$ update-manager
Traceback (most recent call last):
File "/usr/bin/update-manager", line 26, in <module>
[code]....
I have added mkalias in my .bashrc file as I learnt here
[Code]...
I need to write a program for time. like i have 2 tasks both minutes and hours.
like this
1st task=5 hours and 30 minutes
2nd task=2hours and 45 minutes
Together they will take 8 hours and 15 minutes.
I need to write a program thats called ADDTIMES to do something like this.
This is what i have so far.
H1=int(input("enter the number of hours:")) etc..
I am going to compile and install my first linux application from the command line. The program is the port scanner program NMAP, and I am looking at the documentation to learn how to do it. I saw this thread [URL], and I just want to make sure I understand what it is I'm doing.
bzip2 -cd nmap-5.35DC1.tar.bz2 | tar xvf -
cd nmap-5.35DC1
./configure
make
su root
make install
"bzip2 -cd nmap-5.35DC1.tar.bz2 | tar xvf -"
Here I am calling the bzip2 program to work with a specified file. look for the file nmap-5.35DC1.tar.bz2 in the current diretory (-cd) and to pipe (redirect) something, this is where I get lost, I think. And I know what x & v mean but not f, or what that has to do with the previous commands.
cd nmap-5.35DC1
Chage to the named directory.
./configure
I assume this is a command?
make
Builds an executable
su root
make install
not sure what the difference is between this and the above.