Giter Club home page Giter Club logo

Comments (19)

ukd1 avatar ukd1 commented on May 29, 2024 1

Thanks for the quick reply! Just pulled, still getting this error:

 % python basic/blank.py
Traceback (most recent call last):
  File "/Users/russ/Sites/pcbflow/examples/basic/blank.py", line 11, in <module>
    brd.fill_layer("GTL", "GND")
  File "/Users/russ/.asdf/installs/python/3.10.6/lib/python3.10/site-packages/pcbflow-0.2.0-py3.10.egg/pcbflow/board.py", line 247, in fill_layer
    lyr.fill_poly = g.difference(exclusions.buffer(self.drc.clearance))
AttributeError: 'NoneType' object has no attribute 'buffer'

BTW, if it needs another version of Python, or some other requirements - I'm happy to install, just no sure where to get them (e.g. sparkfun.lbr).

Side/background: I am a total beginner at designing boards, but like programming. For CAD, I decided to learn OpenSCAD first - this seems similar! So, I have near-zero context for fixing outside of reading your README.

from pcbflow.

michaelgale avatar michaelgale commented on May 29, 2024 1

Try this pip install --upgrade shapely and pip list to check the version

from pcbflow.

michaelgale avatar michaelgale commented on May 29, 2024

The file not found errors are due to a breaking change to python's __file__ dunder method. After python 3.9+, the basename is returned with the full path rather than the base filename without path. All example scripts now use os.path.basename(__file__)[:-3] to return a simple basename as expected. In realty, your scripts will use your own filename reference anyway--the use of __file__ was a convenience for the sample scripts to self name.

Lastly, the sample.py script did not work because you do not have a sparkfun.lbr Eagle PCB library in the path of the script. Unless you use Eagle PCB, it is not a relevant test.

Modifications have been made to the repo example scripts and committed. Other changes have been made to support new versions of dependancy libraries.

from pcbflow.

michaelgale avatar michaelgale commented on May 29, 2024

Nevermind about the comments with respect to the __file__ dunder methods! That was referring to the bugs I was received whilst trying to replicate your error!

The NoneType buffers are likely due to the version of the shapely library. PCBflow was initially released supporting v.1.8.0+. Breaking changes were made v.2.0.0+ and therefore PCBflow was just changed to support them. Pull the most recent PCBflow and try again?

from pcbflow.

michaelgale avatar michaelgale commented on May 29, 2024

The first thing to try is to update the shapely package:

$ pip install --upgrade shapely

FYI, my platform has v.2.0.2 of shapely

from pcbflow.

michaelgale avatar michaelgale commented on May 29, 2024

Examining your execution dump above, I see that your installation uses shapely 2.0a1. When reviewing the changelogs from the shapely library repo, it appears that there was a very important fix made to version 2.0b1+ which would very much explain the AttributeError: 'NoneType' object has no attribute 'buffer' messages above. The object which is declared as a NoneType should in theory never be of this type. This object is the result of a call to the shapely.unary_union method which (as of 2.0b1+) should always return an object of type GeometryCollection (even if empty).

Therefore, I would strongly suggest updating your shapely library as described above to any version 2.0b1+, preferably v.2.0.2 (latest as of now).

from pcbflow.

michaelgale avatar michaelgale commented on May 29, 2024

I've enforced the version of the shapely package in the pcbflow installer. Therefore, you can git pull and attempt a new pip install .

from pcbflow.

ukd1 avatar ukd1 commented on May 29, 2024

Thanks - I just pulled, python setup.py install, and tried the basic example, but still get this error:

python examples/basic/blank.py 
Traceback (most recent call last):
  File "/Users/russ/Sites/pcbflow/examples/basic/blank.py", line 11, in <module>
    brd.fill_layer("GTL", "GND")
  File "/Users/russ/.asdf/installs/python/3.10.6/lib/python3.10/site-packages/pcbflow-0.2.0-py3.10.egg/pcbflow/board.py", line 247, in fill_layer
    lyr.fill_poly = g.difference(exclusions.buffer(self.drc.clearance))
AttributeError: 'NoneType' object has no attribute 'buffer'

Any idea what am I missing / doing wrong?

from pcbflow.

michaelgale avatar michaelgale commented on May 29, 2024

Can try pip list at your terminal and report back which version of shapely is shown?

from pcbflow.

ukd1 avatar ukd1 commented on May 29, 2024
pcbflow % pip list | grep shapely
shapely                      2.0a1

So, looks like the change didn't force it to update on install?

from pcbflow.

ukd1 avatar ukd1 commented on May 29, 2024

I did the dumber version before seeing your comment:

pcbflow % pip uninstall shapely
...
pcbflow % python setup.py install
...
pcbflow % pip list | grep shapely
shapely                      2.0.2
pcbflow % python examples/basic/blank.py 
Rendering Gerber GTD...
Rendering Gerber GTP...
Rendering Gerber GTO...
Rendering Gerber GTS...
Rendering Gerber GTL...
Rendering Gerber GBL...
Rendering Gerber GBS...
Rendering Gerber GBO...
Rendering Gerber GBP...
Rendering Gerber GBD...
Rendering Gerber GML...
Rendering excellon drill files...
Rendering preview_top.['pdf']...
Rendering preview_top_docu.['pdf']...
Rendering preview_bot.['pdf']...
Rendering preview_bot_docu.['pdf']...
Rendering preview_all.['pdf']...

So, looks like it's working!!

I'm a rubyist, so not really sure why the change to your requirements.txt and pull + re-setup didn't force that dependency update (will this affect others?) -- but thanks so much for helping fix this with me!

from pcbflow.

michaelgale avatar michaelgale commented on May 29, 2024

Glad its working. I'm not a pip expert, so I'm not sure what to blame for ignoring the requirements spec! On the to do list is to make a package for PyPI to make installation that much easier.

from pcbflow.

ukd1 avatar ukd1 commented on May 29, 2024

One more question - where / how can I install the sparkfun.lbr stuff?

from pcbflow.

michaelgale avatar michaelgale commented on May 29, 2024

The sparkfun.lbr is just an Eagle parts library I use for testing. Unless you need to use parts from existing Eagle part libraries, then its not something you really require. I think there might be a copy in the scripts folder, but I'm not sure. In any case, it is simply a test file for verifying that pcbflow can read/import parts.

from pcbflow.

ukd1 avatar ukd1 commented on May 29, 2024

Is it this one - https://github.com/sparkfun/Old-SparkFun-Eagle-Library - the "current" one seems to not have that individual file in. I'm setting up some github actions test running, and sample running for this, and trying to find the library you use for this.

I tried using https://github.com/sparkfun/Old-SparkFun-Eagle-Library/tree/master but it doesn't like it:

python examples/sample/sample.py
WARNING: fanout for R3 requires at least one net name to match against pad names
Traceback (most recent call last):
  File "/Users/russ/Sites/pcbflow/examples/sample/sample.py", line 39, in <module>
    usb_con = EaglePart(
  File "/Users/russ/.asdf/installs/python/3.10.6/lib/python3.10/site-packages/pcbflow-0.2.0-py3.10.egg/pcbflow/eagle.py", line 90, in __init__
    tree = ET.parse(self.libraryfile)
  File "/Users/russ/.asdf/installs/python/3.10.6/lib/python3.10/xml/etree/ElementTree.py", line 1222, in parse
    tree.parse(source, parser)
  File "/Users/russ/.asdf/installs/python/3.10.6/lib/python3.10/xml/etree/ElementTree.py", line 580, in parse
    self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 0

The file appears to be binary, but your code is expecting xml; I guess the one I found is 13 year old lol, so prolly wrong. Could you point me to the right github for this? Or, should I try update to the current eagle libs from them - which I think is https://github.com/sparkfun/SparkFun-Eagle-Libraries

from pcbflow.

ukd1 avatar ukd1 commented on May 29, 2024

USB-B-SMT I can only find in https://github.com/sparkfun/SparkFun-Eagle-Libraries/blob/main/SparkFun-Retired.lbr - but no idea if it's the same one

from pcbflow.

ukd1 avatar ukd1 commented on May 29, 2024

could it be replaced with USB-B-MICRO-SMD from https://github.com/sparkfun/SparkFun-Eagle-Libraries/blob/main/SparkFun-Connectors.lbr? (It runs / outputs something, but, I'm a noob - so no idea if it's actually "bad" output)

from pcbflow.

ukd1 avatar ukd1 commented on May 29, 2024

The sparkfun.lbr is just an Eagle parts library I use for testing. Unless you need to use parts from existing Eagle part libraries, then its not something you really require. I think there might be a copy in the scripts folder, but I'm not sure. In any case, it is simply a test file for verifying that pcbflow can read/import parts.

Just re-read this - I guess I didn't see the scripts part! thanks.

from pcbflow.

michaelgale avatar michaelgale commented on May 29, 2024

@ukd1 I presume I can close this issue unless there are any comments?

from pcbflow.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.