urgent-maroonU
Apify & Crawlee4y ago
3 replies
urgent-maroon

Python Functions?

Am I able to use Python functions when creating an actor? Up until recently I haven't used functions because I didn't understand them fully but now I have a better grasp on them. My code works on its own and I only ask because I got a syntax error when trying to run it as an actor and want to know if it's because of my code or compatibility issues. Thanks in advance!

Code giving the error
book.append({
  'title: ' get_title(doc),
  'price: ' get_price(doc),
  'publisher: ' get_pub(doc),
  'copyright: ' get_copy(doc),
  'descripion: ' get_desc(doc),
  'image: ' get_image(doc),
  })


Log
2022-10-22T02:53:58.993Z ACTOR: Pulling Docker image from repository.
2022-10-22T02:53:59.215Z ACTOR: Creating Docker container.
2022-10-22T02:53:59.415Z ACTOR: Starting Docker container.
2022-10-22T02:54:01.251Z   File "/usr/src/app/main.py", line 78
2022-10-22T02:54:01.252Z     'title: ' get_title(doc),
2022-10-22T02:54:01.253Z               ^
2022-10-22T02:54:01.253Z SyntaxError: invalid syntax
Was this page helpful?