Comments (7)
@alaindebecker try using Path
from pathlib package. Something like Path.cwd()
.
from bonobo.
Hi deepu9, Thank for the quick answer.
I do not see how to use Path.cwd()
, which gives me the current working directory.
I did try to wrap to warp the string in a Path
, which is fine for Path
in it self, but still produces the same error (on a a still no existing line 56 in bonobo/nodes/io/base.py
).
My minimal reproductible example goes as follow:
myFile = <<any valid csv file of yours>>
print(Path(myFile)) # Check if VALID
graph = bonobo.Graph()
graph.add_chain(
bonobo.CsvReader(Path(myFile)) # FAULTY
)
bonobo.run(graph)
FYI : According to your website, I insalled bonobo with pip
, after which bonobo version
tells me bonobo v.0.6.4
.
from bonobo.
from bonobo.
Hi deepu9, Thank for the quick answer.
I do not see how to use
Path.cwd()
, which gives me the current working directory.I did try to wrap to warp the string in a
Path
, which is fine forPath
in it self, but still produces the same error (on a a still no existing line 56 inbonobo/nodes/io/base.py
).My minimal reproductible example goes as follow:
myFile = <<any valid csv file of yours>> print(Path(myFile)) # Check if VALID graph = bonobo.Graph() graph.add_chain( bonobo.CsvReader(Path(myFile)) # FAULTY ) bonobo.run(graph)
FYI : According to your website, I insalled bonobo with
pip
, after whichbonobo version
tells mebonobo v.0.6.4
.
@alaindebecker When you use Path.cwd()
, it gives current working directory. Anything that comes after the working directory should be appended by using joinpath()
.
Say your file path is C:\Users\alain\Desktop\projects\pyetl\Employees.txt. When you use Path.cwd()
, it only gives you C:\Users\alain\Desktop\projects\pyetl
, because that's your project root directory, where your code is being run. Now to make the other parts, use joinpath()
. So the final code will be:
Path.cwd().joinpath('Employees.txt')
Say your file path is C:\Users\alain\Desktop\projects\pyetl\subfolder1\subfolder1.2\Employees.txt, then your code should be:
Path.cwd().joinpath('subfolder1', 'subfolder1.2', 'Employees.txt')
from bonobo.
Still not.
myFile = Path.cwd().joinpath('..', 'Employees.txt')
print('File name:', myFile)
print('File exists:', myFile.is_file())
graph = bonobo.Graph()
graph.add_chain(bonobo.CsvReader(myFile))
bonobo.run(graph)
However, this time, the "/" after the "C:" was not erased, but all the "/" where converted to "\" and file name got truncated.
File name: C:\Users\alain\Desktop\projects\pyetl\..\Employees.txt
File exists: Truefs.errors.InvalidCharsInPath path 'C:\Users\alain\Desktop\projects\ClassicModels\datafiles' contains invalid characters
from bonobo.
Still not.
myFile = Path.cwd().joinpath('..', 'Employees.txt') print('File name:', myFile) print('File exists:', myFile.is_file()) graph = bonobo.Graph() graph.add_chain(bonobo.CsvReader(myFile)) bonobo.run(graph)
However, this time, the "/" after the "C:" was not erased, but all the "/" where converted to "" and file name got truncated.
File name: C:\Users\alain\Desktop\projects\pyetl\..\Employees.txt File exists: Truefs.errors.InvalidCharsInPath path 'C:\Users\alain\Desktop\projects\ClassicModels\datafiles' contains invalid characters
@alaindebecker Don't worry about forward or backward slashes, as the pathlib will take care of them. Also, I've noticed ..
in your code. Not sure whether you want to hide subfolders from public view or use the ..
for relative path. If it's the later, then can you remove the ..
from joinpath()
. Can you confirm.
I've created same folder structure and it works for me. Thanks
from bonobo.
@alaindebecker Did you get a chance to re-check your code? Can you let me know how did it go. Thanks
from bonobo.
Related Issues (20)
- Documentation missing - Not clear how to check if there were any errors in transformation nodes HOT 1
- Allow packaging==20.3 HOT 6
- DEBUG cannot be enabled by env var, even though it is said to be possible HOT 3
- resolve start and end of named chain are identical as _input and _output HOT 4
- Filter Node error HOT 2
- in the absence of docs - need some real world, readable examples HOT 1
- How to configure logging in bonobo to always log to stdout
- incompatibility with pip==20.x
- bonobo_sqlalchemy.Select remove easy limit for oracle HOT 1
- Graceful termination hangs when filtering data
- AttributeError: Graph and get_cursor() HOT 1
- Documentation example broken HOT 3
- CsvReader does not accept files in another directory HOT 2
- No output in docker container
- [FR] loop (sub-)chains HOT 1
- Example for using the RateLimited feature?
- processors.py need to be updated for Python 3.10+ for collections HOT 7
- Bug: Could not load 'init': cannot import name 'soft_unicode' from 'markupsafe' HOT 2
- Is the project being abondoned? HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bonobo.