Unable to get a pdf file from executing pyreport - python

We have been asked to generate a report using pyreport, but anytime I run the command pyreport last.py in command prompt I get these feedback:
Traceback (most recent call last):
File "C:\Python27\Scripts\pyreport-script.py", line 9, in <module>
load_entry_point('pyreport==0.3.4c', 'console_scripts', 'pyreport')()
File "C:\Python27\lib\site-packages\pyreport-0.3.4c-py2.7.egg\pyreport\pyreport.py", line 52, in commandline_call
pyfile = open(args[0],"r")
IOError: [Errno 2] No such file or directory: 'last.py'
Please help me solve this problem. i also already have latex installed on my computer does it have anything to do with this problem?

Related

Python os function not working as intended?

Am I missing something here, I am attempting to make a directory then change CWD into that directory, however it keeps throwing an error saying "FileNotFoundError: [Errno 2] No such file or directory:". This only happens if I first remove the directory and start with no directory there, once its created the first time it works fine.
If I run the code twice it works, first time I get the error.
import os
def func_name_here():
os.popen('mkdir -p /tmp/tun')
os.chdir(r'/tmp/tun')
func_name_here()
This gives me...
Traceback (most recent call last):
File "test.py", line 9, in <module>
func_name_here()
File "test.py", line 6, in func_name_here
os.chdir(r'/tmp/tun')
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tun'

wkhtmltopdf in python script is not working with cronjob

I am getting the below error while running python script as cronjob. But its working while executing manually.
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/pdfkit/configuration.py", line 21, in __init__
with open(self.wkhtmltopdf) as f:
FileNotFoundError: [Errno 2] No such file or directory: b''
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ubuntu/aws_security_cost_audit.py", line 626, in <module>
File "/home/ubuntu/aws_security_cost_audit.py", line 621, in main
File "/home/ubuntu/aws_security_cost_audit.py", line 95, in html_to_pdf
File "/usr/local/lib/python3.4/dist-packages/pdfkit/api.py", line 47, in from_file
configuration=configuration, cover_first=cover_first)
File "/usr/local/lib/python3.4/dist-packages/pdfkit/pdfkit.py", line 42, in __init__
self.configuration = (Configuration() if configuration is None
File "/usr/local/lib/python3.4/dist-packages/pdfkit/configuration.py", line 27, in __init__
'https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf' % self.wkhtmltopdf)
OSError: No wkhtmltopdf executable found: "b''"
If this file exists please check that this process can read it. Otherwise please install wkhtmltopdf - https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf
The file /usr/local/bin/wkhtmltopdf is executable and paths are exported by default.
root#jump-box:/home/ubuntu# whereis wkhtmltopdf
wkhtmltopdf: /usr/local/bin/wkhtmltopdf
root#jump-box:/home/ubuntu# which wkhtmltopdf
/usr/local/bin/wkhtmltopdf
root#jump-box:/home/ubuntu# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
Any guess on what could be the issue?
If I add this job:
* * * * * echo $PATH >> /ws/tmp.log 2>&1
then:
> cat tmp.log
/usr/bin:/bin
So you probably want to wrap your cronjob in a script that sets up the environment properly

Having an issue running Python Code in terminal

Hi everyone so I have some python code I am trying to run from my terminal (will not work in an IDE) to take a .mp3 file and classify the genre of the song based on the Spectrogram that we are using the librosa library plugin for. The code is from this gitHub: https://github.com/cetinsamet/music-genre-classification .When I use the command prompt specified by the gitHub user who created this app I get this error in my terminal:
(base) Nicos-MacBook-Pro:src nico$ python3 get_genre.py ../test.mp3
Traceback (most recent call last):
File "get_genre.py", line 61, in <module>
main(sys.argv[1:])
File "get_genre.py", line 30, in main
net.load_state_dict(torch.load(MODELPATH, map_location='cpu'))
File "/Users/nico/opt/anaconda3/lib/python3.7/site-packages/torch/serialization.py", line 419, in load
f = open(f, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '../utils/net.pt'
Here is the command line specified: $ python3 get_genre.py ../test.mp3
The error message quite plainly tells you that the code depends on having a file ../utils/net.pt

Issue running python script

I'm running a python script called ALPS which installs packages. It has worked, but now spits this error:
Traceback (most recent call last):
File "/usr/bin/alps", line 295, in <module>
initPackages()
File "/usr/bin/alps", line 156, in initPackages
packageMap[line.split(':')[0]].append(line.split(':')[1].strip())
KeyError: 'gnome-icon-theme'
The error occured when I made spelling mistake with the package 'gnome-icon-theme?
This is obviously linked to python, but can anyone point the way to solving this? The source code can be found here: https://github.com/FluidIdeas/alps
thanks
Cliff

Tensorflow download_and_convert_mnist_m.py No such file or directory: '~/dsn_data/mnist_m/mnist_m_train'

I have a weird error message using the download_and_convert_mnist_m.py script from github https://github.com/tensorflow/models/tree/master/research/domain_adaptation/datasets.
The command I am using from the models/research/ folder is
python domain_adaptation/datasets/download_and_convert_mnist_m.py --dataset_dir=~/dsn_data/
The error message is
Traceback (most recent call last):
File "domain_adaptation/datasets/download_and_convert_mnist_m.py", line 237, in <module>
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "domain_adaptation/datasets/download_and_convert_mnist_m.py", line 233, in main
run(FLAGS.dataset_dir)
File "domain_adaptation/datasets/download_and_convert_mnist_m.py", line 201, in run
os.path.join(dataset_dir, 'mnist_m', 'mnist_m_train'))
File "domain_adaptation/datasets/download_and_convert_mnist_m.py", line 177, in _get_filenames
for filename in os.listdir(dataset_dir):
OSError: [Errno 2] No such file or directory: '~/dsn_data/mnist_m/mnist_m_train'
I tried several ways:
without creating the path before and without having the data before
create the path before and let it empty
download and unpack data from https://drive.google.com/drive/folders/0B_tExHiYS-0vR2dNZEU4NGlSSW8 at the specified path as described here https://github.com/tensorflow/models/tree/master/research/domain_adaptation
I use
Ubuntu 16.04
Python 2.7
tensorflow 1.4.1
What else can I do.. looks like an pretty simple error but I have no more ideas.
I solved it. The correct command is without the equal sign.
python domain_adaptation/datasets/download_and_convert_mnist_m.py --dataset_dir=~/dsn_data/

Categories