I tried to follow this tutorial but failed.
I am confused about which string to assign to GST_PLUGIN_PATH.
In other words, this is my current GST_PLUGIN_PATH( according to some searching on forums)
usr/local/Cellar/gstreamer/1.14.4/
But I also have tried this string because the mentioned tutorial made me do so:
/usr/local/Cellar/cmu-pocketsphinx/0.8/lib/python2.7/site-packages/
the "pocketsphinx.so" file is inside the latter one while it is not inside the former one.
Neither of the above strings works;
gst-inspect-1.0 pocketsphinx
gave me this message no matter which value I assigned to GST_PLUGIN_PATH:
No such element or plugin 'pocketsphinx'
Previously, I also copy the .pc files.
$cd /usr/local/lib/pkgconfig
$cp gstreamer-1.0.pc
/usr/local/Cellar/cmu-pocketsphinx/0.8/lib/python2.7/site-packages/
$cp gstreamer-base-1.0.pc /usr/local/Cellar/cmu-pocketsphinx/0.8/lib/python2.7/site-packages/
$cp gstreamer-plugins-base-1.0.pc
/usr/local/Cellar/cmu-pocketsphinx/0.8/lib/python2.7/site-packages/
Please help, thank you.
Related
I am trying to create a parameter variation based on a single python script run using the pipeline jar. I manually added a variable called 'pyCommunicator ' of the type other 'PyCommunicator' with initial value new 'PyCommunicator()'.
In the 'initial experiment set' block of the properties section, I import the python file via 'pyCommunicator.run("import GA");'
However, when I try to run the parameter variation I get the error code "PyCommunicator.java:669' indicating that the source code is not present. It also states '669 is not a valid line number in com.anylogic.libraries.pypeline.PyCommunicator'
When I add the jar file at the 'Change Attached Source' option the error does not change. The jar file is in the same folder as the anylogic and python files. I am not sure why the error occurs now. Has anybody experienced this issue before?
This is what it shows if you click on the error:
Preface: I am a beginner to Python
Problem statement: I am writing a script wherein I will be launching an application (Gotit.exe) sitting at particular path lets say D:\Some Folder\SomeMore Folder\AgainFolder\myPythonFolder\Gotit.exe. I have kept the python-script also in myPythonFolder.
I am accessing the folder path via os.path.dirname(os.path.realpath(__file__)) and selecting particular application by appending it with \Gotit.exe but when passing the same appended string stored in a variable i.e. GotitexePath to os.system(GotitexePath) its throwing error as,
'D:\Some ' is not recognized as an internal or external command,
operable program or batch file.**
Kindly help me out to solve the said issue
I am using python 3.8.2 on Win10 Machine
The error is pointing to Some Folder name. Since there is a space in path you provide, the system doesn't know whether it is a part of folder name or it is a next argument to the command.
You need to escape the blank space. There are multiple ways to to it. For example wrap the path with double quotes:
"D:\Some Folder\SomeMore Folder\AgainFolder\myPythonFolder\Gotit.exe"
For more ways see this post
os.system("\"%s\"" % GotitexePath)
A the previous replies say, you need to add additional quotation marks around the path for the windows command line.
I am trying to replicate another researcher's findings by using the Python file that he added as a supplement to his paper. It is the first time I am diving into Python, so the error might be extremely simple to fix, yet after two days I haven't still. For context, in the Readme file there's the following instruction:
"To run the script, make sure Python2 is installed. Put all files into one folder designated as “cf_dir”.
In the script I get an error at the following lines:
if __name__ == '__main__':
cf_dir, cf_file, cf_phys_file = sys.argv[1:4]
os.chdir(cf_dir)
cf = pd.read_csv(cf_file)
cf_phys = pd.read_csv(cf_phys_file)
ValueError: need more than 0 values to unpack
The "cf_file" and "cf_phys_file" are two major components of all files that are in the one folder named "cf_dir". The "cf_phys_file" relates only to two survey question's (Q22 and Q23), and the "cf_file" includes all other questions 1-21. Now it seems that the code is meant to retrieve those two files from the directory? Only for the "cf_phys_file" the columns 1:4 are needed. The current working directory is already set at the right location.
The path where I located "cf_dir" is as follows:
C:\Users\Marc-Marijn Ossel\Documents\RSM\Thesis\Data\Suitable for ML\Data en Artikelen\Per task Suitability for Machine Learning score readme\cf_dir
Alternative option in readme file,
In the readme file there's this option, but also here I cannot understand how to direct the path to the right location:
"Run the following command in an open terminal (substituting for file names
below): python cfProcessor_AEAPnP.py cf_dir cf_file cf_phys_file task_file jobTaskRatingFile
jobDataFile OESfile
This should generate the data and plots as necessary."
When I run that in "Command Prompt", I get the following error, and I am not sure how to set the working directory correctly.
- python: can't open file 'cfProcessor_AEAPnP.py': [Errno 2] No such file or directory
Thanks for the reading, and I hope there's someone who could help me!
Best regards & stay safe out there during Corona!!
Marc
cf_dir, cf_file, cf_phys_file = sys.argv[1:4]
means, the python file expects few arguments when called.
In order to run
python cfProcessor_AEAPnP.py cf_dir cf_file cf_phys_file task_file jobTaskRatingFile jobDataFile OESfile
the command prompt should be in that folder.
So, open command prompt and type
cd path_to_the_folder_where_ur_python_file_is_located
Now, you would have reached the path of the python file.
Also, make sure you give full path in double quotes for the arguments.
I'm trying to create a hook script for subversion on windows, I have a bat file that calls my python script but getting the log/comments seems to be beyond me.
I have pysvn installed and can get the transaction like this:
repos_path = sys.argv[1]
transaction_name = sys.argv[2]
transaction = pysvn.Transaction( repos_path, transaction_name)
I can also list what has changed:
transaction.changed(0)
What I cannot figure out is how to get the log/comment for the transaction. I realize that in pysvn there is a command similar to:
transaction.propget(propname,path)
But cannot for the life of me get it to return anything. I assume propname should be "svn:log", for path I have tried the fiel name, the repo path, null but all get are errors.
AT the end of the day I need to validate the comment, there will be matching against external data that will evolve, hence why I want to do it in python rather than the bat file, plus it may move to a linux server later.
AM I missing something obvious? How do I get the log/comment as a string?
Thanks, Chris.
After a great deal of trial and error and better searching after a day of frustration I found that I need to use the revision property, not a straight property, for a given transaction this will return the user submitted comment:
transaction.revpropget("svn:log")
There are other useful properties, this will return a list of all revision properties:
transaction.revproplist()
for example:
{'svn:log': 'qqqqqqq', 'svn:txn-client-compat-version': '1.9.7', 'svn:txn-user-agent': 'SVN/1.9.7 (x64-microsoft-windows) TortoiseSVN-1.9.7.27907', 'svn:author': 'harry', 'svn:date': '2017-12-14T16:13:52.361605Z'}
In my script I want to be able, in the end, to be able to download all files in a directory and all sub-directories... So I am trying FTPLIB. I'm trying to call dir of my ftp server and put it into a variable, but I get NONETYPE?! I can connect to the server and when I call directory = session.dir() It displays a kind of matrix style output in the console with files, read/write perms, dates, etc.... But when I then try to print Directory all I seem to get is "None". My initial idea was to for each item in the directory download them to my computer, but I can't seem to get a list of the directory!
directory = session.dir()
print(str(directory))
Sorry for the long and probably trivial explanation, but I have become a little bit too frustrated.
Any help would be very much appreciated!
-Clem
First, read this. http://docs.python.org/library/ftplib.html#ftplib.FTP.nlst
Then, try this:
directory = session.nlst()
print(directory)
Note.
You don't need to do print(str(...)). The print function gets the string representation for you.
In the official docs, the very first example shows how to do what you need: use .retrlines('LIST') to read the output of LIST command.
Another way is to use .nlst().