Compass Sprite returning "File to import not found or unreadable" - sprite

So, I've just started using the Compass Framework, and now wish to start using its native spriting feature. In doing so, I've added the following to the top of my scss file:
#import 'compass/utilities';
#import "*.png";
#include all-img-sprites;
After compiling, I get the following error:
error path/to/my/project/css/scss/front.scss (Line 4: File to import not found or unreadable: *.png.
Load paths:
Compass::SpriteImporter
path/to/my/project/css/scss
C:/Ruby22/lib/ruby/gems/2.2.0/gems/compass-core-1.0.3/stylesheets)
Compilation failed in 1 files.
[Finished in 1.7s]
I've looked around for a solution to this, but to my surprise, even though there's multiple threads on it - I can't seem to find anything relevant.
I've tried renaming the folders thinking that the "img" folders might be keyworded or something, but to no avail. Below you'll find my config.rb.
# Set this to the root of your project when deployed:
http_path = ""
# Configure sass path
sass_path= "path\\to\\my\\project\\css\\scss"
# Folder locations
sass_dir = "css/scss"
css_dir = "css"
images_dir = "img"
fonts_dir = "fonts"
javascripts_dir = "js"
sprite_load_path = "img"
# Disable debugging comments that display the original location of your selectors
line_comments = false

Oh wait, there we go! After a bit more fiddling about.
The issue was the path. Removing the sprite_load_path from the config.rb file, and changing the above to:
#import "raw/*.png";
#include all-raw-sprites;
Works fine. Note that the img folder is still set in the config.rb.

Related

Neovim LSP: pyright server does not dynamically regognize changes in sub folders

I setup Neovim LSP using the nvim-lspconfig and the lsp-installer where I also installed the pyright server.
Without any further configuration it worked out of the box. However when I have a class in a subfolder and add a new method, pyright does not recognize this method when I want to access it in a different file. When I restart neovim, or open and close the file, pyright suddenly recognizes the newly added method.
I also tried :LspRestart with no effect.
I tried to add some settings to the pyright server:
return {
settings = {
python = {
analysis = {
autoSearchPaths = true,
diagnosticMode = "workspace",
useLibraryCodeForTypes = true,
}
}
},
}
But this also had no effect.
:LspLog also does not show anything which could point to the issue:
[START][2022-07-15 11:11:05] LSP logging initiated
[WARN][2022-07-15 11:11:09] ...lsp/handlers.lua:109 "The language server pyright triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[WARN][2022-07-15 11:11:09] ...lsp/handlers.lua:456 "stubPath typings is not a valid directory."
[WARN][2022-07-15 11:11:20] ...lsp/handlers.lua:109 "The language server pyright triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
I also could not find any setting regarding to this issue here which could solve this.
Since I am new to python, the way I import and structure classes might not be common and might be an issue which could cause this problem.
As a main entry point I have main.py in the root folder
All other source files are in a program/ folder which does not have a __init__.py
Inside program/ there are folders which each have a __init__.py file f.e. core/
core/__init__.py:
from .myClass import myClass
and in main.py I import it like this:
from subfolder.core import myClass
myClass.newMethod() # this is only recognized by lsp/pyright after the file is closed and reopen
Is the issue a bug in pyright (not likely I guess), a missing setting or my strange folder/import structure?
Can you try this: create (or modify) pyproject.toml, put it in the project root directory. Inside pyproject.toml, add the following lines:
[tool.pyright]
extraPaths = ["program/core" ,"program/directory_2", "program/directory_3"]
The idea is that you have to add the sub directories manually, which is really tedious but at least it works in my case.

Problem using PyInstaller with a discord bot and cogs

I have a discord bot that uses COGS(modules) in a folder called 'cogs' inside my main program folder.
I currently use this method to load my cogs:
for filename in os.listdir(r'.\cogs'):
if filename.endswith('py'):
bot.load_extension(f'cogs.{filename[:-3]}')
When I try to use Pyinstaller, this does not work. How would I get around this without having to get rid of my cogs?
Well I solved the problem but I had to move my cogs out of the folder and next to the main file. Then I added them to the spec file in the datas= section like this:
datas=[( 'cog_name.py', '.' ),( 'other_cog.py', '.' )],
I changed the cog load method to
extensions = [
'cog_name',
'other_cog_name'
]
for extension in extensions:
bot.load_extension(extension)
Instead of doing hidden imports, I added them to the main file so that pyinstaller could just find them without adding more things to the spec.
Hope this helps someone else if they get stuck.

Getting "No file or variants found for asset" found error on my asset

I am getting this attached error when I try and run my app. Any ideas?
(Below)
Launching lib\main.dart on SM J200Y in debug mode...
Running Gradle task 'assembleDebug'...
√ Built build\app\outputs\apk\debug\app-debug.apk.
Error detected in pubspec.yaml:
No file or variants found for asset: assets/credentials.json.
I have checked the yaml file and the formatting seems to be fine. I am at a loss as want the issue is. (Also, below)
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/credentials.json
In my case, the problem was that I was missing slash /.
At first, I have added my icons path as below.
assets:
- assets/icons
I solve the issue by adding as slash / to the end of the path as below:
assets:
- assets/icons/
Check identation of assets. Generally it should have 3 spaces from start of new line.
assets:
- assets/credentials.json // <-- count three spaces from start
I was facing the same problem, and I had two mistakes:
I created the "images" folder inside the "lib" folder, and it should be outside the lib folder, it should be in the app root folder.
It should be three spaces from the starter line as #Darshan said
-assets/credentials.json // <-- count three spaces from start
It should appear a grey line, like this
there are 2 possibility
Folder/file missing in your project directory
Missing "/" in the end of folder/file name in pubspec.yaml file
try copying the file manually not using VS-Code or Android studio. don't use drag/drop.
You need mention as
assets:
- assets/icons/
in pubspec.yaml
I had this same problem, I was able to fix it by using only the name of directory created in the projects root folder, instead of also including the file i was trying to point to.
assets:
- images/
is what worked for me instantly, just point to the whole dir and specify the file name in ImageAssets object.
Sometimes you need to enter filename as such:
flutter: assets:
- lib/assets/logo.png
I was facing the same problem, and I had two mistakes:
When I add lib in assets then I solve my problem.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- lib/images/background.jpg

including folder and files inside a Python package

I'm trying to make a python package and I have most of the things already setup by when I try to install the library from Github here, it installs everything except for the folder called champs and it's files
This is my File directory structure
LeagueYue
champs
-Lname_num.json
-Lname_Uname.json
-num_Uname.json
-__init__.py
-champion_files.py
-external.py
-match.py
-rank.py
-status.py
-summoner.py
-requirements.txt
-setup.py
All the files are installed except for the folder and the files inside champs
As this question answers:
There are 2 ways to add the static files:
1) Include_package_data=True + MANIFEST.in
A MANIFEST.in file in the same directory of setup.py, that looks like this:
include src/static/*
include src/Potato/*.txt
2) Package_data in setup.py
package_data = {
'static': ['*'],
'Potato': ['*.txt']
}
Specify the files inside the setup.py.
Two of the files could probably be derived at runtime from num_Uname.json, but that's fine.
I do not yet see a data_files directive in https://github.com/CharmingMother/LeagueLib/blob/async/setup.py
Thomas Cokelaer suggests using an expression like
datafiles = [(datadir, list(glob.glob(os.path.join(datadir, '*'))))]
and then
setup(
...
    data_files = datafiles,
)
in http://thomas-cokelaer.info/blog/2012/03/how-to-embedded-data-files-in-python-using-setuptools/
In your case this could be as simple as:
data_files = [('', ['champs/num_Uname.json'])],
Martin Thoma explains you should access them using filepath = pkg_resources.resource_filename(__name__, path)
in How to read a (static) file from inside a Python package?
When I Read The Fine Manual, this setup.cfg alternative surfaces:
[options.data_files]
...
data = data/img/logo.png, data/svg/icon.svg
suggesting a line like . = champs/num_Uname.json or champs = num_Uname.json

cucumber jvm CucumberException: No features found at []

In my cucumber -jvm, Maven, junit Setup I have my testRunner file as
package com.lebara.testrunner;
import cucumber.junit.Cucumber;
import org.junit.runner.RunWith;
#RunWith(Cucumber.class)
#Cucumber.Options(
glue = {"com.lebara.stepdefs","com.lebara.framework.main", "com.lebara.testrunner"},
features = "C:/Users/sarthak.dayanand/Documents/WebRefreshTest/CukeAutomation/LebaraWebAutomationTest1/src/main/resources",
format = {"pretty", "html:target/cucumber-html-report", "json-pretty:target/cucumber-report.json"},
tags = {"#UserJourney"}
)
public class RunCukesTest {
}
I have my feature file in the above mentioned directory.
If I run it, I get the following exception:
cucumber.runtime.CucumberException: No features found at [C:/Users/sarthak.dayanand/Documents/WebRefreshTest/CukeAutomation/LebaraWebAutomationTest1/src/main/resources/cucumber]...
If I remove the "features" option in the testrunner, it tries to look for feature files in the same directory as my testrunner.java
cucumber.runtime.CucumberException: No features found at [com/lebara/testrunner]
And if I put the feature files there, it works.
My question is why is my feature file not being picked up from my previous location, which I thought to be the default file structure for cucumber - maven setup.
How do I make it pick up from there? Help appreciated.
Where exactly are your test runner and feature files? I've got the following setup which works perfectly:
src/test/
java/
com/mypackage/
TestRunner.java
StepDefinition.java
resources
com/mypackage/
fancy.feature
The Maven/Cuke conventions will have the tests executed from the tests/java directory and the feature files found in the test/resources directory. My test runner is basically the same as yours but with less options:
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
#RunWith(Cucumber.class)
#Cucumber.Options(format = {"pretty"})
public class TestRunner { }
Hope this helps if you hadn't already found an answer.
I have a setup similar to yours (not using the Maven/Cucumber conventions). In my options, I don't specify the path from root, but from the project's source folder where the features are held. It makes sense, since otherwise the tests would only be runnable from your machine.
In your case, I think it should be:
features = "src/main/resources"
Just add features = { "classpath:features/feature.feature"}, and the feature must under test/resources/features/feature.feature.
#CucumberOptions(
format = {"pretty", "html:target/html"},
features = {"classpath:features/feature.feature"},
snippets = SnippetType.CAMELCASE
Note classpath.
When you compile your code if you are using maven open up target/test-classes/features and you will see feature.feature
//Removing the space between "**classpath**" and "**:com/**" helped.
#RunWith(Cucumber.class)
#CucumberOptions(
features = {"classpath:com/tk/feature/"}, //NOTE: NO SPACE
glue = {"classpath: com.tk.cucumber"},
plugin = {
"pretty",
"html:build/reports/cucumber"
,"json:build/reports/cucumber-tests/test.json"}
)
public class RunAPITests {}
If you are providing the complete path of the feature file i.e.
"C:/Users/sarthak.dayanand/Documents/WebRefreshTest/CukeAutomation/LebaraWebAutomationTest1/src/main/resources" as in your query, try again by replacing the '/' character with '\\'(double back slash) as below.
"C:\\Users\\sarthak.dayanand\\Documents\\WebRefreshTest\\CukeAutomation\\LebaraWebAutomationTest1\\src\main\\resources\\abc.feature"
This is a git repo which uses the latest cucumber version : Cucumber- Example
Clone this repo and run it in your local machine. The #Given is defined and it should pass. The #Then and #When should be shown as undefined.
This is how the output for it should look :
Output for the Belly feature
Use the structure mentioned :
src / test / java/ io /cucumber / {Step definitions java and run cucumber test files here}
src /test / resources/ io/ cucumber / {feature files here}
You can run the gradle build using ./gradlew clean build
and the cucumber test using ./gradlew clean test --info
If this works, then use the same format in your project.
Just changing .Feature to .feature the problem got resolved for me.
Also make sure the path for feature is righly mention in CucumberOptions as per your feature folder
Some of the online tutorial have mentioned .Feature which brings this problem
so changing the case will solve this problem
There is another instance in which 'Feature Not Found' error occurs. I am posting the solution under this answer as there is no similar question.
I got this error when trying to run the Runner file first time after setting up Cucumber project in Maven. The solution i found was as follows: Go to the folder in which the 'feature' file is present in Windows Explorer. Check the size of the feature file you are trying to run. If the size is '0' KB, it will show the 'Feature Not Found' error. Make some changes to file until a value greater than zero is displayed. Run again after making changes.
#RunWith(Cucumber.class)
#CucumberOptions(
features = {"src/main/resources/cucumber/features"},//your feature path
tags = "not #Wip",
glue = {"classpath:steps"},
plugin = {"pretty", "html:target/cucumber/html"})
You must set the feature directory correctly
By putting the feature file under src/test/java where the runner and steps file or
by putting it under src/main/java the problem will get resolved.

Resources