Hi Folks, my first post here. Sorry to start with a request.
I'm having trouble executing python scripts compiled to byte code on ubuntu feisty server version. Basically I can type ./MyScript.py and the script runs fine but if I compile the script and type ./MyScript.pyc it won't run, I just get some junk characters printed to my terminal that mean nothing.
Now if I type python MyScript.pyc it runs fine. I guess it's a path thing, but I'm not too sure how to solve it.
Silly thing is, on my feisty workstation all works as expected.
Anyone have any ideas how I might fix this problem.
7 6701
Hi Folks, my first post here. Sorry to start with a request.
I'm having trouble executing python scripts compiled to byte code on ubuntu feisty server version. Basically I can type ./MyScript.py and the script runs fine but if I compile the script and type ./MyScript.pyc it won't run, I just get some junk characters printed to my terminal that mean nothing.
Now if I type python MyScript.pyc it runs fine. I guess it's a path thing, but I'm not too sure how to solve it.
Silly thing is, on my feisty workstation all works as expected.
Anyone have any ideas how I might fix this problem.
hi
try changing permission of the .pyc file using - sudo chmod +x MyScript.pyc
and also first line of the script should be
!#/usr/bin/env python
hi
try changing permission of the .pyc file using - sudo chmod +x MyScript.pyc
and also first line of the script should be
!#/usr/bin/env python
Hey thanks for the reply.
Yeah I've done all that, the file executes but not correctly for some reason :(
This is stupid, it works perfectly on 3 other machines but not this one. Fresh install and all :( I even tried compiling on another machine where it works and copying it over but still no go :(
Hey thanks for the reply.
Yeah I've done all that, the file executes but not correctly for some reason :(
This is stupid, it works perfectly on 3 other machines but not this one. Fresh install and all :( I even tried compiling on another machine where it works and copying it over but still no go :(
how r u compiling your script. May be there lies a problem?
I tried this compile.py script - !#/usr/bin/env python
-
import py_compile
-
py_compile.compile("MyScript.py")
and than changed the permission and it worked
how r u compiling your script. May be there lies a problem?
I tried this compile.py script - !#/usr/bin/env python
-
import py_compile
-
py_compile.compile("MyScript.py")
and than changed the permission and it worked
Yeah that how I did it, just from a console though I didn't write a script to do it.
I do $ python
>>> import py_compile
>>> py_compile.compile('libhmi_sys.py')
Then I chmod +x libhmi_sys.pyc
then I try and run it with ./libhmi_sys.pyc
and get: -
root@tilsan1-hmi:/opt/tilsan/hmi# ./libhmi_sys.pyc
-
: command not foundine 1:
-
./libhmi_sys.pyc: line 2: {+Fc: command not found
-
./libhmi_sys.pyc: line 3: dZ
-
Z
-
d: command not found
-
./libhmi_sys.pyc: line 4: syntax error near unexpected token `('
-
./libhmi_sys.pyc: line 4: `Zd
-
jo;eiie Zedjoeie nend
-
djo1eideendjp eideiie Zedjoeie neiie joeid
-
Zeidedjo4djo
-
ndjo e
-
eqqedjoreideide
-
dZeiie
-
ZedjoAedjo4djo
-
ndjo e
-
eqqedjowedjojeide
-
eide eideiie Zedjoeie neqedjoYeideideiie Zedjoeie neqqnedS(iNt:iis/opt/tilsan/hmi/tmp/extInput.jss/opt/tilsan/hmi/hmi_db/s /media/TILSAN-USB/4roller-backups /dev/sdb1cCs
-
tidttidtidttidtittidtdtidtidttd tidtid'
-
^[[?1;2c^[[?1;2croot@tilsan1-hmi:/opt/tilsan/hmi# 1;2c1;2c
-
bash: 1: command not found
-
bash: 2c1: command not found
-
bash: 2c: command not found
-
Does that mean anything to you's guys?
Like I said, on my workstation doing the exact same routine it all works fine :(
Yeah that how I did it, just from a console though I didn't write a script to do it.
I do $ python
>>> import py_compile
>>> py_compile.compile('libhmi_sys.py')
Then I chmod +x libhmi_sys.pyc
then I try and run it with ./libhmi_sys.pyc
and get: -
root@tilsan1-hmi:/opt/tilsan/hmi# ./libhmi_sys.pyc
-
: command not foundine 1:
-
./libhmi_sys.pyc: line 2: {+Fc: command not found
-
./libhmi_sys.pyc: line 3: dZ
-
Z
-
d: command not found
-
./libhmi_sys.pyc: line 4: syntax error near unexpected token `('
-
./libhmi_sys.pyc: line 4: `Zd
-
jo;eiie Zedjoeie nend
-
djo1eideendjp eideiie Zedjoeie neiie joeid
-
Zeidedjo4djo
-
ndjo e
-
eqqedjoreideide
-
dZeiie
-
ZedjoAedjo4djo
-
ndjo e
-
eqqedjowedjojeide
-
eide eideiie Zedjoeie neqedjoYeideideiie Zedjoeie neqqnedS(iNt:iis/opt/tilsan/hmi/tmp/extInput.jss/opt/tilsan/hmi/hmi_db/s /media/TILSAN-USB/4roller-backups /dev/sdb1cCs
-
tidttidtidttidtittidtdtidtidttd tidtid'
-
^[[?1;2c^[[?1;2croot@tilsan1-hmi:/opt/tilsan/hmi# 1;2c1;2c
-
bash: 1: command not found
-
bash: 2c1: command not found
-
bash: 2c: command not found
-
Does that mean anything to you's guys?
Like I said, on my workstation doing the exact same routine it all works fine :(
this is really weired, i have no idea about this, may be someone will post a solution or you can post the solution before anyone does.
Yep seems no one know what's going on. I suspect ubuntu server version of python is borked. It works on any of their other releases, live cd, desktop xubuntu, just doesn't work on their server version.
It's actually not compiling the scripts properly for some reason, because if I compile a script on the server and move the pyc file to my workstation it won't run, yet compiling the same script on my workstation works fine on my workstation but won't run on the server.
This is because you need to install the binfmt-support package - from the package description, it "allows system administrators to register interpreters for
various binary formats based on a magic number or their file extension, and
cause the appropriate interpreter to be invoked whenever a matching file is
executed".
I had this python problem too, and this fixed it for me :-)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Phil |
last post by:
Hi,
I have my create statments for tables, procedures, views, etc in
individual Transact-SQL script files (.sql).
I wnat to write another script file that executes these scripts in the...
|
by: chris.dunigan |
last post by:
I'm looking for an example of how to execute an existing DTS package
from an
ASP (VB)script and would appreciate any and all response. I don't
even
know if it's possible
Thanks
- Chuck...
|
by: Don |
last post by:
I'm trying to run the following page on my desktop from my host
server. It works just fine if I run it from my desktop, but not if I
run it from the server. I get "Error: Permission denied" on...
|
by: bg_ie |
last post by:
Hi all,
I'm trying to use the following kit -
http://ccrma.stanford.edu/software/stk/
but I'm having trouble building the code. I've tried isolating the
problem by deleting code and...
|
by: TMS |
last post by:
I'm trying to write an address book that is based on a binary tree. I'm devloping in Visual C++ (I blew up my Ubuntu with the new dist, so no EMACS), starting with the basics:
#ifndef...
| |
by: dave6502 |
last post by:
Newbe C++ programmer.
I am trying to bug fix a simple KDE application that uses C++. There
is a main directory with .cpp & .h files in it. I need to write some
additional code and split it up...
|
by: per9000 |
last post by:
Hi python people,
I am trying to figure out the best way to encrypt files in python.
I've build a small script (see below) that encrypts the ubuntu 7.04
iso file in 2 minutes (I like python :)...
|
by: eduardoamfm |
last post by:
Hi everybody!
I have the following files: (MSC.080806.00, MSC.080806.01, MSC.080806.02...) each one has the same pattern, with two different START and STOP times and values:
...
...
|
by: tpgames |
last post by:
I just inherited a desktop with ubuntu installed and a bunch of other cool apps. The issue is that the person who gave me the computer accidentally deleted the folder that update manager uses to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
| |
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,...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
|
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 ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |