English 中文(简体)
在通过PHP使用on时的许可问题
原标题:Permissions issues when using python through PHP

我的沙尔方案需要开立档案,使用其中的某些数据,并用不同的档案。 我有好几个问题,如果有人允许,如果是允许的话,那么我会想如何确定这些问题。 我的舒尔方案通过码头开展工作。

这里是我发现的一些工作领域:

import matplotlib.pyplot
infile = open( /correct_pathway/textfile1.txt , r )
outfile = open( /correct_pathway/textfile2.txt , w )

它在所有这些问题上都存在麻烦。 我不知道在进口一个单元时可能会有许可问题,但也有。 这些档案也在全球范围内读取/可解释,试图打开。

EDIT: Sorry, that was unintentionally vague and had a typo in the code that was not actually there. The PHP code as written on the webpage is as follows (it works if I call in a much simpler python program, so there is no problem I can think of here):

<?php  $command=  /usr/bin/python /correct_pathway/program.py ;
$temp = exec($command, $output);
print_r($temp); ?>

该代码应开放,读出若干册,然后在册子上写,并打印出不同的编号。 印本应在网页上展示。 所有这一切都通过终端而不是在网页上进行。

提前感谢!

问题回答

To define how a file should be opened, i.e. read or write, the syntax is to surround the r or w with quotes. So your above code should look like the following.

import matplotlib.pyplot
infile = open( /correct_pathway/textfile1.txt , r )
outfile = open( /correct_pathway/textfile2.txt , w )

参看你能否用添加的字句查阅档案。





相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签