I am using QPython on my Samsung Android V. I am studying from the book Think Python. The topic is about Adding New Functions such as: def print_lyrics:
print ("I am a lumberjack and I work all day."
Etc.
But when I attempt to run it I get an error saying, File "", line 1 error.
1. I looked on Google but could not find the exact answer for this particular problem. I was about to look for a new app and delete QPython because I've been stuck for two days on this lesson. But I came here first.
2. I tried different methods of doing this program function with no luck.
3. I'm wondering if it just isn't available on the app, or am I failing to understand what I am doing wrong, or missing?
Thanks for your help.
I am editing my last answer:
I was mistaken when I read the text and the error was my fault.
Be sure and read thoroughly to avoid mistakes.
Related
Apologies if this has been asked before. I tried to find an answer elsewhere, but couldn't find a response that resolved my issue.
I inherited some code for downloading and processing satellite data without a lot of explanation and I am required to make it work. The intention was that this code should run without me needing to do anything but run the script, but there is a bug that prevents it from working properly.
I've been able to narrow the issue to (probably) one line of code:
ds = rioxarray.open_rasterio(tempFile).compute()
where tempFile represents a string for an s3 bucket. The exception message I receive about it is as follows: '/MOD13Q1_A2022193_h09v04_061_2022215010516.hdf' not recognized as a supported file format
I have almost no experience with xarray and rasterio, so I don't have a good idea of where to begin to resolve this. The file does exist at the location and rasterio can process .hdf files (I think), but if that's the case, what may be going on here? Any help is appreciated.
Thanks!
I am building a PDF viewer in Ionic 2 using the Mozilla PDF Viewer but have run into a problem. I have built pdf.js in accordance with these instructions. The code generated includes this line:
var worker = new Worker(workerSrc);
Chrome is complaining on this line that it cannot find the file GET http://localhost:8100/build/main.worker.js.
Now then, I have not come across web workers before, so I'm not sure what this error means or where to find, or build, this file. I notice that the build process also yields a file called pdf.worker.js, and I have strong suspicions that this might be the file it's after, although renaming it to main.worker.js had no effect.
I'm sure this is a very simple problem if you are in the know. What am I missing?
Ok, after a little more digging, I found this which pertains more to my situation. I am using Ionic 2 and I don't know how to generate the file referenced in this line:
pdfjsLib.PDFJS.workerSrc = '../../build/webpack/pdf.worker.bundle.js';
Can anyone illuminate my dark mind?
I have a network path that contains hundred of thousands .wav files. When I do the following:
FileBuffer = Dir$("\\MEDIASERVER\*.wav", FileAttribute.Archive)
The line freezes forever. I have literally let it run a day, and it never returns with execution. I then decided to test the symptom with a dir command in DOS. Same symptom.
I then wondered if I would get the same symptom if I added a prefix to the search pattern narrowing my results. I did this in DOS:
DIR 0009*.wav
Worked like a charm. So, armed with this knowledge, I went back to my VB.NET project and applied a similar solution:
FileBuffer = Dir$("\\MEDIASERVER\0009*.wav", FileAttribute.Archive)
Doesn't get stuck, actually does the search. But I was surprised by the first result:
FileBuffer came back with the following value:
003925034541228334146804222014065036AM005020MIF.wav
This does not match the pattern I asked for. Can someone tell me what I am doing wrong? Is there a known bug with DIR$? Is there a way to achieve what I want without enumerating 100% of the files in the network share?
Additional Information if it's relevant:
Developement Machine: Windows 7 Pro, VS 2013 Pro
Network Server: Linux Centos 5.0 (I have the same issue with a network drive running Windows 7 Pro).
Thanks in advance.
Sorry for just posting the question, and already getting the answer. The question about whether or not it worked properly in DOS helped narrow my troubleshooting. I came across a couple of pages on the net stating that DIR will come back with unexpected results. They state that it's because of the 8.3 naming convention. I then decided to see if there was any other constraints I could add to my program. I changed the pattern to:
DIR \\MEDIASERVER\0009*MIF.wav
And now I am getting the expected results. This cannot be because of the 8.3 Naming convention though. It's something else, but at least I got this working.
Thanks for your time.
I'm trying to learn Cucumber. After poking around a bit on SO I found a link to this tutorial. It was very helpful (and I recommend it highly!), but, for a beginner like myself, a couple of the early steps were opaque. I thought I'd explain these two pitfalls here, to spare future Cucumber students the head-scratching they caused me.
The two problems both came up in this section:
Starting the fail-fix cycle
I run it using cucumber features, and it fails on the first line –
Given I go to the new book page – because cucumber doesn’t know where
the “new book page” is. So I add that to the cucumber paths helper.
when /the new book page/
new_book_path
I had trouble interpreting this section and running her code.
My first question was: where do I find the cucumber paths helper file?
Once I figured it out and ran cucumber features, I got a syntax error.
My second question was how do I debug the syntax error that her code raises? I've tried to answer these two questions below.
First Gotcha: where the heck is the `cucumber paths helper'?
First off, she talks about adding a step to the cucumber paths helper. I struggled for a while to figure out where this file was located. I couldn't find anything with a similar name in my app, and google searches didn't yield any useful results. What was going on?
It turns out that I couldn't find the file because it's not automatically generated -- you need to create it yourself. Furthermore, the name of the file is totally arbitrary: it doesn't need to be called cucumber_paths_helper. That's why my google searches were fruitless.
For her code snippet to be executed it just needs to be in some file living in the features/support folder. All of the code in this directory is executed before any cucumber tests are run. The solution? I put her code into a new file at features/support/manage_books_steps.rb.
Ok, one down...
Second Gotcha: syntax error, unexpected keyword_when
The next problem showed up when I tried to run cucumber features. I got this:
/Users/dB/myApp/features/support/manage_books_steps.rb:1: syntax error, unexpected keyword_when
when /the new book page/
^ (SyntaxError)
For some reason my system couldn't parse this code. I'm not sure why exactly, but I'm guessing that Sarah was using some gem or tool to preprocess her code that I didn't have installed, and she unfortunately didn't go into detail about her gemset in the article. (Maybe she wrote it before cucumber's training wheels came off?) In any case, after consulting some other cucumber tutorials I tried reformatting her snippet like so.
When /^I go to the new book page$/ do
visit new_book_path
end
This worked.
After getting past those two little obstacles, the rest of the tutorial was a synch.
Anyway, I hope this helps someone somewhere down the line. And thanks, Sarah, for a great tutorial.
Edits/comments/corrections are welcome.
Having been struggling trying to bulkload data to the datastore, I have reached the point where expert help is needed.
I don't think what is am doing is tricky, I have the following configuration file:
and when I use the appcfg.py command, the error messages end with:
File "config.txt", line 1
python_preamble:
^
Syntax error: invalid syntax.
I have used a .txt file as it is faster to edit in notepad initially - I don't know if that is a problem and the remote_api for the appspot all seems to be okay.
I am thinking it is a fairly fundemental problem as it has stopped working at the top line. I removed the comment lines at the top of the original file - maybe that caused it.
I have tried to find working examples to set me right but they all seem to follow the syntax above, or where they are slightly different, I have tried both variants.
Help on bulkloading for my first cloud app would be much appreciated.
Thanks in advance for anyone taking time to read my post whether they solve it or not.
Be sure the configuration file extension is .yaml